2021-06-25 08:57 AM
Hey guys.
Im using stm32f103rct6 and sdio for sd card.
My problem is that when using fatfs functions i get different errors that are random. For example once it gives me disk error but the next time it gives me disk not ready in a same operation.
How can i see if its hardware error or software?
Are SDIO pins high frequency and need high frequency specifications? Someone told me you should not have vias on sdio connections.
2021-06-25 09:01 AM
Here is the schematic.
2021-06-25 09:02 AM
2021-06-25 09:33 AM
The 1K pulls look a tad aggressive, 33K or 47K would be more appropriate.
I'd be surprised if you're clocking the interface above 24 MHz, but no configuration is mentioned.
For short traces, I'd probably back-off the slew-rate (SPEEDR, not 100 MHz edges), the use of 27R or 33R series resistors can help stop ringing.
You'd ideally want all the traces of a relatively uniform length and similar trace/via profiles end to end, you want to avoid skewing on the data pins, clock
Failure tends to cascade, if you break the interface/protocol subsequent commands will continue to fail.
You should instrument DISKIO to see what sequences/error occur, FATFS sometimes doesn't propagate errors efficiently, and users often ignore error returns.
Perhaps use a logic analyzer if you suspect the hardware, have the DISKIO instrumentation trigger the LA when it detects failure.
2021-06-25 12:15 PM
I changed the resistors to 40.2k that i had but still i get errors and files are not created.
The clk pin signal is attached.
Mount_SD("/"); gives disk not ready and sometimes disk error.
Format_SD(); gives disk error.
Create_File("FILE1.TXT"); gives disk error.
Create_File("FILE2.TXT"); gives disk error.
Unmount_SD("/"); gives ok.
2021-06-25 12:47 PM
Whaere can i find diskio for f103 hal?
2021-06-25 01:05 PM
I just get fr_invalid_drive from this function.
fresult = f_mount(&fs,0,0);
2021-06-25 03:29 PM
I wonder why your CLK signal is a sine wave. Usually logic signals are square waves.