STM32Cube的CAN滤波如何设置,需要只让两个需要的ID进去中断,其他的全部过滤。请问如何设置?
/*##-2- Configure the CAN1 Filter ###########################################*/
sFilterConfig.FilterNumber = 0;
sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
sFilterConfig.FilterIdHigh = AllowID_F507<<5;
sFilterConfig.FilterIdLow = 0|CAN_ID_STD;;
sFilterConfig.FilterMaskIdHigh = 0xFFFF;
sFilterConfig.FilterMaskIdLow = 0xFFFF;
sFilterConfig.FilterFIFOAssignment = CAN_FIFO0;
sFilterConfig.FilterActivation = ENABLE;
sFilterConfig.BankNumber = 0;
HAL_CAN_ConfigFilter(&hcan, &sFilterConfig);
/*##-2- Configure the CAN1 Filter ###########################################*/
sFilterConfig.FilterNumber = 1;
sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
sFilterConfig.FilterIdHigh = AllowID2_F507<<5;
sFilterConfig.FilterIdLow = 0|CAN_ID_STD;;
sFilterConfig.FilterMaskIdHigh = 0xFFFF;
sFilterConfig.FilterMaskIdLow = 0xFFFF;
sFilterConfig.FilterFIFOAssignment = CAN_FIFO0;
sFilterConfig.FilterActivation = ENABLE;
sFilterConfig.BankNumber = 0;
HAL_CAN_ConfigFilter(&hcan, &sFilterConfig);
HAL_CAN_Receive_IT(&hcan,CAN_FIFO0);
芯片是用STM32F103VET的。
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
谢谢。2018401408@qq.com
明天发你邮箱。但是不要拿个资料就飞了,要经常逛论坛哦。O(∩_∩)O哈哈~
已经发你邮箱了,请注意查收哦。O(∩_∩)O哈哈~
貌似没收到
一周热门 更多>