Skip to main content
Low Yik Seong
Associate III
January 25, 2022
Question

I just wanna know is it possible to have multiple transmitting CAN ID from a IC? Is it possible to do it using HAL library? like change the TxHeader.StdId address before call the HAL_CAN_AddTxMessage().

..

This topic has been closed for replies.

1 reply

StjepanS
Associate II
January 26, 2022

Hello @Low Yik Seong​ ,

MX_FDCAN1_Init();

CAN1_TxHeader.Identifier = 0x1F;

CAN1_TxHeader.IdType = FDCAN_STANDARD_ID;

CAN1_TxHeader.TxFrameType = FDCAN_DATA_FRAME;

CAN1_TxHeader.DataLength = FDCAN_DLC_BYTES_8;

CAN1_TxHeader.BitRateSwitch = FDCAN_BRS_OFF;

CAN1_TxHeader.ErrorStateIndicator = FDCAN_ESI_ACTIVE;

CAN1_TxHeader.FDFormat = FDCAN_CLASSIC_CAN;

CAN1_TxHeader.TxEventFifoControl = FDCAN_STORE_TX_EVENTS;

CAN1_TxHeader.MessageMarker = 0;

Start_FDCAN1_Init();

/*Some interrupt or task */

if (HAL_FDCAN_GetTxFifoFreeLevel(&hfdcan1)>0)

{

CAN1_TxHeader.Identifier += 0x10;

  HAL_FDCAN_AddMessageToTxFifoQ(&hfdcan1, &CAN1_TxHeader, CAN_Tx_Message.CAN_Data);

}

If this is what you think of, then this is legit.

The only limit you have, is level of fifo buffer. You don't want to get HAL_ERR and not handle it.

Hope this helps,

Stjepan