2023-11-15 02:03 AM
Hi everyone,
I am using STM32F407 to read voltage and current values from INA232 and TCA9548.
I have 8 INA232 so I used TCA9548 as I2C Switch.
I have coded as follows:
1. SET TCA9548 on Port 1
2. Read the voltage value on INA232 at port 1
The result I get is 0x00,
I think my I2C function is having problems and != HAL_OK
The return value is 0x00
I used the Oscilloscope and saw a signal on SCL and SDA.
Can you give me some suggestions to solve this problem?
Thanks everyone,
2023-11-15 12:17 PM
First, please post your code by copy/paste into the forum message using the code tags (click on "..." then look for "</>" button). Just makes it easier for everyone to read.
You don't check the HAL return codes anywhere except in INA232_GetBusVReg() function. See if something earlier failed. And what status DOES get returned in INA232_GetBusVReg()? Then use our debugger and step INTO the HAL_I2C functions and see what goes wrong.