Cannot erase or write internal flash memory.

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

Cannot erase or write internal flash memory.

943 Views
vinayakwadkar
Contributor I

Hi,

 

As attachment can not be done in reply, I have opened this new thread in continuation to earlier thread - "Problem with KL17 flash erase an writing".

 

I have attached demo code - "flash_erase_write_code", please find the attachment.

 

As I said in earlier question's comment, flash erase and write routines return "RESULT_OK" means FTFA_FCCOB commands are getting sent successfully, but expected data is not being written on flash addresses staring from 0x2000.

I have tested the demo code on FRDM-KL43Z” board.

 

Do I need to do any configuration or initialization related flash in addition with flash routines?

 

Please review the demo code and let us know if we are missing anything.

 

Thanks,

Vinayak Wadkar

 

Original Attachment has been moved to: flash_erase_write_code.txt.zip

0 Kudos
1 Reply

353 Views
mjbcswitzerland
Specialist V

Hi Vinayak

You need to execute the CommandLaunch() routine from SRAM and not from Flash. Generally you also need to ensure that interrupts are disabled when it is executing.

Beware that

status = FlashErase(flash_addr_ptr,sizeof(myData));

doesn't match your prototype

U32 FlashErase(U32 block_start);

so your compiler should be giving your warnings or errors.

I have attached the Flash driver from the uTasker project which supports all KE,KV,KW,KL,K parts flash and includes program-once, flash swap, parameter storage, as well as KE EEPROM as reference of how to do it generically without needing drivers for each type.

If used within the uTasker project with Kinetis simulator it will also accurately emulate Flash operation and inform of any incorrect usage or other violations.

As comparison, you can also load the following image to your board and experiment with flash writing, sector erasure etc.

http://www.utasker.com/kinetis/FRDM-KL43Z.html

Commands (on the OpenSDA UART at 115k) are explained in http://www.utasker.com/kinetis/KE_EEPROM.html whereby the same interface can be used for EEPROM or Flash.

Regards

Mark

0 Kudos