Repository navigation
Helpful tips with ESP32 & ST7789 displaying images for an SD card #3922
spencereperry
started this conversation in
Alerts
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
After spending a full day debugging, I got a working ST7789 240x240 IPS display showing JPEG images from an SD card on an ESP32 DevKit.Here are the gotchas I ran into a cost that cost me hours:
Board: ESP32 Dev Module (Freenove ESP32 WROOM)
TFT_eSPI version: 2.5.43
JPEGDEC version: 1.8.4
Arduino IDE: 2.3.8
GPIO 2 causes watchdog crash on boot. You may get invalid packet header errors and need to reflash the board! For this reason, I do not recommend putting the DC Pin on that GPIO.
I recommend using HSPI for the SD card and VSPI for the TFT (or vice versa) because my testing showed that on the same line, they have a nasty habit of interfering with each other. This could be a failure on my part, but I did fix it by switching over.
If you have issues reading from the SD card at first, but they get solved when you press the reset button, code an ESP.restart(); to make it reset. This isn't the best solution, but if you need it done quickly and are comfortable with a quick-and-dirty approach, it works well.
I used the JPEGDEC library to decode the .JPEG files to be pushed by the TFT. I ran into the problem of Endianness, where the leading and trailing bits are swapped. I recommend manually swapping it to big endian, or use:
jpeg.setPixelType(RGB565_BIG_ENDIAN);
before jpeg.decode()
I had to filter out hidden files that started with ._ for Mac; it may be different on Windows. Macs automatically create these files, but they cannot be displayed, so you need to filter them out if you are pulling many files from an SD card.
Hope this saves someone a few hours!
All reactions