2022-01-25 01:53 AM
2022-01-25 10:55 PM
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