各位大侠:
最近在搞CAN(STM32F105)。阅读的资料为:ST官方的固件库说明和用户手册,固件库版本V3.5。
关于过滤器的设计:
官方例程中:接收的CAN1配置成如下:
CAN_FilterInitStructure.CAN_FilterMode = CAN_FilterMode_IdMask;
CAN_FilterInitStructure.CAN_FilterScale = CAN_FilterScale_32bit;
CAN_FilterInitStructure.CAN_FilterIdHigh = 0x6420;
CAN_FilterInitStructure.CAN_FilterIdLow = 0x0000;
CAN_FilterInitStructure.CAN_FilterMaskIdHigh = 0x0000;
CAN_FilterInitStructure.CAN_FilterMaskIdLow = 0x0000;
发送端CAN2配置成如下,
TxMessage.StdId = 0x321;
TxMessage.ExtId = 0x01;
TxMessage.RTR = CAN_RTR_DATA;
TxMessage.IDE = CAN_ID_STD;
TxMessage.DLC = 1;
1问:TxMessage.StdId = 0x321是如何与CAN1的过滤器配成对的?
例程中又将CAN2接收端配置为
CAN_FilterInitStructure.CAN_FilterIdHigh = 0x2460;
而CAN1发送配置不变。
2问:这就奇怪了,TxMessage.StdId = 0x321又是如何与CAN2的过滤器配成对的?
官方的例程见附件。求助各路大侠和香版主! |