Chat here about code rewrites, mods, etc... with respect to the github project https://github.com/esp8266/Arduino

Moderator: igrr

User avatar
By fishix
#37590 Hi,

I'm trying out an SSD1306 display with Adafruit's 128*64 I2C example.

First I tried the original Adafruit's library (with necessary adjustments, e.g. baud rate, I2C address, etc.). The program worked for the few first commands (display buffer, display a pixel) stopped at the testdrawline() routine, having drawn some line. On the serial monitor, it says

Code: Select allctx: cont
sp: 3ffea4d0 end: 3ffea760 offset: 01b0

>>>stack>>>
3ffea680:  3ffe95f5 00000000 00000002 402011e0 
3ffea690:  00000011 00000001 3ffe95ef 40201339 
3ffea6a0:  00000007 3ffe95c8 3ffe95e1 3ffe95c8 
3ffea6b0:  3ffe95c8 00000050 3ffe95e1 402056dc 
3ffea6c0:  0000004c 0000004c 3ffe9598 40205702 
3ffea6d0:  00500000 3ffe9598 3ffe9598 40204ae4 
3ffea6e0:  0000000f 0000003f 3ffe9598 40205702 
3ffea6f0:  3ffe9648 40100d43 000007d0 3ffea78c 
3ffea700:  00500000 3ffe9598 40202cd8 40202823 
3ffea710:  4020153a 000007d0 00000000 3ffea78c 
3ffea720:  3fffdc20 00000000 3ffe9598 40202b40 
3ffea730:  00000000 00000000 00000000 00000000 
3ffea740:  3fffdc20 00000000 3ffea784 40201cbf 
3ffea750:  00000000 00000000 3ffe9740 40100118 
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

I then loaded this library which is supposed to work with ESP8266. It got everything right up until when it tries to display a bitmap, when I got

Code: Select allException (3):
epc1=0x40205200 epc2=0x00000000 epc3=0x00000000 excvaddr=0x4022ea0c depc=0x00000000

ctx: cont
sp: 3ffea560 end: 3ffea770 offset: 01a0

>>>stack>>>
3ffea700:  3ffe965c 40100d43 000007d0 3ffe965c 
3ffea710:  3fffdc20 3ffea79c 40201c4e 3ffe9750 
3ffea720:  4020153a 000007d0 3ffe9598 3ffea79c 
3ffea730:  00000001 4022ea0c 3ffe9598 40202c98 
3ffea740:  00000001 00000000 00000000 00000000 
3ffea750:  3fffdc20 00000000 3ffea794 40201cbf 
3ffea760:  00000000 00000000 3ffe9750 40100118 
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

I tried this code on an Arduino Micro and it worked perfectly. I first thought that this was a memory issue, until I found this video that runs an SSD1306 with an ESP8266 just fine using the second library.



Any hints would be greatly appreciated. Thanks!

PS. On the example code, I got a problem with this bit:
Code: Select all#if (SSD1306_LCDHEIGHT != 64)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif

Even though I have fixed the .h file (#define SSD1306_128_64), it still gives me that error. Trying to print out the value of SSD1306_LCDHEIGHT gives me 64. So I'm not sure what the problem was and ended up commenting it out.
User avatar
By schufti
#37616 Hi,
I can remember running into the same problem with i2c. AFAIK it was a timing problem caused by the bitbanging i2c and the "fill" routines engaging the i2c for too long, running into wdt reset.
Unfortunately W7 made me "check" my memory-stick, rendering it useless and loose most my sources ...
User avatar
By fishix
#37622 Hmm... interesting. I tried adding yield(); to some of the loops and it seems like I can use the original library now (although very slowly). Apparently the new library doesn't use WDT, which is why the results are different.

Do you know if there's a solution to this? What do people do? Or should I just use another microcontroller with ESP8266 as a wifi module :(
User avatar
By schufti
#37633 it's not as if anything "arduino" is using wdt, the wdt is set in the underlying firmware and if the "aduino" part is not "friendly" the wdt reset is the slap on the fingers...
You could also try to increase i2c speed...