AnsweredAssumed Answered

STM32F4 Discovery Filter configration

Question asked by saraf.ninad.001 on Jun 30, 2016
Latest reply on Jun 30, 2016 by Clive One
Hello,
   can any one please provide me with CAN Filter configuration of  'FilterIdHigh', ''FilterIdLow', 'FilterMaskIdHigh', 'FilterMaskIdLow', 'BankNumber' of STM32F4 Discovery board. i want to receive any frame on CAN1 Receiver. i am using HAL Library.
I have configured my CAN Filter as follows.
/*CAN1 filter function*/
void CAN_filter_init(void)
{
     CAN_FilterConfTypeDef  sFilterConfig;

       /*##-2- Configure the CAN Filter ###########################################*/
     sFilterConfig.FilterNumber = 0;
    sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
    sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
    sFilterConfig.FilterIdHigh = 0xFFFF;;
    sFilterConfig.FilterIdLow = 0x0000;
    sFilterConfig.FilterMaskIdHigh = 0xFFFF;
    sFilterConfig.FilterMaskIdLow = 0x0000;
    sFilterConfig.FilterFIFOAssignment = CAN_FILTER_FIFO0;
    sFilterConfig.FilterActivation = ENABLE;
    sFilterConfig.BankNumber =14;
    HAL_CAN_ConfigFilter(&CanHandle, &sFilterConfig);
}
with this CAN configuration i am trying to receive frame on CAN1 using the following 
/*CAN1 Receving function */
void CAN_Rx(void)
{

            HAL_CAN_Receive(&CanHandle,CAN_FILTER_FIFO0, 10);
                 datarx[0]=CanHandle.pRxMsg->StdId ;
                     datarx[1] =CanHandle.pRxMsg->DLC;
                 datarx[2]= CanHandle.pRxMsg->RTR        ;
                 datarx[3]= CanHandle.pRxMsg->DLC        ;
                 datarx[4]= CanHandle.pRxMsg->Data[0] ;
                     datarx[5]= CanHandle.pRxMsg->Data[1];
}

please provide me with the correct can filter configuration.

Thanks in advance!
 

Outcomes