Announcements

Help us improve the Power & Sensing Selection Guide. Share feedback

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
User18435
Level 2
Level 2
Hi all!


I have TFT kit TC297.For the touch controller there is periodic routine and I wanted to call it every 10ms. Thats why I copied simple timer example from aurix and in the timer interrupt I have called my periodic function. Since in this periodic function there is a spi communication (with interrupt as well) the program stucks so can't get data from the spi. I think there is an issue about nested interrupts and priorities. I didn't dig into so much reference manual and wanted to ask. How can I solve my problem? I am using at the moment just one cpu. I want to define a tick timer and run some periodic functions inside of it those might have inerrupt inside also.
0 Likes
4 Replies
MoD
Employee
Employee
10 likes given 50 likes received 500 replies posted
You must enable the interrupts in your periodic routine (they are disable in any interrupt) and make sure that the QSPI interrupts can be handled. For this you must set the priorities of QSPI interrupts to a higher number than your periodic routine or change the priority of your periodic routine to a number lower than the priorities of QSPI. This can be done also during periodic routine by changing the ICR register or better with BISR instruction.
0 Likes
User18435
Level 2
Level 2
MoD wrote:
You must enable the interrupts in your periodic routine (they are disable in any interrupt) and make sure that the QSPI interrupts can be handled. For this you must set the priorities of QSPI interrupts to a higher number than your periodic routine or change the priority of your periodic routine to a number lower than the priorities of QSPI. This can be done also during periodic routine by changing the ICR register or better with BISR instruction.


Thanks a lot MoD. I think I changed priorities but maybe i gave less prirotiy to the timer. Now you mean time should has more priority than spi? So small number for timer?
Am I free to choose priority numbers? Also what is this vectab parameter in the interrupt function?

cheers,
0 Likes
NeMa_4793301
Level 6
Level 6
10 likes received 10 solutions authored 5 solutions authored
A best practice for interrupt functions is to get out as quickly as possible. Instead of doing communication within a 10 ms timer ISR, consider having your ISR set a flag. From your application main loop, check to see if that flag is set, and then call a function that does your SPI communication.

Nested interrupts is tricky business and best avoided if your application is simple.
0 Likes
User18435
Level 2
Level 2
UC_wrangler wrote:
A best practice for interrupt functions is to get out as quickly as possible. Instead of doing communication within a 10 ms timer ISR, consider having your ISR set a flag. From your application main loop, check to see if that flag is set, and then call a function that does your SPI communication.

Nested interrupts is tricky business and best avoided if your application is simple.


Thanks UC_wrangler. Actually this is what I did as work around but it makes my main loop messy and i should check this flags all the time. Since 10ms is long enough and my periodic rotuine is relatively short it is not problem at the moment. I have seen this practice in the tft kit application code.Somebody shouzld deal with nested interrupts. 😄
0 Likes