AnsweredAssumed Answered

STM32F439 Issue with CAN Recieve using both FIFOs

Question asked by Sean Nutter on Feb 6, 2018
Latest reply on Feb 8, 2018 by Sean Nutter

Hi,

 

I have a weird issue happening in my code related to CAN Receive.  I have 2 filters set up to each pass a single Message:

 

void FilterSetup(void)
{
    CAN_FilterConfTypeDef  sFilterConfig;

 

    uint32_t EXTID   = 0x0CF0040A;


    sFilterConfig.FilterNumber = 0;
    sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
    sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
    sFilterConfig.FilterIdHigh = (EXTID >> 13) & 0xFFFF;
    sFilterConfig.FilterIdLow = ((EXTID << 3) & 0xFFF8) | 4;
    sFilterConfig.FilterMaskIdHigh = 0xFFFF;
    sFilterConfig.FilterMaskIdLow = 0xFFFC;
    sFilterConfig.FilterFIFOAssignment = CAN_FIFO0;
    sFilterConfig.FilterActivation = ENABLE;
    sFilterConfig.BankNumber = 9;

 

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

 

    uint32_t EXTID1   = 0x18F003F8;

 

    sFilterConfig.FilterNumber = 1;
    sFilterConfig.FilterMode = CAN_FILTERMODE_IDMASK;
    sFilterConfig.FilterScale = CAN_FILTERSCALE_32BIT;
    sFilterConfig.FilterIdHigh = (EXTID1 >> 13) & 0xFFFF;
    sFilterConfig.FilterIdLow = ((EXTID1 << 3) & 0xFFF8) | 4;
    sFilterConfig.FilterMaskIdHigh = 0xFFFF;
    sFilterConfig.FilterMaskIdLow = 0xFFFC;
    sFilterConfig.FilterFIFOAssignment = CAN_FIFO1;
    sFilterConfig.FilterActivation = ENABLE;
    sFilterConfig.BankNumber = 10;

 

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

 

When I run my code I see the following behavior: 

  • Using a PCAN tool, I send my 0x18F003F8 message to the MCU.  This works fine and i see the message was received in FIFO1.
  • Using a PCAN tool, I send my 0x0CF0040A message to the MCU.  This also works fine and I see the message received in FIFO0.
  • If I send 0x0CF0040A first (receives in FIFO0) then send 0x18F003F8.  Until I reset the MCU, 0x18F003F8 is still received but on FIFO0 not FIFO1. 

 

Any thoughts on how this might be occurring? I am using the STM32Cube_FW_F4_V1.18.0 Drivers.

 

Thanks,

Sean

Outcomes