cancel
Showing results for 
Search instead for 
Did you mean: 

not all msgobjects are transmitted on CANbus

robosoft2
Associate II
Posted on October 13, 2011 at 09:02

Hi,

 

I have problems using the messageRAM in CAN (STR912FW44).

The CANController is initialized to use interrupts.

In following code I update my messageRAM with new data

- There are 12 transmit messageobjects.

- CAN_TX_INTPOL is an array with the index of the messageobject (0..31).

  • I call this rouine every 250mS, so there is plenty of time to transmit the 12 messages

canmsg Msg;

for (Idx=0; Idx<12; Idx++) {

... fill Msg with new data

 

while (CAN_UpdateMsgObj(CAN_TX_INTPOL[Idx],&Msg) != SUCCESS) ;

Request++;

...

}

fill Msg with new data

 

Afterwards request the transmission of all 12 message objects is done.

CAN->SR &= ~CAN_SR_TXOK;

for (Idxi=0;Idx<12;Idx++) {

while(CAN_TransmitRequest(CAN_TX_INTPOL[Idx]) != SUCCESS);

RequestCount++;

}

 

My CANinterrupt routine releases the messageobject.

__irq void CAN_IRQHandler (void) {

…

CAN_ReleaseTxMessage(msgobj);

TransmitCount++;

…

}

Not all messages are transmitted. I Count the number of requests and the number of interrupts I get. This number is not equal. I capture the CANbus with a CANAnalyzer. Not all messages are transmitted (about 1% missing).

When I use CAN_SendMessage followed by CAN_WaitEndOfTx(), everything is OK. Of course in this case I do not use the messageRAM as it should be.

Any idea what is wrong here ?

Kind regards

Luc
0 REPLIES 0