Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 6 months ago.
Delaying interrupt handling during lengthy SPI read from flash
Hi everyone,
I am using an external SPI flash chip for logging purposes. Occasionally it needs to run queries on this log and this will cause lengthy SPI flash read to last from a few seconds to minutes. To ensure responsiveness to other events, I would pause this SPI flash read every 10 ms to check if an interrupt has occurred.
My question is if I do this
Loop_until_end_of_query { 1) _disable_irq() 2) do 10 ms of SPI flash read 3) _enable_irq() }
Would an interrupt that happened during the 10ms, where the interrupt is disabled, be serviced immediately after _enable_irfq() call?
Thank you in advanced to taking time to reply.
Gary Cho
1 Answer
5 years, 6 months ago.
Hello Gary,
I think those interrupts will never be serviced. So rather than disabling interrupts I would suggest to perform the queries in another thread (running in parallel with the data aquisition thread). In that case scheduling will be done automatically by mbed-os. Moreover, in that thread you can use an event queue to carry out the queries so interrupts will always have higher priority.