Skip to main content
Visitor II
July 9, 2008
Question

Problem in CAN - ST10F276 - 2 parallel msgs

  • July 9, 2008
  • 3 replies
  • 930 views
Posted on July 09, 2008 at 04:43

Problem in CAN - ST10F276 - 2 parallel msgs

    This topic has been closed for replies.

    3 replies

    ranaAuthor
    Visitor II
    July 3, 2008
    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?

    Visitor II
    July 8, 2008
    Posted on July 08, 2008 at 04:39

    Hello,

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

    ranaAuthor
    Visitor II
    July 9, 2008
    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