Other Parts Discussed in Thread: HALCOGEN
I'm trying to create a simple configurable *blocking* delay timer. I already have rtiNotification() handlers working for a couple of periodic timers, but of course they are not blocking. I have tried variations on:
void setDelayTimer(uint32_t milliseconds) { gTimerExpired = 0; // Gets set to 1 in RTI ISR for COMPARE2 rtiSetPeriod(rtiCOMPARE2, milliseconds * 10000); rtiEnableNotification(rtiNOTIFICATION_COMPARE2); rtiStartCounter(rtiCOUNTER_BLOCK0); while(gTimerExpired == 0) { // Do nothing - waiting for timer to stop before exiting __asm(" NOP"); } }
gTimerExpired is a static variable visible to the rtiNotification() ISR, which sets it to 1 when the timer expires.
Seems like things get hung up in the while loop and the timer never expires. If I comment out the while loop the timer expires as expected, but I really need things to just stop during that period.
I'm sure I'm missing something simple. gTimerExpred probably needs to be updated within the while loop and can't just be "observed" when the timer expires. I have debug outputs to a UART in RTI ISR, and the timer is definitely not expiring.
Thanks in advance for any assistance!
- Tom