TWI2 (i2c-2) external pull-up voltage

Started by ilario, December 13, 2024, 12:03:20 PM

Previous topic - Next topic

ilario

Dear all,
On a A64-OLinuXino (I have a rev E and a rev G) I am using also i2c-2, enabling the PE14,PE15 pins exposed on the GPIO1 port pins 33 and 35 using the device tree overlay proposed here: https://github.com/OLIMEX/olinuxino-overlays/pull/2

I realized that while TWI0 and TWI1 have 2.2 kOhm pull-ups to 3.3 V on both SDA and SCK, TWI2 does not have pull-ups in the schematics.

I am powering some i2c boards from Adafruit with 5 V, and controlling also a few MOD-IO2 units, so the questions are:

  • should I add external pull-ups?
  • should these pull-ups take the SDA and SCK up to 5 V or 3.3 V?
  • should these resistors be 2.2 kOhm? (I already have 1 kOhm and 10 kOhm, and I am unsure if it would be ok to use one of these instead)
  • is it ok to power the i2c boards with 5 V if the internal pull-ups take the SDA and SCK of TWI0 and TWI1 to 3.3 V?

Thanks!
Ilario

LubOlimex

You shouldn't connect 5V i2c to 3.3V i2c - you will probably need a level shifter. Refer to this document:

https://cdn-shop.adafruit.com/datasheets/AN10441.pdf

also this spec datasheet:

https://www.nxp.com/docs/en/user-guide/UM10204.pdf

About the questions:

1. Yes
2. 3.3
3. These values will likely work, but are not optimal. Value mainly depends on the length of cable. Pull ups can be 1k for longer wires and 10k for very short wires.
4. The I2C lines of A64-OLinuXino are at 3.3V levels. It is not a good practice to directly connect them to 5V I2C. The connection will probably not work. You need bi directional level shifter.
Technical support and documentation manager at Olimex

ilario

#2
Thanks for the answer!!!!

Quote from: LubOlimex on December 13, 2024, 02:24:15 PM3. These values will likely work, but are not optimal. Value mainly depends on the length of cable. Pull ups can be 1k for longer wires and 10k for very short wires.

I am connecting an Adafruit PCA9548 multiplexer with a 10 cm cable to 8 INA219 sensor boards where each of them have a 30 cm cable, so I would consider that the "cable" is pretty long.

Interestingly, the Adafruit PCA9548 multiplexer has a switch for selecting 3.3 V, but this will result only in giving 3.3 V to the downstream connected devices, while the SDA and SCK pins towards the computer will still work at V+ (which in my case is 5 V as I am powering the multiplexer with 5 V).

Quote from: LubOlimex on December 13, 2024, 02:24:15 PM4. The I2C lines of A64-OLinuXino are at 3.3V levels. It is not a good practice to directly connect them to 5V I2C. The connection will probably not work. You need bi directional level shifter.

Do you think this could be the cause of hardware failure for a A64-OLinuXino hardware revision E?

I likely unplugged the OLinuXino while the i2c boards were still powered by 5 V, which I read could be a problem. Could this have happened?

I was using TWI0 (exposed in LCD port), TWI1 (exposed in UEXT), TWI2 (exposed in GPIO1, forgetting to add a pull-up to this, but it was working anyways) and SPI0 (exposed in UEXT) all at 5 V. And after approx 6 month working, the computer stopped communicating with the i2c devices. Running i2cdetect resulted in messages like:

i2c i2c-1: mv64xxx: I2C bus locked, block: 1, time_left: 0
And then the computer sometimes was getting stuck at boot after:

Loading, please wait...
Starting version 247.3-7+deb11u4

And also started to show communication errors with the SD card like:

sunxi-mmc 1c0f000.mmc: data error, sending stop command
sunxi-mmc 1c0f000.mmc: send stop command failed
blk_update_request: I/O error, dev mmcblk1, sector 8413152 op 0x0:(READ) flags 0x3000 phys_seg 1 prio class 0
EXT4-fs error (device mmcblk1p1): __ext4_get_inode_loc_noinmem:4524: inode #264077: block 1049084: comm systemd-udevd: unablek
EXT4-fs (mmcblk1p1): I/O error while writing superblock
EXT4-fs error (device mmcblk1p1): ext4_check_bdev_write_error:217: comm systemd-journal: Error while async write back metadata
EXT4-fs (mmcblk1p1): previous I/O error to superblock detected
Aborting journal on device mmcblk1p1-8.
Buffer I/O error on device mmcblk1p1, logical block 4203651
JBD2: Error -5 detected when updating journal superblock for mmcblk1p1-8.
EXT4-fs (mmcblk1p1): Remounting filesystem read-only
EXT4-fs error (device mmcblk1p1) in ext4_reserve_inode_write:5841: Journal has aborted
EXT4-fs error (device mmcblk1p1): __ext4_find_entry:1579: inode #263583: comm systemd-udevd: reading directory lblock 0

but the SD card is perfect, checked on my laptop with:

fsck.ext4 -cc
And checking the badblocks list with

dumpe2fs -b
So I would say that the poor A64-OLinuXino is dead. Luckily I have another one :D

If I may abuse your wisdom, I will ask about another doubt:

On the SPI0 port I am controlling a piece of hardware that requires powering at 5 V (the chip itself can be powered at 3.3 V also, but the evaluation board cannot), and from the schematics it does not include anything for 3.3 V.
I would suppose that the board is giving 5 V signals to the computer, but luckily I am not even connecting the MISO pin (main in, subnode out) which seems to be the only one driven by the board. I am connecting just the clock (SCLK), MOSI (main out, subnode in, which should be driven by the computer to 3.3 V), and chip select (CK, which seems that is also driven by the computer). So I should be safe, right?

Thanks!!!



ilario

TL;DR:
Thanks for the answer, I will buy 3.3 V power suppliers and live happy.

LubOlimex

It seems all boards that you linked can be powered by 3.3V. I don't see a reason to power them by 5V... Just power all attached boards by 3.3V to avoid issues.

Also to be safe you can always measure. Before connecting the peripheral to the board measure if the voltage is 3.3V, if it is 3.3V then it is fine to connect to the A64.
Technical support and documentation manager at Olimex

ilario

Quote from: ilario on December 13, 2024, 12:03:20 PMTWI2 does not have pull-ups in the schematics

I was wrong. In the schematics there is a pull up on those pins. From the schematics seems that 2.8 V or 3.3 V can be selected with a "3.3V/VCC-PE:2.8V1 Opened(2-3);Closed(1-2)" selector. This selector is exposed on the bottom of the board. It does not seem to me that a selection can actually be done, as the track to 2.8 V is already present in the PCB. So that pull up will be fixed at 2.8 V.



I hope it is not too much voltage difference to power the boards with 3.3 V and to have the pull up at 2.8 V. Do you think this is ok?



Quote from: LubOlimex on December 17, 2024, 09:08:23 AMIt seems all boards that you linked can be powered by 3.3V.

Yes, everything except the "Evaluation Board for AD5370". The AD5370 chip itself would also like 3.3 V, bot the evaluation board requires 5 V. Citing the evaluation board manual "The evaluation board requires a +5V supply for DVCC".

So, for everything else, I bought the 3.3 V power supplies :)
As I am not confident I can safely use the PWR-90-240V-3.3V1.5A for the reasons mentioned here, I will use a more friendly 5-to-3.3V converter.


ilario

Quote from: ilario on January 08, 2025, 01:41:54 PMI was wrong. In the schematics there is a pull up on those pins.

And I was wrong again. The R101 and R102 resistors are not present on my board (there are just the tin pads, but no resistor), so that the voltage regulator is not actually pulling up the TWI2 pins. Now I realize that "NA(2.2k)" means that the resistor is not actually there...

So I will just add an external pull up.

LubOlimex

Yes, NA is short from "Not Assembled". There are component pads provided tho, meaning if you wish to add such resistors you can solder on the pads - just find the labels (R101 and R102).
Technical support and documentation manager at Olimex