This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software:
ello everyone,
I'm interfacing an INA228 with an STM32 microcontroller via the I2C bus. However, I'm facing a problem with the communication that I can't seem to resolve.
I'm trying to write a pointer register on the INA228 by sending a 1-byte data, in order to perform then a read on this register:
I'm calling HAL_I2C_Master_Transmit(&hi2c1, INA228_ADDRESS<<1, txBuf, 1,HAL_MAX_DELAY)
txBuf contains address of register.
In most cases, the INA228 responds with a NACK. However, i tried putting my HAL_I2C_Master_Transmit in a loop and at a random iteration, device responds correctly and the transmission is successful. when its successful i tried reading register content using HAL_I2C_Master_Receive but it fails with error HAL_I2C_ERROR_AF (NACK)
Has anyone experienced similar issues with the INA228 using the STM32 HAL library?
Any help or suggestions would be greatly appreciated! Thanks in advance
I notice a desynchronization between the data and the clock, is that correct?
Link to STM32 forum: community.st.com/.../744295
Hello,
It looks like the data logic level low is not going low enough. The INA228 needs to have a logic level low no higher than 0.4V. Often this is caused by the MCU's ability to sink current into the pin. So, you have two options:
1. Many MCU's have a setting to change the current sink capability, if you increase the current sink capability then it will be able to pull the low line closer to GND.
2. You can use a larger pullup resistor. Since you are communicating at only 100KHz and 400KHz, you would be fine with a 10kΩ resistor instead of a 2.2kΩ.
Regards,
Mitch
Hello Mitch, thanks for your reply, i missed some important details that i explained in this post: https://community.st.com/t5/stm32-mcus-products/i2c-communication-with-ina228-from-texas-instrument/m-p/744241 (My mcu is connected to INA228 via an isolater ADUM1250)
I'll consider your observation about the low level.
It's not a problem that first bit low of data is not synchro with clock ? I found this a bit strange ..
SDA is sampled only on the rising edge of SCL. The falling edge on SDA while SCL is high is the start condition. The timing of these waveforms is OK.
Hello,
As Clemens noted, the timing is fine.
Since you are using an isolator, you'll want to check the logic high and low levels on both sides of the isolator. Many isolators have different specs for each side of the isolator, so sometimes switching the isolator around can help. I've also seen that adding a small capacitor to GND on the communication lines on both side of the isolator can also help (~33pF).
As a side note, you may be interested in our isolated ADCs. We have some that are focused on current sensing and can operate from either a single or dual supply:
https://www.ti.com/isolation/isolated-adcs/overview.html
Regards,
Mitch