|
I am having some really strange behaviour in my PWMC interrupt. I have two different channels that are running on timebases that are a multiple of each other. As a result, sometimes when the interrupt occurs, multiple channels will need to be serviced. Here's the thing... when I read the ISR register three times in a row, I get different results each time!
If I put a breakpoint on the trchalt() call below, i=6, j=2, and a subsequent read of the ISR gives 0. Does this mean that I am supposed to get one interrupt for each channel, and only service the interrupt for that channel on that pass through???
static void PWMC_handler(void) { volatile int i, j;
/* Clear ISR by reading it */ i = AT91C_BASE_PWMC->PWMC_ISR;
/* Check for anomalies. */ /* ISR should not still be set immediately after read. */ if ((j = AT91C_BASE_PWMC->PWMC_ISR)) { trchalt(); }
|