FDCAN on STM32G491RE: Tx message truncated. 8 bytes sent instead of 12 bytes
I am using STM32G491RE - NUCLEO. connected to the ADM3055e CAN Transceiver
Currently I am trying to send 12 Bytes of Data from IXXAT Terminal over to FDCAN1 which receives the message fine and then Output the Message on FDCAN2 though a buffer. So My logic is when a message pass the filter it gets called by the Fifo0Callback and push it to a buffer below. This works fine the buffer also get the full 12Bytes of data same FD format and everything checked out.
But when I try to add the message to HAL_FDCAN_AddMessageToTxFifoQ(&hfdcan2, &TxHeader2, TxData2). Where TxData is the dequeued message from the buffer and copys the 12Bytes. The message somehow gets truncated to 8Bytes on output.
Heck, when I add "if (HAL_FDCAN_GetTxFifoFreeLevel(&hfdcan2) > 0)", It somehow says it is full even when starting the code.
I have been suspecting because I cant set the HAL_FDCAN_ConfigTxBufferElementSize and HAL_FDCAN_ConfigRxBufferElementSize or even the messageRam offset like i could in the STM32H7 series. which may be causing the issue. Any Ideas on what I should do?
Let me know if you need more information.
Thanks in advance!
void HAL_FDCAN_RxFifo0Callback(FDCAN_HandleTypeDef *hfdcan, uint32_t RxFifo0ITs)
{
if((RxFifo0ITs & FDCAN_IT_RX_FIFO0_NEW_MESSAGE) != RESET)
{
if (hfdcan->Instance == FDCAN2)
{
...
}
else if (hfdcan->Instance == FDCAN1)
{
if (HAL_FDCAN_GetRxMessage(hfdcan, FDCAN_RX_FIFO0, &RxHeader1, RxData1) == HAL_OK)
{
uint8_t len = Can_DlcToBytes(RxHeader1.DataLength);
if (!CanRxBuffer_EnqueueFromISR1(RxHeader1.Identifier, RxData1, len)) {
FDCAN1_LED_State = LED_FIFO0_ERROR;
} else {
FDCAN1_LED_State = LED_STORE_BUFFER;
}
}
else {
FDCAN1_LED_State = LED_FIFO0_ERROR;
}
}
