2016-03-04 12:14 AM
Hello!
I am using a custom made STM32F302RE board. I want configure the filter such that I would be able to receive all messages. I have coded it as follows:int i;
for ( i=0 ; i<=14 ; i++ ){
/* Allow all messages to be received */
CAN_FilterConfTypeDef sFilterConfig;
sFilterConfig.BankNumber = 0;
sFilterConfig.FilterActivation = ENABLE;
sFilterConfig.FilterNumber = i;
sFilterConfig.FilterFIFOAssignment = 0;
sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
sFilterConfig.FilterMaskIdLow = 0;
sFilterConfig.FilterMaskIdHigh = 0;
sFilterConfig.FilterIdLow = 0;
sFilterConfig.FilterIdHigh = 0;
HAL_CAN_ConfigFilter(&hcan, &sFilterConfig);
}
HAL_CAN_Receive_IT(&hcan, CAN_FIFO0);
However, I do not receive all messages as I wanted. is there anything wrong in the filter configuration?? Any suggestions? Thanks!
#can-
2016-03-04 05:44 AM
What exactly do you think it is missing?
2016-03-04 08:00 AM
Hello mk.shasha,
I suggest you to refer to this example: STM32Cube_FW_F3_V1.4.0\Projects\STM32303C_EVAL\Examples\CAN\CAN_Networking It help you to configure the CAN filter.-ForumSTM32-2016-03-04 09:40 AM
Yeah, I think we've both looked at CAN filtering before, perhaps you can be more specific about how the example you cited differs from the pass everything model used here?
2016-03-07 01:53 AM
Hello,
I have tried the codes you suggested but I am not able to receive all messages.2016-03-07 01:57 AM
Hi Clive,
I need to receive all messages from the controller to my module so that I can analyse the received messages. I suspect that my filter configuration is wrong. I have already enabled receive interrupt and coded HAL_CAN_RECEIVE_IT after filter configuration. Even when I used the example from ST Micro, I am unable to receive all messages. Any suggestions??2016-03-07 08:21 AM
Ok, but what messages are you seeing, and which ones do you think you are missing, and what analysis leads you to believe you are missing messages on the wire?
2016-03-07 04:46 PM
Currently, the message receive is very unstable as I am receiving messages sometimes and other times, the codes go to error handler (CAN_SCE handler) after the filter configuration.
I have tried the same filter configuration on STM32F302R8 custom made board and I am receiving messages as codes go into receive handler and I observe messages such as 0x4b6 and 0x4b7 at CAN_RECEIVE_IT () function (called in HAL_CAN_IRQHANDLER function). This behaviour is consistent for STM32F302R8 board but very inconsistent for STM32F302RE board. I am using the same codes for CAN for both boards and so I expect the same behaviour for both boards.