我想不是本地地址的数据就不接收。使用CAN扩展帧发送接收数据,13~21位存放地址。但是按照下面配置接收不到数据,如果使用注释掉的方法,就可以接收到数据,再软件判断13~21。
static void canFilterConfig()
{
CAN_FilterInitTypeDef CAN_FilterInitStructure;
/* CAN filter init */
CAN_FilterInitStructure.CAN_FilterNumber = 0;
CAN_FilterInitStructure.CAN_FilterMode = CAN_FilterMode_IdMask;
CAN_FilterInitStructure.CAN_FilterScale = CAN_FilterScale_32bit;
CAN_FilterInitStructure.CAN_FilterIdHigh = (canDriver.localAddress >> 3) & 0x001F;
CAN_FilterInitStructure.CAN_FilterIdLow = (canDriver.localAddress << 13) & 0xE000;
CAN_FilterInitStructure.CAN_FilterMaskIdHigh = 0x001F;
CAN_FilterInitStructure.CAN_FilterMaskIdLow = 0xE000;
// CAN_FilterInitStructure.CAN_FilterIdHigh = 0x00;
// CAN_FilterInitStructure.CAN_FilterIdLow = 0x00;
// CAN_FilterInitStructure.CAN_FilterMaskIdHigh = 0x00;
// CAN_FilterInitStructure.CAN_FilterMaskIdLow = 0x00;
CAN_FilterInitStructure.CAN_FilterFIFOAssignment = CAN_Filter_FIFO0;
CAN_FilterInitStructure.CAN_FilterActivation = ENABLE;
CAN_FilterInit(&CAN_FilterInitStructure);
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
http://www.openedv.com/forum.php?mod=viewthread&tid=10328
一周热门 更多>