Erasing flash block in MKL25Z32VFM4 controller.

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

Erasing flash block in MKL25Z32VFM4 controller.

647 Views
paczkaexpres
Contributor II

Hi,

Recently I am fighting with erasing flash problem. I have got program where I have to save some data in flash memory.

In new chip every block of flash is filled with 0xFF. After my first upload of data, they correctly change the flash memory. But if I would like to save new data (after reprogramming cpu)  in the same place I can't do that.

Do you know how can I erase data (in some blocks) after programming?

Labels (1)
0 Kudos
2 Replies

406 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Mateusz Paczynski:

Any flash memory location that you want to write must be in erased state (0xFF). Also for KL25 you can only write 4-bytes at a time to a longword aligned address in Flash. The minimum erase operation is of 1 flash sector, which in this case is 1 KB and again the sectors are aligned, e.g. the first sector is from address 0x0000_0000 to 0x0000_03FF.

For flash read/write/erase operations you can use the C90TFS driver, available in the same link:

http://cache.freescale.com/files/32bit/software/C90TFS_FLASH_DRIVER.exe

There is an example for KL25 using this driver but it is for CodeWarrior:

EEPROM emulation on KL25 using C90TFS

Instead I recommend you to go with the latest tools. KSDK integrates the same C90TFS driver and there is an example for KL25 in this path once you install it:

C:\Freescale\KSDK_1.2.0\examples\frdmkl25z\demo_apps\flash_demo


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

406 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Mateusz,

Please tell me you use which IDE ? thank !

BR

Alice

0 Kudos