From cd679a251eb3dd833ed90d75518bec218169167c Mon Sep 17 00:00:00 2001 From: "Aubr.Cool" Date: Mon, 26 Dec 2016 14:21:13 +0800 Subject: [PATCH] [BSP] stm32f10x bxcan correct ext frame filter --- bsp/stm32f10x/drivers/bxcan.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/bsp/stm32f10x/drivers/bxcan.c b/bsp/stm32f10x/drivers/bxcan.c index 77d18c6fd0..70ee941c52 100644 --- a/bsp/stm32f10x/drivers/bxcan.c +++ b/bsp/stm32f10x/drivers/bxcan.c @@ -1008,10 +1008,20 @@ static rt_err_t bxmodifyfilter(struct stm_bxcan *pbxcan, struct rt_can_filter_it } break; } - CAN_FilterInitStructure.CAN_FilterIdHigh = ((ID[1]) & 0x0000FFFF); - CAN_FilterInitStructure.CAN_FilterIdLow = ID[0] & 0x0000FFFF; - CAN_FilterInitStructure.CAN_FilterMaskIdHigh = (ID[1] & 0xFFFF0000) >> 16; - CAN_FilterInitStructure.CAN_FilterMaskIdLow = (ID[0] & 0xFFFF0000) >> 16; + if(pitem->ide) + { + CAN_FilterInitStructure.CAN_FilterIdHigh = (ID[0] & 0xFFFF0000) >> 16; + CAN_FilterInitStructure.CAN_FilterIdLow = ID[0] & 0x0000FFFF; + CAN_FilterInitStructure.CAN_FilterMaskIdHigh = (ID[1] & 0xFFFF0000) >> 16; + CAN_FilterInitStructure.CAN_FilterMaskIdLow = ((ID[1]) & 0x0000FFFF); + } + else + { + CAN_FilterInitStructure.CAN_FilterIdHigh = ((ID[1]) & 0x0000FFFF); + CAN_FilterInitStructure.CAN_FilterIdLow = ID[0] & 0x0000FFFF; + CAN_FilterInitStructure.CAN_FilterMaskIdHigh = (ID[1] & 0xFFFF0000) >> 16; + CAN_FilterInitStructure.CAN_FilterMaskIdLow = (ID[0] & 0xFFFF0000) >> 16; + } if (fbase >= pbxcan->fifo1filteroff) { CAN_FilterInitStructure.CAN_FilterFIFOAssignment = 1;