Using flash on MK10DX64VLH5

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using flash on MK10DX64VLH5

542 Views
Mind
Contributor I

Hi!

I am using Codewarrior 11.1 and Processor Expert 10.6.3.RT6_b1446-0504

I am almost done with a project, I just need to save 4 bytes of calibration data and load them at boot.

I have been trying to get this working using FLASH_LDD but to no avail. I have tried more solutions from these forums and examples from around the web that I can count. I get as far as managing to write the values ONCE and can read them back. But I cannot erase them. Either I get a ERR_PARAM_ADDRESS, or ERR_OK but nothing happens or just a MCU reset. I have tried various settings for sizes and addresses, nothing seems to work. Been digging in the flash functions to figure out exactly what goes wrong but I can't find it.

 

I'm open to any suggestion or simple example that can Write 4 bytes to flash, read them back, erase them, write them again and read them back. I thought about trying to use the EEPROM emulation instead (FlexNVM EEPROM).

 

Best regards!

/Mind

 

[Edit:]

The flash memory is specced as:

DFlash

Address  0x10000000

Size 32768

Write unit size 4

Erase unit size 1048

Protection unit size 4096

 

I have tried interrupts on and off, doing polling, Using User memory areas, Protecting, unprotecting, different sizes of erasing, various different addresses withing the range, a ton of different ways to set up the routines, and a myriad off other different things. It has been two weeks and I can only conclude that it is impossible to erase this memory from code on this processor. If you disagree for the love of god prove me wrong. But as it stands, I'm out of time. I will have to erase the flash using external tools every time I need to update the calibration value.

0 Kudos
Reply
0 Replies