Hi all,
i am working on a CAN driver, i have 2 dev. boards connected via CAN.
Each 100 ms one of the boards requests data from the other board. That part runs smoothly now. The problem i have now is that, if i disconnect the 2 boards from each other, my application hangs, because of the CAN ISR is being continually run, not letting my app. get some processor time.
The problem for me is i cant see the source of the interrupt, in the ISR
i have the following:
ulIntStatus = AT91C_BASE_CAN->CAN_SR;
ulIntMask= AT91C_BASE_CAN->CAN_IMR;
ulIntStatus &= ulIntMask;
this results in ulIntStatus = 0.
i have made a crude workaround for this:
in the ISR:
if (ulIntStatus == 0)
{
msgstatus= AT91C_BASE_CAN->CAN_MB0.CAN_MB_MSR;
msgstatus= AT91C_BASE_CAN->CAN_MB1.CAN_MB_MSR;
AT91C_BASE_CAN->CAN_MR = 0x0; // disable CAN
}
and then in the app.:
if (!(AT91C_BASE_CAN->CAN_MR & 0x01))
{
// Reinitialize CAN
Communication_Init();
}
I would really like the CAN driver to be able survive the disconnection on its own, rather than having to check if the CAN controller was disabled.
any insights or solutions would be greatfully appreciated.
regards,
Martin
P.S i am using yagarto gcc 4.1.1 and eclipse
P.S.S i am using mailbox0 to send and mailbox1 to receive on both boards