Erasing serial flash - LPC54S018

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Erasing serial flash - LPC54S018

跳至解决方案
933 次查看
mh_n
Contributor III

Hello,

I am trying to write a code to test the serial flash on LPC54s018-EVK. I need to first confirm that erasing the flash sector by sector is possible and functional, then proceed with other phases of my test. (I do not want to erase the entire chip at once since our main software will need to erase a selective set of sectors from flash). To do this, I started looking at the software examples from the SDK version 2.12.0. Specifically, the example called "spifi_dma_transfer". I realized that the example erases a sector and then proceeds to writing into it page by page. So, I modified that example code and added a loop around the erasing part to erase all sectors one after another and commented out the part where it writes into flash. The results were that the first time I am trying to erase flash, it succeeds and I can see that all of the data in flash is set to 1s; However, If I try erasing the flash while it is already erased, after erasing about 500 to 700 sectors, a signal handler is called and the CPU will start hanging in a function called "IntDefaultHandler(void)" in the startup_lpc54s018.c. using the debugger's stack trace, I can see the signal Handler being called is CTIMER0_IRQHandler(). 

After realizing this, I tried defining that handler as an empty function as well; However, it constantly keeps getting called.

I was wondering if you can let me know why I am seeing this behavior and how I would be able to fix this.

(I have also tried in this state of the flash being erased to write into it page by page using the example code, but that also does not work due to the same handler being called)

Below is the example code (The portion deleting a sector)

mh_n_2-1668619646958.png

 

And this is my modified version (Trying to delete sector by sector, all of the flash)

mh_n_0-1668619586793.png

 

Thank you in advance,

Regards,

Mohammad

 

0 项奖励
回复
1 解答
919 次查看
mh_n
Contributor III

I was able to solve this issue with defining the CTIMER0_IRQHandler in my code and acknowledging the interrupt inside it by setting the first bit of the interrupt register for CTIMER0 to a 1 (Screenshot below)

mh_n_0-1668698859583.png

Note: used tables 348 and 349 from UM11060 document in solving this issue

 

Regards,

Mohammad

在原帖中查看解决方案

0 项奖励
回复
1 回复
920 次查看
mh_n
Contributor III

I was able to solve this issue with defining the CTIMER0_IRQHandler in my code and acknowledging the interrupt inside it by setting the first bit of the interrupt register for CTIMER0 to a 1 (Screenshot below)

mh_n_0-1668698859583.png

Note: used tables 348 and 349 from UM11060 document in solving this issue

 

Regards,

Mohammad

0 项奖励
回复