I have been working with the ina226 sensor for a while using this cheap dev board I never had any problems with: enter image description here
I ordered more new of this sensors from AliExpress and they look like this:
Main difference comes from that little dot, which after testing I found is connected to nothing, so I use it just as a reference to differentiate both. The problem comes from communication attemp with this sensor using different MCU. Next picture shows i2c data from Logic Analizer for all cases:
As can be seem communication with the new modules (with the dot) is only possible using the Arduino UNO, while communication with the old modules (without dot) is only possible using the stm32F411. It is weird since both modules already come wih pull up resistors (10K), connections are the same, address (0x40) is the same for both. But I canot figure it out why one module can only communicate with Arduino, while the other only with STM32F411
Here I am sharing the osciloscope results
As can be seen again the stm32f411 only works fine with one INA226, while the arduino works only with the one the STM32F411 is not capable to work with. I have plenty of both cases, all old INA226 (without dot) I used work fine with the STM and wrong with the Arduino, while all new INA 226 sensors (with dot) work fine with the Arduino and wrong with STM
-
5\$\begingroup\$ Probably you recorded these waves with a logic analyzer. Please repeat the measurements with an oscilloscope and add the actual analog waves to your question. The levels might be so different that this issue arises. \$\endgroup\$the busybee– the busybee2024年11月19日 06:47:41 +00:00Commented Nov 19, 2024 at 6:47
-
\$\begingroup\$ Hi busybee, I will do it in a moment on a lab, but after reading your comment I found this technical article "Quick Fixes to Common I2C Headaches", and I think my problem is related to "Headache No. 1: Static Voltage Offset Mismatch", maybe these new and old INA226 have diferente voltage offsets, if so, how could someone solve it ?? \$\endgroup\$Jos PaCo– Jos PaCo2024年11月19日 14:29:39 +00:00Commented Nov 19, 2024 at 14:29
-
1\$\begingroup\$ That's why I asked for analog waves. First you need to see the actual problem. Only then you will tackle the cause. Commonly I²C is really simple... \$\endgroup\$the busybee– the busybee2024年11月19日 14:33:11 +00:00Commented Nov 19, 2024 at 14:33
-
\$\begingroup\$ Greetings, is already edited with osciloscope results \$\endgroup\$Jos PaCo– Jos PaCo2024年11月19日 16:25:21 +00:00Commented Nov 19, 2024 at 16:25
-
1\$\begingroup\$ Well it is weird. But notice that you are using a 5V MCU with 5V I2C bus and pull-ups to 5V while powering the 3.3V INA and it has 3.3V I2C bus with 3.3V pull-ups. That's not something that should be done. Also the bus waveforms look like tens of centimeters of not a meter of cabling, 5 cm should be absolutely clean. Can you take a photo or describe how you connected the probe and set it up, there's many ways to see a bad signal with bad probing and the signal itself is good. 10x probe is a must, not 1x. \$\endgroup\$Justme– Justme2024年11月19日 21:42:30 +00:00Commented Nov 19, 2024 at 21:42
1 Answer 1
So, you have two different instantiations of a board. A program on one platform makes one of them run, and a program on a different platform makes the other one run.
So, by your testing, because each platform works with one of the boards, we know the code on both "works" -- suggesting some sort of hardware issue.
So, looking at the pin out of the chip (https://www.ti.com/lit/ds/symlink/ina226.pdf) There really isn't anything on it that can impact anything like I2C mode. The only pins I see that impact communication between the unit and a microcontroller are the address pins.
Since one board works on one controller, and the other one works with a different controller, maybe the boards have two different addresses, and one programmed address matches one board, and the other matches the other.
So, without bothering to look at your timing diagram in detail, I'd start by closely looking at how bits A0 and A1 are wired on each board, and make sure you understand the I2C address of each board. Next, look at the code, and verify the address the program thinks the board is at.
-
1\$\begingroup\$ Thanks for your repply, as you can see on the Logig Analizer results both INA266 boards responf to (0x40) address, but like mentioned, on does correctly with one platform while falling with the other \$\endgroup\$Jos PaCo– Jos PaCo2024年11月19日 17:22:30 +00:00Commented Nov 19, 2024 at 17:22