AnsweredAssumed Answered

K82 : erase and write internal flash memory and FreeRTOS

Question asked by Eugene Hiihtaja on Oct 4, 2018
Latest reply on Oct 16, 2018 by Eugene Hiihtaja

Hello !

 

I can successfully run pflash SDK example on FRDM K82 board. After that I adopt this test for FreeRTOS environment

and it is also possible to pass erase/write/verify loop if all interrupts disabled.

E,g.

 

asm volatile ("cpsid f");
result = FLASH_Erase(&s_flashDriver, destAdrss, pflashSectorSize, kFTFx_ApiEraseKey);
asm volatile ("cpsie f");

 

asm volatile ("cpsid f");
result = FLASH_Program(&s_flashDriver, i, (uint8_t *) s_buffer, sizeof(s_buffer));

asm volatile ("cpsie f");

 

I have used last 4KB sector in flash memory.

 

But if I enable MPU this technique dosn't help and it cause BusFault if erase operation initiated

Even Task running in privileged mode and whole flash area set as rwx in MPU table.

But I think rwx is no need becouse flash memory accessed via controller peripheral registers.

 

I no need to run any special code in RAM, timing can wait.

 

But how to disable everything what is need when one sector of flash memory need to be erased ?

 

I have few different interrupts and FreeRTOS is MPU enabled.

 

Regards,

Eugene

Outcomes