AnsweredAssumed Answered

CanRx no callback

Question asked by Bartocha.Mateusz.001 on Mar 14, 2016
Latest reply on Mar 26, 2016 by Clive One
Hi,

I wrote about in other topic but it was not clear so I took decision to start other topic.

I'm working with CAN of F103 with CubeMX configuration.

Transmiting works fine but I have problem with receive.

Before while loop in user code I copied part from CubeF1 example package:

/*##-2- Start the Reception process and enable reception interrupt #########*/
if (HAL_CAN_Receive_IT(&hcan, CAN_FIFO0) != HAL_OK)
{
    /* Reception Error */
    Error_Handler();
}

It shall enable interrupt but I'm not getting any callback...

I have to call it manualy like this:

/* Infinite loop */
  /* USER CODE BEGIN WHILE */
  while (1)
  {
  /* USER CODE END WHILE */
  
        HAL_CAN_Transmit(&hcan, 10);
  
        if(HAL_CAN_Receive(&hcan, CAN_FIFO0,10) == HAL_OK)
        {
            HAL_CAN_RxCpltCallback(&hcan);
        }
          
        HAL_Delay(10);
          
  /* USER CODE BEGIN 3 */
  
  }
  /* USER CODE END 3 */
  
}

In that way it's working on loopback mode.

Any idea why do I have to do it that way?

Outcomes