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.

Fapi_initializeFlashBanks - nondeterministic behaviour

Other Parts Discussed in Thread: TMS570LC4357

Hello,

I am using Fapi for programming/reading/erasing Flash Banks 1 and 7 in TMS570 MCU and I observed that Fapi function: Fapi_initializeFlashBanks sometimes returns error. It seems that return value of the function depends not only on the input parameters.

I always call the function this way (for both Flash Bank 1 and Bank 7):

Fapi_initializeFlashBanks((uint32_t)150U);

It fails sometimes (with probability ~1%), usually when called for the first time after MCU startup.

Could someone point out what can be the reason of this behaviour?

Thank you.

  • Hello Piotr,

    Can you let us know which specific TMS570 device you are using. There are different versions of of flash banks used for Bank7 for different part numbers so this information would need to be know before providing an answer. In the mean time, I have forwarded your post to our Flash API expert so that they may more adequately answer your question or help reach a resolution to your problem.
  • I am using TMS570LC4357.
    Thank you.
  • Hello Piotr,

    What is the function return value you are observing when it fails?
  • I could not reproduce it now. Once I will find out exact return value, I will let you know.

    But there are only 2 possible error codes, and both seem to depend only on function argument (which in my case is constant) and on MCU read-only memory or memory that is written during startup:

    Fapi_Error_InvalidHclkValue
    Fapi_Error_OtpChecksumMismatch

    Do you agree if reasoning above is correct?

    Some things that come to my mind:
    - EWAIT and RWAIT values that are written during startup may be cached. I have checked and all flash banks are enabled, and correct wait states assigned (=3 for Banks 0 and 1, =9 for Bank 7).
    - is there any caveat of using both Bank 1 and Bank 7 with the Flash API?
    Currently all the calls to Fapi functions in my system are in critical section (including read, write, erase operations).

    So the question is: can there be any other reasons besides Flash registers and OTP memory that can make Fapi_initializeFlashBanks fail?

    Thanks,
    Piotr