adafruit / Adafruit_SSD1306

Arduino library for SSD1306 monochrome 128x64 and 128x32 OLEDs
http://www.adafruit.com/category/63_98
Other
1.81k stars 984 forks source link

Using clearDisplay() in the main loop causes Arduino Micro / Pro Micro bootloader to crash #253

Open siteswapjuggler opened 1 year ago

siteswapjuggler commented 1 year ago

Still working on an example of this bug but as far as I could tested using clearDisplay() in the main loop causes the Arduino Micro bootloader to crash making all further upload from the Arduino IDE unavailable.

I really don't know what could cause this. My minimal example did not use anything but this Library.

siteswapjuggler commented 1 year ago

Usually WIDTH and HEIGHT are macro defined in the main program but well what you found is a good start I will git it a try as soon as possible. It could be a type problem or a precompilation one.

ChristianBrandtner commented 1 year ago

Sorry, after some tests, same problem. It is not the cleardisplay, I have commented out the memset in cleardisplay and the same problem with bootloader.

The error must be somewhere else, I already suspected that a fake chip on my board was causing the problem

siteswapjuggler commented 1 year ago

Yep unfurtunately same conclusion here, apparently I've found many occurence of the 32u4 bootloader being frozen with other arduino sktechs so it may not be linked to this specific library but something more general like progmem access or execution time. My only solution yet has been to pass over the bootloader and to program systematically via the ICSP port

ChristianBrandtner commented 1 year ago

the problem in my case is found, its a hardwareproblem! https://forum.arduino.cc/t/bootloader-overwritten-by-regular-sketch-upload/387334/12.

Manual reset at the right moment and the upload works, so I have to search the capacitor at reset input on the Pro Mini board or it is a problem of my USB serial adapter.

Update: I use Ardunio Pro Mini with 5V / 16Mhz. The DTR signal from USB serial adapter switch from 3,3V to 0. That's not enough to reset ATmega. If 5V to 0 it is running.

siteswapjuggler commented 1 year ago

Hmmm ok... from my side I'm almost certain that the problem with the Arduino micro is 100% software related but I'll keep investigate. Lately going from the I2C declaration to the hardware SPI one seems to solve the problem....