cancel
Showing results for 
Search instead for 
Did you mean: 

L433 SDMMC FIFO doesn't get emptied

JSwildens
Associate

I'm currently working on a project using the STM32L433 MCU with the SD peripheral. While trying to use the HAL driver with read and write operations the functions return an timeout. While tracing the command and data lines the command is sent but the FIFO is not emptied this leads to the timeout as the SD card isn't done writing. Also while only reading the data only the command is sent and no data is exchanged.

In the initialization of the SD card data is exchanged so the functionality of the SD card is working. Also multiple cards are used to test and all have the same response as it doesn't send the data. In the screenshot is CMD24 sent and a response from the card with the status in transfer state and ready for data flag is 1. Card data as the CID and CSD are received properly.

JSwildens_0-1704660275058.png

While using the debugger the SDMMC1.FIFO is written to and the address and offset correspond to the reference manual register address of the FIFO so writing to that address should write to the FIFO. Also in the reference manual RM0394 in figure 464 fine print it writes that if D0 is low no data is put on the bus. But in the diagram this is high, this is verified with a oscilloscope.

If more information is required please let me know.

1 ACCEPTED SOLUTION

Accepted Solutions
JSwildens
Associate

After some debugging the problem was that the sd card was a microSD card and those required different pullups on the data line than eMMC for which this board was originally designed for. After changing all the pullups on the data lines to the same 10K Ohm as the CMD line it worked fine.

 

There was another bug that if it was configured with 4 bits wide bus at the start it would also initialize the hardware with 4 bits. After changing this to 1 bit and manually calling HAL_ConfigWideBusOperation() after the HAL_SD_Init() in the MX_SD_Init() function it did work in 4 bit wide mode.

View solution in original post

1 REPLY 1
JSwildens
Associate

After some debugging the problem was that the sd card was a microSD card and those required different pullups on the data line than eMMC for which this board was originally designed for. After changing all the pullups on the data lines to the same 10K Ohm as the CMD line it worked fine.

 

There was another bug that if it was configured with 4 bits wide bus at the start it would also initialize the hardware with 4 bits. After changing this to 1 bit and manually calling HAL_ConfigWideBusOperation() after the HAL_SD_Init() in the MX_SD_Init() function it did work in 4 bit wide mode.