AnsweredAssumed Answered

FatFS with Cube HAL address problem

Question asked by nunes.ricardo on Jun 27, 2016
Latest reply on Jun 28, 2016 by nunes.ricardo
I'm using STM32F446RE to implement FatFS with Cube, using eval_sd.h file from F446RE_EVAL. I'm performing periodically writes in files and sometimes the code works, other it gives me a Hard fault at ff.c: validate, when accessing fil->fs:

static
FRESULT validate (     /* FR_OK(0): The object is valid, !=0: Invalid */
     void* obj          /* Pointer to the object FIL/DIR to check validity */
)
{
     FIL *fil = (FIL*)obj;     /* Assuming offset of .fs and .id in the FIL/DIR structure is identical */

     if (!fil ||
          !fil->fs ||
          !fil->fs->fs_type ||
          fil->fs->id != fil->id ||
          (disk_status(fil->fs->drv) & STA_NOINIT))
          return FR_INVALID_OBJECT;


     ENTER_FF(fil->fs);          /* Lock file system */
     return FR_OK;
}

The problem is fil->is have address 0x9313330, so it seems that it was never addressed. Anyone having this problem? 

My custom HardFault Handler prints:

In Hard Fault Handler
SCB->HFSR = 0x40000000
Forced Hard Fault
SCB->CFSR = 0x00008200
PRECISERR at 0x9313530




Outcomes