rust-embedded-community / ssd1306

SSD1306 OLED driver
Apache License 2.0
283 stars 69 forks source link

power-on versus reset #149

Closed astraw closed 3 years ago

astraw commented 3 years ago

Hi,

(I'm pleased that with minimal effort I have an ssd1306 display working on my stm32h7 Nucleo board - thanks for that!)

When I upload a fresh copy of the device firmware via st-link, my ssd1306 display (an Adafruit model 326, which is a 128x64 pixel OLED display) works fine. The display is getting power from GND and 3v3 pins of the Nucleo board, and I am communicating via I2C (to address 0x3d) using a couple more pins for SDA and SCK.

Now, however, if I re-plug my Nucleo to power cycle it, the display is not initializing and I'm not able to write to it. I've tried checking if it is simply a race condition in which the stm core on the Nucleo boots faster than the ssd1306 display, but that does not seem to be the issue -- even long delays prior to attempting to communicate with the display do not solve the issue.

Therefore, my question, which is really a request for advice: where should I start looking to identify differences between the state of the Nucleo board in "fresh power on" versus "just uploaded new firmware"? Obviously, I would like my display to work even if I do not flash new firmware to the device.

(This question is perhaps only tangentially related to the ssd1306 crate itself, apologies for that. I will gladly follow up on requests to take the question elsewhere. Advice on where that would be would also be gratefully accepted.)

astraw commented 3 years ago

So I used an even longer delay (about 100 msec) and now things work. Thus after all it was a race condition between the boot speed of my microcontroller and the boot speed of the SSD1306.