Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE
Hi,
I'm currently working on my first C2000 application. Toolchain is up and running, eval board is blinking and is sending CAN bus messages periodically. So far so good. Now I have to think about how to structure the whole application (firmware). All examples I've seen so far, where busy polling / looping in the main loop and thus (probably) consuming much more energy than necessary. I came across the IDLE() CPU instruction, which places the CPU into a power saving mode.
Now I wonder, how I could utilize this CPU instruction (IDLE) to place the CPU to sleep until some external event (aka Interrupt) happened to then look for the event source and to handle that. Unless I've missed something (and I hope that this is the case), I can't find a way to setup some interrupt source and place the CPU to idle without a race condition.
If I would for example setup a timer to timeout in X. The timer would be configured to cause an interrupt and thus to get the CPU out of idle mode:
setup_timer(X);
IDLE();
But what happens if the interrupt handler (serving the timeout set by setup_timer()) is served before IDLE() is called? Is it possible to structure this race free? I thought of disabling all interrupts, then calling IDLE(), but of cause this would then block for ever...
Any readings / recommendations / coments regarding general application structures using C2000?
best regards,
Torsten