cancel
Showing results for 
Search instead for 
Did you mean: 

1-bit SDIO SD Card Interfacing problem in f_open() function for STM32F4 Discovery Board

laxmimerit
Associate II
Posted on July 25, 2016 at 19:21

Hello,

I am using CubeMx to generate 1-bit SDIO SD card code. I have done so much programming using CubeMx and all those codes workfine. But When I generate SD code it is giving error (Hard Fault) at the function f_open(). Here is the code sequence which I used.

res = BSP_SD_Init();
if
(res!=FR_OK)
{
Error_Handler();
} 
res = f_mount(&SDFatFs,
''''
,1);
if
(res!=FR_OK)
{
Error_Handler();
}
res = f_open(&myFile,
''test.txt''
,FA_READ);

it goes into the hard fault at f_open(). Anyone have done SD card with STM32F4?? #stm32f4 #f_open() #sd-card
3 REPLIES 3
Posted on July 25, 2016 at 20:20

Make sure you have an adequate stack allocation.

Have a proper Hard Fault Handler so you can see exactly what it is faulting on. If your understand what is faulting you can focus on how to fix it.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Radosław
Senior
Posted on July 25, 2016 at 22:42

If you use  DMA,  file handlers can be local.... if stack is located in CCRAM

laxmimerit
Associate II
Posted on July 26, 2016 at 09:56

Thanks clive1.