I have a problem when using a KitCON C167 boards. This problem is described as follows. When using two interrupts: [1] generated externally by an arrival of a CAN message, and [2] generated from an on-chip timer, it seems that the second interrupt (timer-based) does not occur. Note that when I used two timer interrupts this problem did not exist. Only when a timer interrupt is used along with the CAN interrupt, the problem stands. What could be the reason of this? and any suggestions for solving it? Thanks a lot, Mouaaz.
What value did you program into the xxIC register for each interrupt?
XPIC = 0x0047; // this is for CAN interrupt. TxIC = 0x006A; // this is for Tx timer interrupt. Note that timer Tx is run inside the ISR of CAN-interrupt. So the second interrupt is dependent on the first interrupt. Example: CAN_ISR() { Tx = 0; // start Tx to count from 0. TxR = 1; // run Tx. }
Both interrupts are enabled and are on different levels and above level zero. You also have the timer with a higher priority than the CAN. Given the information so far, I don't see a problem. You example only starts the timer within the CAN interrupt. Have you confirmed that you would get a timer interrupt within the CAN interrupt? Did you just try to set the timer interrupt request flag to see if you vector? Example:
CAN_ISR() { Tx_IR = 1; /* set the interrupt request flag on the timer */ }