Other Parts Discussed in Thread: BQ76942
Tool/software:
Hi!
We have faced a problem regarding I2C communication between STM32 (master) and BQ76952 (slave) that we both have on our battery management system.
We have two issues with I2C.
First I2C issue:
Using the same device and same software we noticed three situations that occur randomly:
- After boot write commands are not returning any errors and further communication is correct.
- After boot few initial write commands are returning error and further communication is correct. However, we have noticed that some devices lost communication after longer period (for example two months) and we don't know what the reason for it is. Only after rebooting STM32 communication is correct.
- Sometimes after boot, few initial write commands are returning error and I2C peripheral locks up. In such a case all communication is failing. Only after rebooting STM32 communication is correct.
- I2C Speed: 100 kHz, pull-up resistors are 10k, also tested with 4.7kΩ with no changes
We solved this first I2C issue by sending 20 empty clock cycles at the start/restart of the system. Also tried with 9 empty clock cycles but with worse results than with 20 empty clock cycles. These 20 empty clock cycles clear the SDA pulled to GND by BQ76952 and let the communication to start properly.
Second I2C issue:
ST's HAL during normal operation has a problem with handling communication faults e.g. short between SDA and SCL (e.g. environmental pollution between pull-ups).
We solved this issue by toggling PE bit to 0 and back to 1 if we detect transmission error and BUSY flag is still set after transmission.
Are there any disadvantages that could be caused by these fixes in relation to the BQ76952? These two solutions resolved our issues but we're not sure, if it's ok for some other aspects and cases for the BQ76952. We tested these two approaches and both gave positive results.
Kind regards,
Karol