there are two problems that confused me:
1. i have to write some global uint32_t variates into flash, these variates need to be updata according to the routine demands.How to write variates into fixed address of flash respectively, and how to read the content of these fixed address respectively.
2. i use the last few sectors to storage golbal variates which need to be updata, one sector has 512 byte. when i update one of the bytes, the others stay the same, but before i write the flash ,i have to erase the sector. what my operation is correct? how i do to write the flash?
Hi Hu,
1. Flash operate functions are in flash.c. If you need some demo to guide you to fast access, you can download ke_drv_lib_2.0 from NXP website. This library is for MKE series, but also fit for KEA MCU. Read flash is just like read a ram. you can do it like this way: data=(*(unsigned char*)address);
2. Yes, flash can be written in byte, but can only be changed after sector erase. this is the most special feature of NOR flash, different with EEPROM. And flash can not be write-erase for ever. NXP guarantee 100k write-erase cycle for its product. You must use software to smooth your operation.
Regards,
Jing
Hi,
1. data = (*(unsigned char*)0xf801) : Yes, it's ok. But take care, something like (*(unsigned int*)0xf801) will cause hardfault. It's not an alignment reading.
2. You can download it at https://www.nxp.com/webapp/sps/download/preDownload.jsp.
3. Of course you must modified flash.ld.
Regards,
Jing