cancel
Showing results for 
Search instead for 
Did you mean: 

How should filter and mask ids be in stm32f446re processor? How can be filter id and mask id in EXID? I am new here. I am waiting your help. Thanks.

qwerty
Associate II

0693W000003BZRkQAO.jpg

3 REPLIES 3

Going to be a function of the bits you want to match. Place them in the bit positions described, construct a bit mask to extract them.

What IDs do you need to match?​

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I use stm32f446re. I want the processor to get the value 0x1405. Example: Processor light the led according to the value 0x1405.

Use only can2.

Apb1= 32Mhz

systemclock =64 Mhz

//can2 settings

void MX_CAN2_Init(void)

{

CAN_FilterTypeDef sFilterConfig;

 hcan2.Instance = CAN2;

 hcan2.Init.Prescaler = 8;

 hcan2.Init.Mode = CAN_MODE_NORMAL;

 hcan2.Init.SyncJumpWidth = CAN_SJW_1TQ;

 hcan2.Init.TimeSeg1 = CAN_BS1_11TQ;

 hcan2.Init.TimeSeg2 = CAN_BS2_4TQ;

 hcan2.Init.TimeTriggeredMode = DISABLE;

 hcan2.Init.AutoBusOff = DISABLE;

 hcan2.Init.AutoWakeUp = DISABLE;

 hcan2.Init.AutoRetransmission = DISABLE;

 hcan2.Init.ReceiveFifoLocked = DISABLE;

 hcan2.Init.TransmitFifoPriority = DISABLE;

 if (HAL_CAN_Init(&hcan2) != HAL_OK)

 {

  Error_Handler();

 }

sFilterConfig.FilterBank = 0;

sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;

sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;

sFilterConfig.FilterIdHigh=

sFilterConfig.FilterIdLow=

sFilterConfig.FilterMaskIdHigh=

sFilterConfig.FilterMaskIdLow=

sFilterConfig.FilterFIFOAssignment = CAN_FILTER_FIFO0;

sFilterConfig.FilterActivation = CAN_FILTER_ENABLE;

sFilterConfig.SlaveStartFilterBank = 13;

HAL_CAN_ConfigFilter(&hcan2, &sFilterConfig);

HAL_CAN_Start(&hcan2);

HAL_CAN_ActivateNotification(&hcan2, CAN_IT_RX_FIFO0_MSG_PENDING);

}

.