AnsweredAssumed Answered

Correct way to send CAN message inside interrupt

Question asked by Rui Loureiro on Jun 14, 2017
Latest reply on Jun 15, 2017 by Jeroen3

I'm using an STM32F4 Discovery and an MCP2562 transceiver. I have CAN working using the CAN2 port.

In my implementation, I'm sending several CAN messages inside a timer interrupt. I'm using the HAL function HAL_CAN_TRANSMIT_IT.  It works fine until I try to send 3 or more messages in a row, in that case HAL_CAN_TRANSMIT_IT returns an error. How should I work around this?

 

I thought about using HAL_CAN_TRANSMIT, which has the option to use a timeout, but since this is called inside an interrupt, this should be avoided.

 

Any help will be greatly appreciated.

Outcomes