2020-01-16 02:08 PM
Hi,
I am trying to use the STM32F405 microcontroller to log data into an SD card using STM32CubeIDE. Specifically, this MCU from adafruit: https://www.adafruit.com/product/4382?gclid=EAIaIQobChMI3qONnpCJ5wIVD_DACh2XCQY7EAAYASAAEgL4QvD_BwE
I found a few resources online and integrated that into the my source code, which can be found in "main.zip". My SDIO and FATFS configurations are shown in the attached figures. I did not change anything under 'Set Defines'.
Regardless of whether I have an SD card in the MCU or not, the results are the same: the program doesn't go beyond the line of code that calls "f_mkfs". I would appreciate it if someone could help me troubleshoot this.
Thanks.
2020-01-16 02:31 PM
Formatted cards should not need MKFS, one should avoid using it at all until DISKIO layer read function is fully tested/validated.
Unfortunately I lack the will to trawl through broken code, especially from Cube.
2020-01-17 09:08 AM
Hi clive1,
Thank you for your answer!
I removed "f_mkfs" and my program gets stuck in the next line of code, which is 'f_open'. It fails to open/create a file.
Also, what did you mean by "until DISKIO layer read function is fully tested/validated"? How can I test/validate that function?
Thanks.
2020-01-18 02:02 AM
you are missing sd card initializartion and configuring of bus width functin missing in you project
and according to @Community member , you do not need to use f_mkfs
2020-01-20 08:15 AM
Hi Dbgarasiya,
I thought the IDE already initialized the module after configuring it using the GUI in Device Configuration Tool. It even created a function call: 'MX_SDIO_SD_Init'.
Do you think maybe the module wasn't initialized properly? If so, what are the right function calls I should be using?
Thanks.
2020-01-20 08:00 PM
BSP_SD_Init()
2020-01-20 08:01 PM
bsp_driver_sd.c in this file
2020-01-21 10:10 AM
Hi Dbgarasiya,
I added that, but I am still getting the same result. Am I missing something else?
Thanks.
2020-01-21 08:05 PM
you have not enable DMA, for rx and tx also
then try
2020-01-22 09:41 AM
Hi Dbgarasiya,
Looks like I can only choose to either use SDIO or SDIO RX & TX but not all three of them, otherwise I get an error say "No available DMA requests for this peripheral".
Was DMA required? I enabled both variations i.e. only SDIO and then only SDIO RX & TX, nothing worked. Let me know if I'm doing something wrong.
Thanks.