How to suppress sd_diskio message from USB serial output

PeteDD
Posts: 45
Joined: Sat Sep 24, 2022 5:22 pm

How to suppress sd_diskio message from USB serial output

Postby PeteDD » Mon Feb 06, 2023 8:36 pm

I am using SD card module with ESP32-S3_DEVKIT1. My goal is to check for inserted card. Code is easy enough but when I do the SD.begin(my_SD_CS_pin), when the card is not present, I get a bunch of SDcommand messages from SD_diskio.cpp out the USB serial monitor port. How can I suppress these message (the ones beginning with the bracketed numbers)?

THANKS!

Here is what the serial traffic looks like:
  1. waiting for SD card
  2. [  3813][W][sd_diskio.cpp:174] sdCommand(): no token received
  3. [  3915][W][sd_diskio.cpp:174] sdCommand(): no token received
  4. [  4015][W][sd_diskio.cpp:174] sdCommand(): no token received
  5. [  4114][E][sd_diskio.cpp:199] sdCommand(): Card Failed! cmd: 0x00
  6. [  4114][W][sd_diskio.cpp:516] ff_sd_initialize(): GO_IDLE_STATE failed
  7. [  4115][E][sd_diskio.cpp:802] sdcard_mount(): f_mount failed: (3) The physical drive cannot work
  8. [  4124][W][sd_diskio.cpp:174] sdCommand(): no token received
  9. waiting for SD card
  10.  
  11.  
  12. Found SD Card
  13.  
  14. SD Card Type: SDHC
  15. SD Card Size: 30543MB
  16.  
  17.  
  18. config.ini found.
Here is what my code looks like:
  1. bool CheckForSDCard()
  2. {
  3.   if(!SD.begin(CS_PIN))
  4.   {
  5.     bSDCardPresent = false;
  6.     return 0;
  7.   }
  8.   else
  9.   {
  10.     bSDCardPresent = true;
  11.     return 1;
  12.   }
  13. }
  14.  
  15. void setup()
  16. {
  17.   Serial.begin(115200);
  18.  
  19.   Serial.println("Hello World!");
  20.  
  21.   while(!CheckForSDCard())
  22.   {
  23.     Serial.println("waiting for SD card");
  24.   }
  25.  
  26.   Serial.println("\n\nFound SD Card\n");
  27.  
  28. // ETC, ETC, ETC
  29.  

Who is online

Users browsing this forum: No registered users and 77 guests