AnsweredAssumed Answered

Problem Sending CAN Message

Question asked by fraser.andrew on Apr 15, 2018
Latest reply on Apr 16, 2018 by T J

I am following the example code found here to send and receive CAN messages:




I can happily receive CAN messages but when I call the following code, the CAN message is never sent.


HAL_CAN_AddTxMessage( &hcan1, &TxHeader, TxData, &TxMailbox );
while(HAL_CAN_GetTxMailboxesFreeLevel(&hcan1) != 3) {}


TxHeader is configured as:


TxHeader.StdId = 0x123;
TxHeader.ExtId = 0x01;
TxHeader.IDE = CAN_ID_STD;
TxHeader.DLC = 7;
TxHeader.TransmitGlobalTime = DISABLE;


And TxData is filled with seven bytes of data.


HAL_CAN_GetTxMailboxesFreeLevel always returns 2 and I don't see the CAN message on the bus.


Any help or idea would be gratefully appreciated.