cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in CAN - ST10F276 - 2 parallel msgs

rana
Associate II
Posted on July 09, 2008 at 04:43

Problem in CAN - ST10F276 - 2 parallel msgs

3 REPLIES 3
rana
Associate II
Posted on July 03, 2008 at 09:41

when I connect 2 masters to 1 slave (CANbus network), sometimes the slave miss a msg.

I think the CAN1IR shows the highest priority and miss the lower one.

Does CAN1IR acts like a FIFO?

what happen if when my interrput handles a msg, and in the mean while another msg arrives?

mirco23
Associate II
Posted on July 08, 2008 at 04:39

Hello,

have you implement the CAN interrupt driver as described in AN2628?

rana
Associate II
Posted on July 09, 2008 at 04:43

Hi Mirco.

recently I changed the Interrupt driver into:

:

while ( CAN1IP1 || CAN1IP2 || CAN1IR )

{

. . // Check status interrupt

. . if(CAN1IR & 0x8000)

. . {

. . . . ...

. . }

. . else

. . {

. . . . // Start over, maybe in while handling the interrupt another msg arrived?

. . . . for (wMsgObjInt = 0; wMsgObjInt < 16 ; wMsgObjInt++)

. . . . {

. . . . . . if ((1 (shr) wMsgObjInt) & CAN1IP1)

. . . . . . . . break;

. . . . }

. . . . if (wMsgObjInt == 16)

. . . . {

. . . . . . for (wMsgObjInt = 0; wMsgObjInt < 16 ; wMsgObjInt++)

. . . . . . {

. . . . . . . . if ((1 (shr) wMsgObjInt) & CAN1IP2)

. . . . . . . . . . break;

. . . . . . }

. . . . . . wMsgObjInt += 16;

. . . . }

. . . . if (wMsgObjInt == 32)

. . . . {

. . . . . . //??? no Msg

. . . . }

. . . . else

. . . . {

. . . . . . wMsgObjInt++;

. . . . . . // Msg arrived #wMsgObjInt

. . . . . . // Do Interrput actions (remote/new data)

. . . . . . ....

. . . . . . // Clear the Msg

. . . . . . CAN1IF1CM = 0x0008;

. . . . . . CAN1IF1CR = wMsgObjInt;

. . . . . . while (CAN1IF1CR & 0x8000);

. . . . }

. . }

}

will it do the job?

thanks in advanced.

ran