Problem in CAN - ST10F276 - 2 parallel msgs
Company  
ST Home | Microcontrollers

Index  »  ST10  »  Problem in CAN - ST10F276 - 2 parallel msgs
     
   Problem in CAN - ST10F276 - 2 parallel msgs
 Moderated by :   »  Max  -  Kenshin  -  Najoua

Author
beginning argument    ( Replies received: 2 )
Ran   Posted 03-07-2008 at 13:11   



Registered on :
05-30-2006

From Israel

Messages : 20

 OFF-Line

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?



 Profile   Quote  
Mirco   Posted 08-07-2008 at 08:09   



Registered on :
03-30-2005

From Germany

Messages : 11

 OFF-Line

Hello,

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



 Profile   www   Quote  
Ran   Posted 09-07-2008 at 08:13   



Registered on :
05-30-2006

From Israel

Messages : 20

 OFF-Line

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



 Profile   Quote  
On Top

Search in the forums
 
Jump To