Post topics, source code that relate to the Arduino Platform

User avatar
By winneymj
#26874 Hi,
I have started working with the ESP8266 using the Arduino interface. I am writing a driver for the SSD1322 OLED which is 256x64 pixels wide. Something strange is happening and it seems like something around speed of writing across SPI and timing.....
Let me explain....
I have the following code which will write 8k data across SPI to the OLED. Example code that shows the problem is attached.
If I comment out the delay(0), the chip will reset./crash with the delay(0) in place it all works great. My guess is the small timing delay is allowing something to work/continue.

Code: Select all  for (int m = 0; m < 128; m++)
  {
    display();
    delay(0);
  }


Is there something in contention with the SPI interface that needs to periodically execute. I know that if I reduce down the size of the data (8k) at a certain point it does not crash...but that could be because the time spent doing the SPI is also reduced.
Any ideas anyone.

Thanks
Mark
User avatar
By dafdaf
#32105 You probably resolved that long ago but I found your post because I was searching for other SPI+crash....

What seems to be your problem is the watchdog timer (from: http://www.danielcasner.org/guidelines- ... e-esp8266/ ):

All tasks and timers should complete in less than 2ms and must complete in less than 500ms or the watchdog timer will reset the MCU.

- David

btw: did you get SPI working ? My ESP8266 crashes when I try to read data via SPI. But not on the first tun - only after two or three tries.....