2020-08-27 03:48 AM
Hi everyone! I have simple question but i don't understand how to implement this. I want to setup bxCAN filters in such way that the CAN node will ignore only it's own messages. First idea is to use two ranges - two filters that will accept all messages with ID "below" and "above" present node's ID. For example, we have a node with standard ID = 00000110000. For lower range i think there will be register ID (filter) = 00000101111 with mask 11111110000. But how i should choose upper range filter without blocking messages with other ID (for example 0000110010)?
I use stm32f103c8t6.
My filter setup at the present time looks like this (it accepts all messages):
static uint32_t CAN_filter_ID0 = 0x00;
CAN1->FMR |= CAN_FMR_FINIT;
CAN1->FA1R &= ~(1 << CAN_filter_ID0);
CAN1->FS1R |= (1 << CAN_filter_ID0);
CAN1->FM1R &= ~(1 << CAN_filter_ID0);
CAN1->sFilterRegister[CAN_filter_ID0].FR1 = 0;
CAN1->sFilterRegister[CAN_filter_ID0].FR2 = 0;
CAN1->FFA1R &= ~(1 << CAN_filter_ID0);
CAN1->FA1R |= (1 << CAN_filter_ID0);
CAN1->FMR &= ~CAN_FMR_FINIT;
Thank you in advance!