cancel
Showing results for 
Search instead for 
Did you mean: 

Disk error in USB MSC mode: SD card not recognizing (due to battery failure)

martinj3456
Associate III
Posted on April 13, 2017 at 19:34

Hi,

In a custom L1 board, I have microSD card configured with FATFS SDIO. At the power-on-reset, FATFS is initialized by

memset(&fs32, 0, sizeof(FATFS));  

res = f_mount(0, &fs32);

memset(&fil, 0, sizeof(FIL));

16KB Sensor Buffer is filling with sensor data (sampling rate 10ms). A file is left open at the beginning of loop (f_open), FATFS write occurs in every 15sec and syncing files (f_sync) in every 30min. Upon connecting USB cable, Sensor write stops, close file (f_close) and USB MSC initiates. It worked for a week. The custom board didnot have any battery protection(circuit or code). Probably for low battery (or any software issue), USB MSC is not recognizing microSD card anymore. In a test board, it happened and was solved by removing and reinserting SD card. My current board is sealed and only USB DFU mode is available for firmware upload. Can unmount/formatting card using FATFS commands solve this issue? I'm using FATFS R0.09.

                0690X00000603l9QAA.jpg

I request your kind suggestion to solve this issue.

1 REPLY 1
Posted on April 13, 2017 at 19:52

Does Windows complain it is not formatted? Can you FORMAT or CHKDSK from Windows?

You could try to use whatever FatFs provides to reformat. You could make your own code to initialize the SD Card with a partition table and FAT partition.

You should probably start by doing a FSCK or CHKDSK type analysis of why/how the card is hosed up first.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..