moononournation / RGB565_video

142 stars 33 forks source link

Card Mount failed ILI9225 #1

Closed u-can-call-me-My-Master closed 4 years ago

u-can-call-me-My-Master commented 4 years ago

Hi,

I can't run it with ESP-32S NodeMCU ver 1.1 and ILI9225 with SD card like at images below:

image image It says card mount failed.

moononournation commented 4 years ago

Can you run Arduino Example->SD(esp32)->SD_Test success?

u-can-call-me-My-Master commented 4 years ago

Yes, but only if I explicitly state those lines:

SPIClass spi = SPIClass(HSPI);
spi.begin(14, 12, 13, 5);
if (!SD.begin(SS, spi, 80000000))
{
 Serial.println("Card Mount Failed");
 return;
}

or using SPIClass spi = SPIClass(VSPI ) as well works. In any other case, like SD.begin(5) and etc - it does not work. I wired TFT to SPI CS, CLK, MOSI (15,14,13) and SD to same SPI's pins except SD_CS to pin number 5, which is VSPI's SS plus MISO to SPI pin №12. Am I doing smth wrong or it is just problems with display shield or arduino libraries?

moononournation commented 4 years ago

ok, then try replace to if (!SD.begin(5, spi, 80000000))

u-can-call-me-My-Master commented 4 years ago

I know it will. Because I defined SS as 5. But why it does not work like this:

if (!SD.begin(SS, SPI, 80000000))
  // SPIClass spi = SPIClass(VSPI);
  // spi.begin(SCK, MISO, MOSI, SS);
  // if (!SD.begin(SS, spi, 80000000))
  {
    Serial.println("Card Mount Failed");
    return;

And why it is so unstable? I cannot use SD.open("filepath") anywhere outside the setup scope

moononournation commented 4 years ago

The latest code have tested in M5Stack FIRE and works well. Please make sure you are using latest code.

u-can-call-me-My-Master commented 4 years ago

Could you please help with how to wire this setup: ILI9225 + ESP32(NodeMCU v1.1) that it should work. I just want to understand if I am doing something wrong or it is problem with tft shield

Also, would the SD(esp32)->SD_Test run without defining TFT spi?

moononournation commented 4 years ago

I think you would like to use 2 SPI hosts to connect SD card and ILI9225 separately, so I have added a new example using 2 SPI bus called SD_RGB565_video_PCM_audio_dualSPI to show how to do it. All connection pins defined at the file header, please take a look. And here are the demo video: https://youtu.be/MvewPMpKOHo

u-can-call-me-My-Master commented 4 years ago

Dear moononournation, Thank you very much for you kind help. Your new example is the best! It is very clear now. However, I could manage the problem before you posted. The problem was that because of my lack of experience, I did not know the SD.h library in pair with SPI.h tries to initialize VSPI instance with SD.begin(sd_cs_pin); by the default. Somewhy, my mind was turned to HSPI (may be because they say it is very fast) as default. Moreover it was not to easy to see it in libs and sources. So, in simple words I was trying to initialize HSPI buses twice in different variables e.g. one with gfx->begin(); and second one with SPIClass hspi = SPIClass(HSPI); SD->begin(5,hspi); so they were in conflict. Thus, when I realized it, I connected sd to VSPI pins and tft to hspi and it was working. Thanks.