We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I'm working with the MCB2370 board which runs a small program that puts the adc value onto an oled display and blinks a led every second.
I've created a 1 msec interrupt using timer0 which determines which task should be started, handling the led or updating the display.
when I run the program it SOMETIMES hangs and the display isn't being updated. But the led still blinks which means that the timer interrupt is still working.
When I run the debugger I can see that the SWI_handler is being called. But i'm not using software interrupts.
How can I debug this problem and see what causes the program to hang?!
Below is the code of my timer interrupt.
Kind regards, Sander Wiggers
void timer0_isr(void) __irq { static uint8 cnt_10ms = 0; T0IR = 0x01; /* Clear Timer0 interrupt */ IENABLE; /* handles nested interrupt */ if(tmr_data.proc_list[cnt_10ms].tmr_proc_active) tmr_data.proc_list[cnt_10ms].tmr_proc(); cnt_10ms++; if(cnt_10ms == MAX_TMR_PROC) cnt_10ms = 0; IDISABLE; VICVectAddr = 0; /* Acknowledge interrupt */ }
If you can only start one "process" every ms, and every "process" is guaranteed to not consume more than 0.3ms - exactly why do you need nested interrupts?
If you have more interrupt handlers that may trig during your "process" call, then your 0,3ms assumption will not hold anymore.
If ADC is the only extremely time-critical task - why not use a superloop, but let the ADC samples be retrieved by the ADC conversion interrupt, and stored in a buffer?