AnsweredAssumed Answered

CAN Filters config for STM32F105 problems

Question asked by marco on Feb 19, 2016
Latest reply on Feb 19, 2016 by Clive One
HI, 

I try to config Filters for two can bus on STM32F105, but i have strange problems .

When i config filter with CAN2SB = 14 to specify start point of filters for CAN2, the interrupts RX0 and RX1, not work.

If i config Filters  with CAN2SB = 0, interrupts RX0 and RX1 work both.

Sorry for my english.
     {
          CAN_FilterConfTypeDef  sFilterConfig;

          // CAN1 filter init 
          sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
          sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
          sFilterConfig.FilterIdHigh = 0x0000;
          sFilterConfig.FilterIdLow = 0x0000;
          sFilterConfig.FilterMaskIdHigh = 0x0000;
          sFilterConfig.FilterMaskIdLow = 0x0000;
          sFilterConfig.FilterFIFOAssignment = CAN_FIFO0;
          sFilterConfig.FilterActivation = ENABLE;
          sFilterConfig.FilterNumber = 0;

          if (HAL_CAN_ConfigFilter( &hcan1, &sFilterConfig ) != HAL_OK)
          {
           Error_Handler();
          }


          // CAN2 filter init 
          sFilterConfig.BankNumber = 14; // start bank filters for can2

          sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
          sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
          sFilterConfig.FilterIdHigh = 0x0000;
          sFilterConfig.FilterIdLow = 0x0000;
          sFilterConfig.FilterMaskIdHigh = 0x0000;
          sFilterConfig.FilterMaskIdLow = 0x0000;
          sFilterConfig.FilterFIFOAssignment = CAN_FIFO0;
          sFilterConfig.FilterActivation = ENABLE;
          sFilterConfig.FilterNumber = 14;

          if (HAL_CAN_ConfigFilter( &hcan2, &sFilterConfig ) != HAL_OK)
          {
           Error_Handler();
          }
     }

   

Outcomes