How to suppress sd_diskio message from USB serial output

PeteDD
Posts: 46
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:

Code: Untitled.cpp Select all


waiting for SD card
[ 3813][W][sd_diskio.cpp:174] sdCommand(): no token received
[ 3915][W][sd_diskio.cpp:174] sdCommand(): no token received
[ 4015][W][sd_diskio.cpp:174] sdCommand(): no token received
[ 4114][E][sd_diskio.cpp:199] sdCommand(): Card Failed! cmd: 0x00
[ 4114][W][sd_diskio.cpp:516] ff_sd_initialize(): GO_IDLE_STATE failed
[ 4115][E][sd_diskio.cpp:802] sdcard_mount(): f_mount failed: (3) The physical drive cannot work
[ 4124][W][sd_diskio.cpp:174] sdCommand(): no token received
waiting for SD card


Found SD Card

SD Card Type: SDHC
SD Card Size: 30543MB


config.ini found.
Here is what my code looks like:

Code: Untitled.cpp Select all


bool CheckForSDCard()
{
if(!SD.begin(CS_PIN))
{
bSDCardPresent = false;
return 0;
}
else
{
bSDCardPresent = true;
return 1;
}
}

void setup()
{
Serial.begin(115200);

Serial.println("Hello World!");

while(!CheckForSDCard())
{
Serial.println("waiting for SD card");
}

Serial.println("\n\nFound SD Card\n");

// ETC, ETC, ETC

Who is online

Users browsing this forum: No registered users and 3 guests