2016-01-26 03:04 AM
Hello everyone, I'm working with STM32F415RGT6. I need to setup the can filtering so as to get all messages which source address (I need to work with extended IDs) is different from a given one, discarded (by hardware). I'm trying to do that using the CAN_FilterConfTypeDef structure. I've had a look at the documentation (API documentation and MCU user manual), but I don't understand how the incoming message filtering works. For instance, let's suppose I need to receive messages which source address is 0x33. How should I configure the FilterIdHigh, FilterIdLow, FilterMaskIdHigh, and FilterMaskIdLow fields of the CAN_FilterConfTypeDef structure? A broader explanation of how the filtering works would also be appreciated. Many thanks in advance.
#stm32f4 #id-filters #can2016-01-26 04:19 PM
[DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32%20CAN%20acceptance%20mask&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=79]https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/STM32%20CAN%20acceptance%20mask&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B¤tviews=79
[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Discovery/STM32%20CAN%20networking%20demo%20-%20filter%20to%20accept%20everything&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F¤tviews=91]https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSTM32Discovery%2FSTM32%20CAN%20networking%20demo%20-%20filter%20to%20accept%20everything&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F¤tviews=91 clive1 CAN Filtering2016-01-26 04:48 PM
/* CAN filter init */
CAN_FilterInitStructure.CAN_FilterMode = CAN_FilterMode_IdMask;
CAN_FilterInitStructure.CAN_FilterScale = CAN_FilterScale_32bit;
CAN_FilterInitStructure.CAN_FilterIdHigh = (0x033 << 5); // ID 11-bit in top bits
CAN_FilterInitStructure.CAN_FilterIdLow = 0x0000;
CAN_FilterInitStructure.CAN_FilterMaskIdHigh = 0xFFE0;// ID 11-bit in top bits, mask for comparison
CAN_FilterInitStructure.CAN_FilterMaskIdLow = 0x0000;
// if ((bitstream & CAN_FilterMaskId) == CAN_FilterId)
2016-02-01 06:36 AM
2019-01-26 12:14 AM
Is HAL_CAN_ERROR_PARAM about this configuration?
2019-01-26 07:59 AM
Probably not, but you have the library source, and can breakpoint or step that to understand what it is objecting too.
2019-01-26 08:03 AM
https://community.st.com/s/question/0D50X00009XkhRbSAJ/stm32-can-acceptance-mask
https://community.st.com/s/question/0D50X00009XkfSlSAJ/can-filters
People were hired and tasked with fixing this mess...