Hi friends, I've got a 2.4" TFT Display Featherwing on a Feather M0 Express. I'm using Arduino IDE.
It runs the graphicstest_featherwing program from the Adafruit ILI9341 examples just fine.
When I try to run the FeatherWingILI9341 example from the Adafruit Image Reader library, I get SD begin() failed.
Interestingly, I ran the example bitmapdraw_featherwing from the Adafruit HX8357 library and it was able to initialize the SD card and read a file from it. (it displayed it oddly, but that's a different question).
From what I can see, the code difference between the two is that the Adafruit Image Reader library examples use the SdFat.h library, while the HX8357 library examples use the regular SD.h library. Both example programs are using the same pin definitions.
Any ideas how I can sort this out? I can't get any of the examples using SdFat.h to recognize the SD card, while all of the SD.h examples *do* recognize the card and can read from it.
Thanks! Vince
Can't init display's SD drive with SdFat library
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- vdonovan2000
- Posts: 26
- Joined: Tue Mar 05, 2019 8:38 pm
- mikeysklar
- Posts: 13936
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Can't init display's SD drive with SdFat library
Hi Vince,
Oddly enough the only check I see for the SD begin() failed is for the 25MHz limit check. You might be able to just commend that in this case. However, the first thing I would try is to add a delay in your code of a few ms before calling tft.begin().
Oddly enough the only check I see for the SD begin() failed is for the 25MHz limit check. You might be able to just commend that in this case. However, the first thing I would try is to add a delay in your code of a few ms before calling tft.begin().
Code: Select all
// The Adafruit_ImageReader constructor call (above, before setup())
// accepts an uninitialized SdFat or FatFileSystem object. This MUST
// BE INITIALIZED before using any of the image reader functions!
Serial.print(F("Initializing filesystem..."));
#if defined(USE_SD_CARD)
// SD card is pretty straightforward, a single call...
if(!SD.begin(SD_CS, SD_SCK_MHZ(25))) { // ESP32 requires 25 MHz limit
Serial.println(F("SD begin() failed"));
for(;;); // Fatal error, do not continue
}
#else
// SPI or QSPI flash requires two steps, one to access the bare flash
// memory itself, then the second to access the filesystem within...
if(!flash.begin()) {
Serial.println(F("flash begin() failed"));
for(;;);
}
if(!filesys.begin(&flash)) {
Serial.println(F("filesys begin() failed"));
for(;;);
}
#endif
- vdonovan2000
- Posts: 26
- Joined: Tue Mar 05, 2019 8:38 pm
Re: Can't init display's SD drive with SdFat library
Many thanks! I'll give a try and report back.
best regards,
Vince
best regards,
Vince
- vdonovan2000
- Posts: 26
- Joined: Tue Mar 05, 2019 8:38 pm
Re: Can't init display's SD drive with SdFat library
I down graded to the 1.1.2 version of the Adafruit Image Reader library, which uses SD.h and not SDFat, and now it seems to work fine.
Thanks for the help,
Vince
Thanks for the help,
Vince
- DavidChess
- Posts: 1
- Joined: Wed Jun 13, 2018 11:02 am
Re: Can't init display's SD drive with SdFat library
Same error I get with the example code. Changes are made and no one checks to see if examples are broken. This is what I found:
Adafruit drivers broken
I have a KMR 1.8 SPI display that I bought from JameCo Electronic and decided to connect to an Arduino Uno with 1K level shifting resistors. While it worked great with the Adafruit ST7735 graphictest demo and some code edits to change to English rewrite of a displayed sentence, it worked. Adding the SD card, I check the functions with Adafruit ImageReader Library for the ST7735 and it failed the SD init. Changing pin 8 with 9 did not help. The SD card was checked and in good working order.
Using a SD card only program example, the card accessed and initialized as expected. Going back to the graphic test program has completed both hardware sections validation and was working as wired. I continued checking the internet and found mschoeffler site to have a working program for my hardware setup. He also had issues and did not use the adafruit drivers but used standard SPI, SD, and TFT drivers.
Many people have some close working walk arounds but I believe that involves changing the chips select pins manually and that the drives should have done on their own. I know the new ST7735 driver has problems in displaying correct colors and was almost fixed and it was made to run faster but messing with chip select should not be an issue and the drivers should be doing it. I say this because basic drivers work the SD card and display correctly.
Adafruit drivers broken
I have a KMR 1.8 SPI display that I bought from JameCo Electronic and decided to connect to an Arduino Uno with 1K level shifting resistors. While it worked great with the Adafruit ST7735 graphictest demo and some code edits to change to English rewrite of a displayed sentence, it worked. Adding the SD card, I check the functions with Adafruit ImageReader Library for the ST7735 and it failed the SD init. Changing pin 8 with 9 did not help. The SD card was checked and in good working order.
Using a SD card only program example, the card accessed and initialized as expected. Going back to the graphic test program has completed both hardware sections validation and was working as wired. I continued checking the internet and found mschoeffler site to have a working program for my hardware setup. He also had issues and did not use the adafruit drivers but used standard SPI, SD, and TFT drivers.
Many people have some close working walk arounds but I believe that involves changing the chips select pins manually and that the drives should have done on their own. I know the new ST7735 driver has problems in displaying correct colors and was almost fixed and it was made to run faster but messing with chip select should not be an issue and the drivers should be doing it. I say this because basic drivers work the SD card and display correctly.
Please be positive and constructive with your questions and comments.