2024-05-20 11:46 PM
2024-05-21 03:00 AM
Have you used an oscilloscope to see what's happening on the wires? Also check that power supplies are clean & stable before attempting to start comms.
2024-05-21 05:17 AM
Hello,
Thank you for the reply.
We'll do further electrical measurements and paste them later but from the previous measurements I remember no difference with the I2C electrical signal at the start (when problem occurs) and at the working system (when the problem does not occur).
What can be done to make to disappear these errors: 0x02 (ARLO), 0x04 (ACKF)? Or if it's not possible, how to unblock communication apart from restarting STM?
STM and I2C communication is started only when 3.3V output is with active power good flag from power supply and there's a long delay (>1s) from the start of the power good signal to start the communication.
The most common situation when these errors occurs is at the programming running setup: when the STM is forced to reset and I2C is running.
2024-05-21 05:23 AM
On recovering from I2C errors:
@KGryn.1 wrote:The most common situation when these errors occurs is at the programming running setup: when the STM is forced to reset and I2C is running.
So you could be in the middle of an I2C transaction when this reset occurs? Could well "confuse" the slave...
2024-05-21 05:46 AM
Thanks for the link: we tried this nine clock pulses tip some time ago but with no posotive results.
But we did implementation on our own - maybe it was faulty - do you have functional code with this I2C recovery method?
2024-05-22 01:44 AM
Hello @KGryn.1
Did you add pull-up resistors to the SDA and SCL lines? The typical values are between 4.7kΩ and 10kΩ
2024-05-22 07:03 AM
Hello,
Today we continued testing and measurements.
Regards
2024-05-22 07:49 AM
Hello @KGryn.1
>HAL during normal operation has a problem with handling communication faults
To recover I2C communication after encountering errors such as 0x02 (ARLO) or 0x04 (ACKF), you can perform an abort, de-initialization, and re-initialization of the I2C peripheral. This process will reset the I2C hardware block within the STM32 microcontroller and clear any error conditions, allowing you to attempt communication again.
2024-05-22 09:14 AM
1) Both seem kind of weak. At high speeds 1K5 or 2K7 are probably more common, to get more aggressive rising edge, with higher current/energy consumption, obviously. Weak pull-ups used in low-power implementations, and those with low bus capacitance.
2) Kind of situation where clocking out should remediate, or indicative of the I2C, SPI or HDQ mode not being clearly established to the IC. 9 clocks comes from the address decode and nack, you're attempting to cause slaves to release any perceived ownership/selection.
3) the pull-up should go to the power rail, not sure how you'd move that without a lot of current flowing, definitely shouldn't by acting as a potential divider as one point's fixed/established. Yes STM32's are not going to be happy seeing LOW levels, as it's an indication the bus is busy.
Operating at different supply levels, or all at 3V3 ?
Couple of I2C threads on TI's forum about BQ76952, and some issue with I2C and early steps of IC
2024-05-23 07:14 AM
Hello,
For today's tests we still had 10k pull-ups and 3.3V power supply mainly because signals edges look fine at the scope.
Apart from the pull-ups value can you estimate difference and disadvantages of sending more than 9 clock pulses at the beginning of the transmission? As previously I'm asking because this setup with 20 clock pulses (or generally >= 2x 9 clock pulses) works well so far so question is if it's ok for any other reason.
From my point 3.
"HAL during normal operation has a problem with handling communication faults e.g. short between SDA and SCL (e.g. enviromental pollution between pull-ups). Do you have tips for handling this issue? "
This happens when SCL line is externally shorted to ground. STM32 detects this as arbitration lost (ARLO error) in muli-master setup. This leaves BUSY flag set, waiting for STOP condition from other master. In single master case this never happens and it blocks all next transmissions. According to reference manual, setting PE bit to 0 is the only option to reset this flag if there is no other master that can generate STOP condition.
As a workaround we are toggling PE bit to 0 and back to 1 if we detect transmission error and BUSY flag is still set after transmission.
Is any disadvantages could be caused by this method? As previously this resolved our issues but we're not sure if it's ok for some other aspects and cases.
Regards