AnsweredAssumed Answered

HAL CAN transmit timeout bug?

Question asked by Alex S on Dec 19, 2017
Latest reply on Jan 23, 2018 by c rs

Hi,

 

I'm using one STM32F2 board and two STM32F3 boards. The F2 is the CAN master and the F3 are slaves. Everything works fine if I use only one F3 board. If I add the other one, then after 30sec - 5min one of the F3 boards is going to always return HAL_TIMEOUT from HAL_CAN_Transmit.

 

This is the code from HAL_CAN_Transmit that always returns HAL_TIMEOUT.

    /* Check End of transmission flag */
    while(!(__HAL_CAN_TRANSMIT_STATUS(hcan, transmitmailbox)))
    {
      /* Check for the Timeout */
      if(Timeout != HAL_MAX_DELAY)
      {
        if((Timeout == 0U) || ((HAL_GetTick()-tickstart) > Timeout))
        {
          hcan->State = HAL_CAN_STATE_TIMEOUT;
          /* Cancel transmission */
          __HAL_CAN_CANCEL_TRANSMIT(hcan, transmitmailbox);
          /* Process unlocked */
          __HAL_UNLOCK(hcan);
          return HAL_TIMEOUT;
        }
      }
    }

I'm using STM32CubeF3 V1.9.0

 

Here is a snapshot of my CAN registers right before the return HAL_TIMEOUT;

 

CAN regs

Outcomes