【求助帖】有关CAN通信的问题
1709
0
5
2015-05-04
使用的是根据官方给的电路图做出来的板子,使用官方给的例程,在使用CAN通信的时候,发现发送的数据在接收到的时候,前4个字节的数据完全和后四个字节的数据一样,比如:
[code]void GYRO_RST(void)
{
CanTxMsg tx_message;
tx_message.StdId = 0x404;
tx_message.IDE = CAN_Id_Standard;
tx_message.RTR = CAN_RTR_Data;
tx_message.DLC = 0x08;
tx_message.Data[0] = 0x00;
tx_message.Data[1] = 0x01;
tx_message.Data[2] = 0x02;
tx_message.Data[3] = 0x03;
tx_message.Data[4] = 0x04;
tx_message.Data[5] = 0x05;
tx_message.Data[6] = 0x06;
tx_message.Data[7] = 0x07;
CAN_Transmit(CAN2,&tx_message);
}[/code]则接收到的是
[code]rx_message.Data[0] = 0x00;
rx_message.Data[1] = 0x01;
rx_message.Data[2] = 0x02;
rx_message.Data[3] = 0x03;
rx_message.Data[4] = 0x04;
rx_message.Data[5] = 0x05;
rx_message.Data[6] = 0x06;
rx_message.Data[7] = 0x07;[/code]
[code]void GYRO_RST(void)
{
CanTxMsg tx_message;
tx_message.StdId = 0x404;
tx_message.IDE = CAN_Id_Standard;
tx_message.RTR = CAN_RTR_Data;
tx_message.DLC = 0x08;
tx_message.Data[0] = 0x00;
tx_message.Data[1] = 0x01;
tx_message.Data[2] = 0x02;
tx_message.Data[3] = 0x03;
tx_message.Data[4] = 0x04;
tx_message.Data[5] = 0x05;
tx_message.Data[6] = 0x06;
tx_message.Data[7] = 0x07;
CAN_Transmit(CAN2,&tx_message);
}[/code]则接收到的是
[code]rx_message.Data[0] = 0x00;
rx_message.Data[1] = 0x01;
rx_message.Data[2] = 0x02;
rx_message.Data[3] = 0x03;
rx_message.Data[4] = 0x04;
rx_message.Data[5] = 0x05;
rx_message.Data[6] = 0x06;
rx_message.Data[7] = 0x07;[/code]
文章标签
请问这篇文章对你有用吗?
【求助帖】有关CAN通信的问题