2024-09-24 02:41 AM
I am using the STM32F413ZH (T6U) model, there is no problem with this model, it is a very nice model in terms of features. However, problems start when I use the I2C protocol.
When I checked the line with a logic analyzer, I saw that the SCL line is always pulled high and the SDA line is always pulled low. In fact, the module I use for I2C has pull-up resistors on it, as it should. Of course, I have changed the module several times and tried with other modules, but the result is the same. Moreover, even toggling nine times to save the line does not work.
I have read the communities and articles on the internet about the issue, but the solutions that are said to be done are not final.
Afterwards, I wondered if there was a problem with STM and tried with different cards, but again, as with STM, sometimes it worked and sometimes it locked up.
Note: On other boards, I couldn't toggle the line nine times because I used a high level library instead of writing register level code as in STM.
In the documents of NXP, the developer of the I2C protocol, it is stated that I2C is an inherently crash-prone protocol and suggested the solution I wrote.
There is no other solution I can think of, can you help me? Thank you in advance.
Sensors I use: mpu6050, qmc5883l
The board: Stm32f413zh
The Software: Stm32CubeIde
2024-09-24 05:31 AM
If SDA is stuck low, and toggling SCL 9x doesn't fix the problem, there is a hardware issue that cannot be solved by software. Perhaps something is miswired, or the slave is not powered, or some other showstopper is occurring.
Take a resistance measurement between SDA and 3V3 and also SCL and 3V3. They should match the value of the pullup you have on that line. If you can, take continuity measurements between the SDA on the STM32 and the SDA pin of your peripherals. They should all be connected.
2024-09-24 05:41 AM
Thank Guru for your answer,
I am going to try these, but I didn't understand all of last sentence. Can I use Logic Analyzer or Multimeter for the "continuity measurements between the SDA on the STM32 and the SDA pin of your peripherals."?
Have a nice day.
2024-09-24 06:41 AM
If you use a multimeter, ensure power is off, put multimeter in resistance mode, put one probe on the STM32's SDA pin, and the other on the MPU6050 SDA pin. Might be difficult if you don't have small probe tips.
I imagine the more important measurement would be SDA to 3V3. Can also measure SDA to GND and ensure it's high.