2023-04-14 12:13 AM
I am using STM32H503.
I want to receive only incoming ids as 0x222 using masking .
If set like the code below, IDs other than 0x222 are also entered into the rx callback function. Is there something wrong with the masking process?
FDCAN_FilterTypeDef sFilterConfig;
sFilterConfig.IdType = FDCAN_STANDARD_ID;
sFilterConfig.FilterIndex = 0;
sFilterConfig.FilterType = FDCAN_FILTER_MASK;
sFilterConfig.FilterConfig = FDCAN_FILTER_TO_RXFIFO0;
sFilterConfig.FilterID1 = 0x222;
sFilterConfig.FilterID2 = 0x7FF;
if(HAL_FDCAN_ConfigFilter(&hfdcan1, &sFilterConfig) != HAL_OK)
{
Error_Handler();
}
Solved! Go to Solution.
2023-04-14 03:29 AM
My notes tell me:
/*
RX
FIFO vs buffer:
- RX buffer is only filled when buffers's specific FILTER is matched
- FIFO is better for filter ranges / bit masks
LISTENING:
if global reject is NOT turned on with HAL_FDCAN_ConfigGlobalFilter(),
then all messages are received in
RX FIFO 0
CAN to IP:
- in RX ISR:
- take timestamp
- prepare buffer
- set flag
*/
Therefore, put at the end of the init function, before starting the peripheral:
/* Configure global filter to reject all non-matching frames */
HAL_FDCAN_ConfigGlobalFilter(phCan, FDCAN_REJECT, FDCAN_REJECT, FDCAN_REJECT_REMOTE, FDCAN_REJECT_REMOTE);
2023-04-14 03:29 AM
My notes tell me:
/*
RX
FIFO vs buffer:
- RX buffer is only filled when buffers's specific FILTER is matched
- FIFO is better for filter ranges / bit masks
LISTENING:
if global reject is NOT turned on with HAL_FDCAN_ConfigGlobalFilter(),
then all messages are received in
RX FIFO 0
CAN to IP:
- in RX ISR:
- take timestamp
- prepare buffer
- set flag
*/
Therefore, put at the end of the init function, before starting the peripheral:
/* Configure global filter to reject all non-matching frames */
HAL_FDCAN_ConfigGlobalFilter(phCan, FDCAN_REJECT, FDCAN_REJECT, FDCAN_REJECT_REMOTE, FDCAN_REJECT_REMOTE);
2023-04-14 03:39 AM
solved!!
Thank you twice.