Help Read Flash K64

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

Help Read Flash K64

Jump to solution
822 Views
danilolima
Contributor II

Hi.
I am wondering a way to read a part of flash memory on K64.
I have already tried using FLASH_ReadOnce and FLASH_ReadResource, but to no avail.
All help is welcome, thank you.

Labels (1)
1 Solution
637 Views
mjbcswitzerland
Specialist V

Hi

Try

unsigned char buffer[16];

(const void *)flash_add = 0x4000;

memcpy(buffer, flash_add, 16);

// Now we have the 16 bytes form flash address 0x4000 in buffer

Or generally
unsigned char flash_data = *(unsigned char *)0x4000;
To read any byte from flash.

Only the program once area requires special operation to read. The rest is simply memory-mapped.

Regards

Mark

View solution in original post

0 Kudos
4 Replies
638 Views
mjbcswitzerland
Specialist V

Hi

Try

unsigned char buffer[16];

(const void *)flash_add = 0x4000;

memcpy(buffer, flash_add, 16);

// Now we have the 16 bytes form flash address 0x4000 in buffer

Or generally
unsigned char flash_data = *(unsigned char *)0x4000;
To read any byte from flash.

Only the program once area requires special operation to read. The rest is simply memory-mapped.

Regards

Mark

0 Kudos
637 Views
danilolima
Contributor II
Now I need to delete, write and read a memory location. Can you help me?
0 Kudos
637 Views
mjbcswitzerland
Specialist V

Hi

Erasing and writing requires Flash routines.
See http://www.utasker.com/kinetis/FRDM-K64F.html (with command line interface capabilty to read/write/erase internal Flash) and simulation.
Code available at http://www.utasker.com/kinetis.html
Including various file and parameter system that can operate in internal flash or external SPI flash.
Operation and low level interface described in http://www.utasker.com/docs/uTasker/uTaskerFileSystem_3.PDF

Regards

Mark

0 Kudos
637 Views
danilolima
Contributor II

Hi Mark I am very grateful for your help, thank you!

0 Kudos