徐 龙军

MPC5634M Flex Can send error

Discussion created by 徐 龙军 on May 5, 2017
Latest reply on May 11, 2017 by Petr Stancik

When I send one message The CAN module Send one more frame:

My Send Code is:

if( CAN_C.BUF[ch].CS.B.CODE ==0x8 
|| CAN_C.BUF[ch].CS.B.CODE ==0x0 
) //发送缓冲为空或者未使用的话
{
CAN_C.BUF[ch].CS.B.IDE = ide; /* Use standard ID length */
if(ide == 1)
{
CAN_C.BUF[ch].ID.R = id; /* Transmit ID is 555 */
}
else
{
CAN_C.BUF[ch].ID.B.STD_ID = id; 
}
CAN_C.BUF[ch].CS.B.RTR = 0; /* Data frame, not remote Tx request frame */
CAN_C.BUF[ch].CS.B.LENGTH = length ; /* # bytes to transmit w/o null */
for (i=0; i<length; i++) {
CAN_C.BUF[ch].DATA.B[i] = *(data+i); /* Data to be transmitted */
}
CAN_C.BUF[ch].CS.B.SRR = 1; /* Tx frame (not req'd for standard frame)*/
//CAN_C.IFRL.B.BUF01I = 1;
CAN_C.BUF[ch].CS.B.CODE =0xC; /* Activate msg. buf. to transmit data frame */
//while(CAN_C.IFRL.B.BUF01I ==0);

 

}
else 
{
;
}

 

The memory:

 

I found ,when the first byte to be sent is 0xff、0xfe.... The error ;other byte will be ok!

Outcomes