Unclean I2C - STM32WL5MOCH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-29 8:29 PM - edited ‎2025-05-29 8:31 PM
The I2C on our board is unclean, at all clock speeds - 1 MHz, 400 kHz and 100 kHz - even without rf circuitry running. Signal traces are about 5 cm long in total. Pullups were set at 1 kOhm to enable Fast Mode Plus, but even the Standard 100 kHz low frequency signal is glitchy.
All the modules work most of the time, but eventually they glitch out and quit. This probably has something to do with the I2C signals.
All of these chips are supposed to be able to handle a 1 kOhm pullup to 3.3V. They are also supposed to be able to handle up to a 1 MHz I2C clock.
Here is my schematic. SDA and SCL are connected to I2C2 on the STM32WL5MOCH.
To test the individual performance of each device, we individually enabled / disabled each module and then watched the I2C signal at 100 kHz.
Communicating with the OLED:
The MCU generates weird little spikes every once in a while, almost like it can't decide whether or not to hold that line down.
SHT40I-AD1B-R3 Temperature Sensor
VL53L4CDV0DH/1 Ranging Device:
What is that ugly signal? How do we get rid of it?
Solved! Go to Solution.
- Labels:
-
I2C
-
STM32WL series
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-29 8:48 PM
OLED trace is normal. Spikes occur during tradeoff on SDA line for ACK bit.
other traces not so much. Measure before and after the series resistor to see what’s trying to drive. Are pins set as open drain?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-29 8:48 PM
OLED trace is normal. Spikes occur during tradeoff on SDA line for ACK bit.
other traces not so much. Measure before and after the series resistor to see what’s trying to drive. Are pins set as open drain?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-29 10:41 PM - edited ‎2025-05-29 11:04 PM
We discovered the primary issue - when the OLED is powered off, it interferes significantly with the I2C lines. However, when it is powered on, the I2C lines are significantly cleaner. Perhaps the OLED is trying to power on when the I2C lines are pulled low due to vampire current. We're not sure why this is the case, but it easy enough to fix programmatically.
The next question we have is: why are there random spurs right after specific clock edges - and how do you get rid of them? It almost looks like the drive transistor is coupling to that clock edge, or there is a tiny glitch in the hardware peripheral. The spurs always occur at specific locations, even at different I2C frequencies - from 100 kHz to 1 MHz. The spurs are present even if the OLED is completely removed from the circuit. We have tested on two different boards, and the issue is exactly the same. We have tested with different pullup resistor values, both 1 kOhm and 3.3 kOhm. This has got to be some kind of hardware / software glitch.
1 MHz I2C Signal, 1 kOhm Pullups
400 kHz I2C Signal, 1 kOhm Pullups
Seems like the spurs are slightly worse if the pullup resistor value is lower. We tested with 3.3 kOhm as well as 1 kOhm. The 3.3 kOhm resistor was unable to go above 400 kHz without significant signal degradation. The 1 kOhm resistor worked at 1 MHz, however, the tops were rounded off.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-29 11:12 PM - edited ‎2025-05-29 11:13 PM
Thanks, I just needed clarification about the SDA spikes. You're saying the spikes are normal during tradeoff. That's all I needed to know - I guess as long as that spike doesn't interfere with the data. Is there any way to get rid of them altogether?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-30 6:16 AM
They are not causing issues and there's no need to get rid of them. Look at random I2C traces online and you'll see them everywhere. They are a non-issue.
Here is one such random scope trace showing a spike at the ACK bit:
