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
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.