Waiting for FTFE FSTAT CCIF bit on Kinetis k70

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

Waiting for FTFE FSTAT CCIF bit on Kinetis k70

837 Views
lucaiser
Contributor III

Good morning to everyone.

I have a question about my flash driver for kinetis K70. FSTAT register of FTFE has a Command Complete Interrupt Flag which indicates that a FTFE command or EEPROM file system operation has completed.

In Freescale example driver is used an infinite loop to check when this flag is reset and it's possible to execute a new command.

My question is: do I need to add a counter or a timeout to prevent that my application does not exit from this loop? In this case, do you have any idea of a correct time limit for this timeout check?

Many thanks for now!! Bye!

0 Kudos
4 Replies

589 Views
Paul_Tian
NXP Employee
NXP Employee

Hi, Luca

This is just a sample code not a application code, If code can not run out of this loop, it means flash cannot work well. TImeout function cannot help on this issue.

But stand on a project view, It is need to add such a timeout handling in such a while loop check. At least, it will avoid the whole system dead in this file and other function/module can still work.

Best Regards

Paul

589 Views
lucaiser
Contributor III

Ok, do you have an idea of a correct timeout?

0 Kudos

589 Views
Paul_Tian
NXP Employee
NXP Employee

Hi, Luca

This timeout timing depends on your system design. For example, your LCD will fresh in 200ms, so you should ensure that code must jump out in at least 100ms.

You can define a variable then added in while loop then check if variable value reached. If yes, you can return out of this loop.

Hope my reply can help you.

Best Regards

Paul

589 Views
lucaiser
Contributor III

Hi Paul,

I'm writing a driver for a safety critical railway application so my main loop should be as short as possible. It should be certainly less than 100ms but i need to find required time to complete a flash command so I can check it and stop my application in case of timeout event.

Do you know maximum execution time for a flash command on K70?

May thanks, best regards.

0 Kudos