AnsweredAssumed Answered

STM32F103+SDIO+FatFS fault issue

Question asked by clisystems on Aug 16, 2016
Latest reply on Aug 16, 2016 by clisystems
I have a project generated by ST32CubeMX that uses the SDIO hardware to talk to SD cards that is generating a hard fault when doing any sort of file access.  I'm not sure exactly what is going on since the project is pretty vanilla, just generated by CubeMX and imported into an eclipse project.  The system uses FreeRTOS with a single task running a basic delay loop routine.

The sequence of events is as follows:
#include "ff.h"
//........In main.c
// All CubeMX init functions called for SDIO, clock, etc


//........Before loop
MX_FATFS_Init();
if(f_mount(&FatFs,"",0)!=FR_OK)
    error=true
    
//........Inside loop
sprintf(fileName,"Test%d.txt",count++);
result=f_open(&log_file, fileName, (FA_WRITE|FA_CREATE_NEW));
if(result==FR_OK)
{
    error=true;
}
f_close(&log_file);
// end

As soon as the f_read() is called a hard fault is triggered.  I've removed the FatFs code from the test and just did SDIO block read functions and I did not get this fault.

Has anyone else run into this situation?  Am I missing an initialization call or parameter for FatFs?

I've uploaded a test Eclipse CDT project that has the error, all code is from STM32CubeMX except for the task functions in main.c

FreeRTOS V8.2.3
FatFs R0.11 (32020)

Thanks

Attachments

Outcomes