2011-10-13 12:02 AM
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).
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