Problem in Flash Sector Erase

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

Problem in Flash Sector Erase

Jump to solution
1,814 Views
arnoldbischof
Contributor III

Hello

I am implementing a Firmware downloader on a custom MK10 board. I need Flash_EraseSector() and Flash_SetLongFlash() for this functionality.

The command EraseSector does not work as expected.

When I step with the debugger through the code the Flash_EraseSector() function normally works but sometimes I get a RDCOLERR in the FTFL_STAT Register. (I erase only sectors that are not used by the actual running program).

If I do not step and let the Program run at normal speed, it restarts and shows the LOCKUP bit in the SRS1 of the RCM. (The interrupts are disabled during the erase call)

Does anybody have a good advise for this Problem?  

Tags (3)
0 Kudos
1 Solution
863 Views
perlam_i_au
Senior Contributor I

Well I have been doing some research and I have some questions, I would like to have more information:

  • Are you debuging your Flash_EraseSector() function with "step into"?? I ask this because some functions of PEx components require to work with specific time frames, if you modify or delay this time frames your application probably crash, if this is your case I suggest you to use the debug option "step over".
  • Also I would like to know your specific part number, this because some of the K10 devices has two memory blocks others just have one; if you want to use the Flash_EraseSector() funcion on a divice with two blocks, you need to execute this function from a block which does not content the memory sector you want to erase; in the other hand, if your device only have one memory block you will need to execute Flash_EraseSector() from RAM.
  • Regard restart issue this not necessary could be caused by the flash erase action, I suggest you to review the ARM Cortex M4 Processor Technical Reference Manual or also RMv7-M Architecture Reference Manual for more information regard unrecoverable exceptions.

I hope you find this information useful


Have a nice day,
Perla Moncada

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

View solution in original post

0 Kudos
2 Replies
864 Views
perlam_i_au
Senior Contributor I

Well I have been doing some research and I have some questions, I would like to have more information:

  • Are you debuging your Flash_EraseSector() function with "step into"?? I ask this because some functions of PEx components require to work with specific time frames, if you modify or delay this time frames your application probably crash, if this is your case I suggest you to use the debug option "step over".
  • Also I would like to know your specific part number, this because some of the K10 devices has two memory blocks others just have one; if you want to use the Flash_EraseSector() funcion on a divice with two blocks, you need to execute this function from a block which does not content the memory sector you want to erase; in the other hand, if your device only have one memory block you will need to execute Flash_EraseSector() from RAM.
  • Regard restart issue this not necessary could be caused by the flash erase action, I suggest you to review the ARM Cortex M4 Processor Technical Reference Manual or also RMv7-M Architecture Reference Manual for more information regard unrecoverable exceptions.

I hope you find this information useful


Have a nice day,
Perla Moncada

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

0 Kudos
863 Views
arnoldbischof
Contributor III

Hello Perla

Thank you for the information. I solved the problem this morning. We use the MK10DN32 in our project. This device has one memory block only and the problem was a RWW issue as you described in the second point. I had to do two things to solve the problem. 1st put the start and wait for done routine into a RAM function and 2nd disable interrupts during call of this RAM function. The Firmware downloader works fine now.

Thank you very match for your support.     

0 Kudos