AnsweredAssumed Answered

Hard fault when erasing internal flash memory

Question asked by yash.bhatt1@einfochips.com on Jun 17, 2020
Latest reply on Jun 20, 2020 by yash.bhatt1@einfochips.com

Hi,

 

We are using FRDMK64F and are trying to erase 4096 bytes of internal flash memory from address 0xFD000.

We are facing hard fault when executing the code 

"callFtfxRunCommand((FTFx_REG8_ACCESS_TYPE)(&FTFx->FSTAT));"

inside the "ftfx_command_sequence" function.

 

The fault shown on debug is "BFARVALID" i.e bus fault Address Register Vaild flag and "PRECISERR" Precise data bus error.

 

The weird thing is that we are able to erase this same sector from other part of code (handling different functionality).

 

We have tried disabling cache as suggested in forums but could not resolve the issue.

To disable the cache we did:

FMC->PFB0CR &= 0xFFFFFFE0;
FMC->PFB1CR &= 0xFFFFFFE0;

 

It might be useful to know that we are using a bootloader and the application starts from address 0x28000.

 

Any help will be appreciated.

Outcomes