Part Number:TMS570LC4357
TI工程师,你好,我有问题需要咨询
背景:当前代码运行在Bank 0上,同时因为自身业务需要,我需要对Bank 0的Sector进行擦写
根据F021 Flash API Reference Guide Version 2.01.01里的提示:
(1) Reading a Flash memory location from the bank that an erase command (sector or bank) is currently being performed will stall the CPU until the erase command finishes and the FMSTAT register indicates the FSM is not busy.
(2) Reading a Flash memory location from the bank that an program command is currently being performed will stall the CPU until the program command finishes and the FMSTAT register indicates the FSM is not busy
(1) Reading a Flash memory location from the bank that an erase command (sector or bank) is currently being performed will stall the CPU until the erase command finishes and the FMSTAT register indicates the FSM is not busy.
(2) Reading a Flash memory location from the bank that an program command is currently being performed will stall the CPU until the program command finishes and the FMSTAT register indicates the FSM is not busy
这两句话中有提到,读取时若当前Bank正在擦写,CPU会Stall,直到擦写完成,FMSTAT的BUSY位为0,才会继续。
这里的继续是如何实现的? 是当前的机制会自己让CPU继续,还是通过什么方法通知CPU,让CPU继续进行读取
我需要在同一个Bank上执行并擦写,是否有什么解决方案
谢谢
Ben Qin:
你好,为了更好的解决您的问题,我将咨询相关资深工程师,一旦得到回复会立即回复您。
,
Ben Qin:
你好,参考下工程师的回复:
You are not supposed to do executing and erasing on the same bank.
"The F021 Flash API library cannot be executed from the same bank as the active bank selected for the API commands to operate on".
Jialiang Ou 说:我需要在同一个Bank上执行并擦写,是否有什么解决方案
If you really want to do this operation, then you should copy the all the Flash APIs from flash bank-0 to the RAM. Once you copy the Flash APIs to the RAM then you can erase and write to the sectors in Flash Bank-0.
Please refer below thread for more details:
(+) TMS570LS3137: TMS570LS3137: Writing Flash During Runtime – Arm-based microcontrollers forum – Arm-based microcontrollers – TI E2E support forums
,
Jialiang Ou:
明白, 现在我们将调用Fapi_issueAsyncCommandWithAddress和Fapi_issueProgrammingCommand这两个FAPI开始到FSM Ready这个过程的代码都移至SRAM中解决了这个问题,但是在关中断的条件下。
经过对手册其其他TI论坛里的问题的阅览,我测试使用宏FAPI_SUSPEND_FSM将正在进行的擦除或写入挂起后,可以继续执行擦除或写入所在bank的代码
现在是希望在中断处理的开始使用这个宏挂起Flash的擦除/写入操作,将中断执行完毕后在再回来继续Flash的擦写,但是当前中断向量表等中断相关的代码内容都在0x0开始的地址中,有什么办法可以让我在对bank 0的sector进行擦写时,依然可以正常的执行中断或任务调度吗
,
Ben Qin:
已向相关工程师跟进
,
Ben Qin:
Jialiang Ou 说:有什么办法可以让我在对bank 0的sector进行擦写时,依然可以正常的执行中断或任务调度吗
如果您尝试擦除 Bank 0,则不会执行同一 Bank 0 中的代码。