This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Suspending F021 Flash API operations

Expert 1226 points


We're using the F021 Flash API on the Hercules TMS570LS0432 and TMS570LS1224 microcontrollers.

We're primarily using SPNU501H.pdf "F021 Flash API Version 2.01.01 Reference Guide", revised April 2015, as, well, our reference and guide for our development.

We're looking into using the FAPI_SUSPEND_FSM macro of the F021 API in order to limit the amount of time our system will be unresponsive while we are doing program and erase sector operations on BANK0.

After we've used FAPI_SUSPEND_FSM I assume we use FAPI_CHECK_FSM_READY_BUSY, and once it returns Fapi_Status_FsmReady then we are good to execute flash from code again.  Once we're ready to pause the rest of our system again for a bit we would then call Fapi_issueAsyncCommand() with either Fapi_ProgramResume or Fapi_EraseResume, until our next FAPI_SUSPEND_FSM call.

Is this correct?

How quickly will the FSM suspend?

Thank you!

  • You are correct in how to use the suspend macros. The suspend operation immediately stops the program or erase pulse, but then allows the flash voltages to settle before the busy bit clears, roughly about 20uS. It is possible to suspend a program or erase operation but the operation completes before the suspend can happen. In this case the busy bit is cleared but the PSUSP or ESUSP bits are not set. It is not necessary to check this because in this case the Fapi_xxxResume command will be ignored and the subsequent read of FAPI_CHECK_FSM_READY_BUSY will show not busy. It is also important not to suspend an erase operation too often. If you never allow the erase operation to execute for 2.5mS before suspending, the erase state-machine will not progress, and the erase will not complete.
  • Excellent, good to know, thanks!

    Is there any way to tell programmatically that the state-machine is advancing rather than using a time-based check?

    Is the 2.5 millisecond requirement precise or approximate? If I just rely on a time check then I'll likely put some margin of additional delay on top of the minimum 2.5 milliseconds to ensure reliable operation. I can't afford to put an excessive amount of margin, however; pausing our system for 2.5 milliseconds is already an uncomfortable fit for our system.
  • The 2.5 mS requirement comes from a state-machine, so is predictable. It is OK if occasionally the suspends happen less than 2.5 mS apart, but there has to be some uninterrupted time for the erase to progress. Send me a private message if you need more details.