AnsweredAssumed Answered

Multiple CAN problems

Question asked by Mark Shoe on May 29, 2017

See also my post How to stop HAL_CAN_ErrorCallback

Something else now. On every CAN receive IRQ the HAL_CAN_TxCpltCallback triggers and nothing has been send. It is because the HAL_CAN_IRQHandler is called by the receive of a CAN message and 

 

__HAL_CAN_TRANSMIT_STATUS(hcan, CAN_TXMAILBOX_0))

__HAL_CAN_TRANSMIT_STATUS(hcan, CAN_TXMAILBOX_1))

 

Are always true. So the Tx Complete IRQ is also triggered when the Rx triggers. Bug??

 

The HAL_CAN_RxCpltCallback works well (unlike the UART RX IRQ) after weeks of testing however sometimes the HAL_CAN_Transmit_IT does not tx anymore. So i printed the flags. In case of error i have the CAN_FLAG_EWG and 
CAN_FLAG_EPV  when it does work i also have this flags after some time. When disconnect the CAN connector there is no BOF as i should aspect. 

 

Can ST provide an example of a stable CAN rx and tx routine that keeps working even if the cable has been disconnected.

Outcomes