OLED hang on Arduino Nano
On my 6 Channel Remote Control project, I discovered it hang at random time within ~15 minutes. Accidentally I discovered that it will immediately hang when I touch the I2C line (SDA, SCK). Another observation is the OLED is glitching randomly. Initially I though it is separate issue but the solution for hang also solve the glitching.
(1) At first I though maybe because of noisy power supply causing the microcontroller to hang. So I add 100uF capacitor on the 5V. It does help, still hang
(2) Since it was immediately hang when I touch the SDA/SCK, maybe by touching I'm adding capacitive load, slowing down I2C signal and causing communication error to OLED. I add 4.7K pull-up resistor to increase rise time but it make it worst, the remote control hang immediately after displaying welcome message on OLED even without touching SDA/SCL π±.
- 1uF on both SDA and SCK, it does not even boot up. I probe SDA and SCK totally flat π. Too much capacitance, filtered the whole signal.
- 1000pF on both SDA and SCK, does not boot up. However, it is able boot up if I only put 1000pF on the SCK π€. Surprisingly it does not hang even after ON for 30 minutes π. Even more interesting the OLED stop glitching π². I solved 2 issues π.
I observed only 1 frequency at lower clock 76kHz. Could it be the clock switching causing the issue? Also look like "Adafruit 1306" library somehow did calibration to see which frequency can work.
- 100pF, same as above it does not boot up if put on both SDA and SCK. This time I observed 2 frequencies again but at lower speed, 99kHz on the left and 250kHz on the right. No glitching and not hang after ON for 3 hours and counting π. This experiment prove that the clock switching is not the cause of the problem. Issue solve even though the clock switching still there.
Comments
Post a Comment