Skip to main content
Eugenia Suarez
Associate III
March 16, 2017
Question

Dealing with error and overload CAN frames using HAL_CAN drivers.

  • March 16, 2017
  • 1 reply
  • 1322 views
Posted on March 16, 2017 at 11:04

Ithink this could be a silly question, but I would like to clarify with any doubt type. 

I'm working with HAL_CAN for the stm32L4. I'm developing a fw in a sw layer where I can configure CAN controller, filter banks, reset, send and receive, etc.. I'm configuring can data and remote frames format and I would like to know

  • if error frames and overhead frames must be also generated from user code or if it's a job for the STM32 under layers level (low level drivers)?

  • It's said, if my node has recived and error frame or if it has detected an error, the answer error frames from my node are they generated automatically, or must I do some code a part in order to generate an error frame?

  • How must my code deal with can error frames?

  • are these error frames keeping under HAL_CAN drivers? Does this layer some treatment of error/overload frames?

Thanks in advance.

#hal_can #stm32l4 #can #error-frames #overload #error-interrupts
This topic has been closed for replies.

1 reply

Richard Lowe
Senior II
March 21, 2017
Posted on March 21, 2017 at 11:00

Error frames are generated by the hardware. Once an error has been detected then, if your error interrupts are enabled the callback will be executed:

void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan)
{
 if( hcan->Instance == CAN1 )
 {
 osSemaphoreRelease(can_tx_semHandle);
 // Or do whatever you need, report, led, terminal.....
 }
}�?�?�?�?�?�?�?�?

Eugenia Suarez
Associate III
March 22, 2017
Posted on March 22, 2017 at 15:41

Thank you Richard, this was the same way I was thinking to follow. But I also need I was understanding it correctly. 

Regards.