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.
6 years, 7 months ago.
Is there a way to turn off the scheduler ticker?
I am trying to demonstrate (to my students) how an ISR can wake up the MCU from sleep()
In mbed 2, this was relatively easy to do: Call sleep() from main and use a Ticker or InterruptIn to wake it, run the ISR, and return back to the sleep state.
For example:
int main() {
set up Ticker and attach to a function... etc.... code not shown
while (1) { sleep(); printf("ISR Completed\n\r"); }
}
In mbed-os 5.x, this rapidly prints "ISR Completed" presumably because the scheduler timer is waking the CPU from sleep? This is despite me only using the main thread.
Assuming my assumption is correct, is there a way in mbed-os 5 to turn off the scheduler / associated timer?
Which target is this? Does it help if you call
posted by Jan Jongboom 06 Oct 2017core_util_critical_section_enter();
before sleeping? If that helps then it's a bug in the HAL for the board that you're using.I’ll try that. It’s a Nucleo F429ZI
posted by Nicholas Outram 06 Oct 2017I tried what you suggested and it made no difference.
posted by Nicholas Outram 11 Oct 2017Ok - I've resolved it (my bad) - when I created a project from a template, I assumed it was using the latest library version. I manually updated it, and it now works.
posted by Nicholas Outram 11 Oct 2017