cancel
Showing results for 
Search instead for 
Did you mean: 

Can HAL_CAN_AddTxMessage Not Transmit.

PZamb.2
Associate III

Hi

I try to send a message to the CAN interface, use HAl function

HAL_CAN_AddTxMessage.

But the message not send.

I verify with debug that the interface is allwais in Listering HAL_CAN_STATE_LISTENING.

Do you have idea what is wrong?

uint8_t CAN_TX(int16_t Angle)

{

uint8_t stat = 0;

CAN_TxHeaderTypeDef  TxHeader ={};

TxHeader.IDE = CAN_ID_EXT;

TxHeader.StdId = 0x00;

TxHeader.ExtId = 0x100;

uint8_t TxData[8] ={0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08};

uint32_t TxMailbox;

TxHeader.RTR =   CAN_RTR_DATA;

TxHeader.DLC =  8;

TxHeader.TransmitGlobalTime = DISABLE;

stat = HAL_CAN_AddTxMessage(&hcan1, &TxHeader, TxData, &TxMailbox);

return stat;

}

1 REPLY 1
Karl Yamashita
Lead III

You have not stated what you're transmitting to?   

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.