Adafrit 2.2" TFT with Micro SD and QtPy RP2040

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
JohnCary
 
Posts: 11
Joined: Sun Jan 17, 2016 8:46 pm

Adafrit 2.2" TFT with Micro SD and QtPy RP2040

Post by JohnCary »

I am trying to use the Adafruit 2.2" TFT display with the ILI9340 chip set to load images from the SD Card and display them using the QtPy RP2040. I have used the examples from the ILI9341 library to run a graphics test, I've also used the SdInfo and the OpenNext examples to read the SD Card. All have been successful. So, the RP2040 is correctly connected to the SPI bus, the chip select and D/C pins are wired correctly. I can load the dragon.h image from memory and display it on the device as demonstrated in the examples. But the ImageReader code will not load any images to the TFT. I have tried with different named files, I've used the "/" before the filename and with just the filename to no success. I'll include my code file. I've added the sd card read files code that insures I have the correct files on the sd card. When I run the sketch, the Serial Monitor receives the "Initializing the files system... OK" message, it then lists all the bmp files on the sd card, which are files from Adafruit for testing. But when the stat reader.drawBMP("/blinka.bmp", tft, 0, 0) executes I get a file not found error. The same happens with any bmp file I try. I've used different SD cards, 2G to 32G all formatted as Fat32 from different manufacturers. The sketch also turns the screen orange, so the QtPy is communicating with the screen. Any suggestions of what else to try or how to proceed would be appreciated.
Code.txt
(2.66 KiB) Downloaded 23 times
And the output from the Serial Monitor.
Output.txt
(1.08 KiB) Downloaded 8 times

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adafrit 2.2" TFT with Micro SD and QtPy RP2040

Post by mikeysklar »

It looks like you are doing everything correctly.

This is most likely a library dependency issue.

from the Adafruit_ImageReader github:

https://github.com/adafruit/Adafruit_ImageReader
IMPORTANT NOTE: version 2.0 is a "breaking change" from the 1.X releases of this library. Existing code WILL NOT COMPILE without revision. Adafruit_ImageReader now relies on the Adafruit_SPIFlash and SdFat libraries, and the Adafruit_ImageReader constructor call has changed (other functions remain the same). See the examples for reference. Very sorry about that but it brings some helpful speed and feature benefits (like loading from SPI/QSPI flash).
So which version of the libraries are you using? I'd start by updating all of them to current. I'm particularly suspicious of Adafruit_ImageReader being current, but SdFat being out of date based on the above.

User avatar
JohnCary
 
Posts: 11
Joined: Sun Jan 17, 2016 8:46 pm

Re: Adafrit 2.2" TFT with Micro SD and QtPy RP2040

Post by JohnCary »

Thanks for your reply. I did have the latest version for each of the included libraries. After much trial and error, I have worked it out. I was using the call to the ImageReader function specifying the SPI pins. I had found that when I didn't specify them it wouldn't work using the defualt SPI pins either. My solution since I'm using an RP2040 board the QTPY RP2040 and Earle F. Philhower Library - was to include SPI and use his example to set the correct SPI pins for the board before I called tft.begin in the setup section of the sketch. This finally got the ImageRead on the SD Card working. So I'm using.

Code: Select all

SPI.setRX(TFT_MISO);
SPI.setTX(TFT_MOSI);
SPI.setSCK(TFT_SCK);

tft.begin();

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Adafrit 2.2" TFT with Micro SD and QtPy RP2040

Post by mikeysklar »

Ahh, this is super helpful. Thank you for sharing the solution.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”