AnsweredAssumed Answered

STM32F1 how to configure CAN filters in ID List mode?

Question asked by Ki_dy_.Jerzy.001 on Feb 21, 2017
Latest reply on Feb 22, 2017 by Clive One

I can configure CAN filters from main.c file, but I want also to configure them by sending frame from the other node. It's that even possible to configure CAN filters while STM is working? There is the code from interrupt to configure filters:

 

 

HAL_GPIO_TogglePin(LD2_GPIO_Port, LD2_Pin);

sFilterConfig.FilterMode = CAN_FILTERMODE_IDLIST;

sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;

sFilterConfig.BankNumber = hcan.pRxMsg->Data[1];

sFilterConfig.FilterNumber = hcan.pRxMsg->Data[2];

sFilterConfig.FilterIdHigh = (hcan.pRxMsg->Data[3])<<5;

sFilterConfig.FilterIdLow = 0;

sFilterConfig.FilterMaskIdHigh = 0;

sFilterConfig.FilterMaskIdLow = 0;

sFilterConfig.FilterFIFOAssignment = 0;

sFilterConfig.FilterActivation = ENABLE;

HAL_CAN_ConfigFilter(&hcan, &sFilterConfig);

 

For example I am sending Data[1] = 1, Data[2]=0.

When I'am sending the frame, the LED changes it's state, so it should work. I used analogous code in main.c file to configure filter while programming STM. It's possible to solve this?

 

Update: I can configure them from interrupt but in filter mask mode. So the issue is how to configure them in ID list mode. 

Outcomes