cancel
Showing results for 
Search instead for 
Did you mean: 

Possible shortcoming in HAL SD library

MClar.3
Associate II

Been trying to get an test application working on a STM32F469NIH Discovery board.

Should be fairly simple - Write a file to the SD Card, with FatFS, the read back:

Try as I might, I couldn't get things working.

After a bit of debugging, I think the issue lies with the DMA callback functions. I'm using FW_F4 V1.27.1, on CubeIDE, and it seems that the supplied SD_DMATransmitCplt() function isn't quite complete, when compared to the SD_DMAReceiveCplt() function.

There seems to be a couple of things missing - Firstly the call to the callback function - This is a must for the SD interface, because there's a queue that is waited on. Without the callback function being called, nothing is ever put on the queue, so a timeout error is received.

The other important bit seems to be the line of code that unlocks the HAL. A sensible thing to do, as we've just finished transferring data. Again, without it, some other bits of code later on fail as the HAL is still locked.

So I copied the code from the RX complete, and that seems to make things work - See attached text file

The question is, am I on the right track here? I'd like to help improve things, but at the same time, I don't want to fix things worse. A proper fix is better than a band-aid.

1 REPLY 1
I.KHACHINE
ST Employee

Hello MClar,
I'm analyzing the issue that you mentioned.
Could you pls give me the DMA configuration that you are using the both cases Transmit and Receive?
Best regards,
Ismail