How long to linger in Timeout callback

21 Apr 2012

The normal rule for an interrupt is to get in and out ASP, but that is normally because they relate to an external source. With the Timeout interrupt does it lock other interrupts and so require the code to do as little as possible? Just that sometimes the code to semaphore and store values in an interrupt so that a 'service' routine can work on it is more than the task at hand.

21 Apr 2012

By default all ISRs will run at the highest priority (level 0) on the mbed. When you are running code in a timeout interrupt at this high priority, it will mask off and disallow all other interrupts.

You can use the NVIC_SetPriority() to lower the priority of an interrupt such as those you are using for your Timeout.

For example the following code snippet will lower the Timer3 interrupt (used by Timeout and the other time related interrupt handlers on the mbed) to be one level lower than the default level:

    NVIC_SetPriority(TIMER3_IRQn, 1);

Please note that since other time related objects in the mbed SDK, such as Ticker, share the same TIMER3, they will still be blocked while the Timeout ISR is running.

21 Apr 2012

Thanks for the info, I guess I'll carry on with processing the data from an interrupt on the main thread.