0

I'm trying to run Waveshare SSD1327 128x128 screen via SPI on ESP32 WROOM32 board. On ESP8266 (D1R1?) it works flawlessly while using HW SPI but when I run it on esp32, anything connected to mains which is sitting <50cm from screen will glitch it out completely. Even if I just hold in one hand phone charger cable connected to mains, and come close to screen with my other hand(at least 1m distance between hands), screen will instantly glitch and shut down. I'm pretty sure this is not connection issue, since it works on ESP8266 and I even tried soldering wires directly to ESP32 board.

I am using VS Code PlatformIO and Arduino framework. I tried setting CPU freq to 40MHz by adding line to platformio.ini and calling setCpuFrequencyMhz(40); in my setup() function. I don't have oscilloscope to confirm that this actually happend. I read somewhere that this .ini thing didn't work.

I am using U8g2lib for screen which is using global SPI object. Even tho I bought screen from Waveshare I can't use WS implementation. MIDAS one is the only implementation which works for me. Since my board doesn't have all VSPI pins, I had to set them manually in SPI.begin(...):

U8G2_SSD1327_MIDAS_128X128_F_4W_HW_SPI display(U8G2_R0, /* cs=*/ 39, /* dc=*/ 16, /* reset=*/ 2);
...
...
pinMode(39, OUTPUT);
pinMode(14, OUTPUT);
pinMode(13, OUTPUT);
pinMode(12, INPUT); 

digitalWrite(39, LOW);
// sck, miso, mosi, ss
SPI.begin(14, 12, 13, 39);
display.begin();

This is ESP32 board I'm using

BTW, SW SPI worked extremely slow for me(display.sendBuffer() takes about 1sec), on both ESP32 WROOM32 and ESP8266 D1R1 mini. Friend of mine is using ESP32 WROOVER board and even SW SPI is working for him great without any glitching.

2
  • I would suggest you check all of your ground and power connections. Also all unused ESP32 pins should be terminated. You can simply set them as outputs and turn them on to low.
    – Gil
    Commented Jul 8, 2021 at 0:33
  • Isn't gpio39 only an input? I am not sure that you can set it as output.
    – Adriano
    Commented Jul 13, 2021 at 19:38

1 Answer 1

1

Problem was GPIO39 which is internally connected to a hall sensor... Once I changed CS to some other pin, everything started working...

Having pin cheatsheet would be really helpful in these situations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.