2020-11-24 02:26 PM
2020-11-24 10:14 PM
Hi,
It looks to me that you are not assigning any space for any kind of tx queue or buffer:
row ~378:
hfdcan1.Init.TxEventsNbr = 0;
hfdcan1.Init.TxBuffersNbr = 0;
hfdcan1.Init.TxFifoQueueElmtsNbr = 0;
hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;
You need to allocate how many elements are reserved for example for the queue. Otherwise there is no reservation in the RAM and no place for the function call to place the data in.
Same thing goes for rx fifo buffers.
Best regards
2020-11-24 10:14 PM
Hi,
It looks to me that you are not assigning any space for any kind of tx queue or buffer:
row ~378:
hfdcan1.Init.TxEventsNbr = 0;
hfdcan1.Init.TxBuffersNbr = 0;
hfdcan1.Init.TxFifoQueueElmtsNbr = 0;
hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;
You need to allocate how many elements are reserved for example for the queue. Otherwise there is no reservation in the RAM and no place for the function call to place the data in.
Same thing goes for rx fifo buffers.
Best regards
2020-11-26 10:30 PM
If the above was good enough answer to help you solve the issue, please select it as the answer to help others in the future.
2020-11-30 08:29 AM
As suggested by "TOlli" it is a RAM assignment issue. I added "CAN1.Init.TxBuffersNbr = 2;" to my CAN_Init function and worked just fine after that.
Here is the complete CAN Init function function.
void CAN1_Init(void)
{
CAN1.Instance = FDCAN1;
CAN1.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
CAN1.Init.Mode = FDCAN_MODE_EXTERNAL_LOOPBACK; // EXTERNAL Means FDCAN treats its own transmitted messages as received messages
CAN1.Init.AutoRetransmission = ENABLE;
CAN1.Init.NominalPrescaler = 3; // Setting values for 500k bps
CAN1.Init.NominalSyncJumpWidth = 1;
CAN1.Init.NominalTimeSeg1 = 2;
CAN1.Init.NominalTimeSeg2 = 2;
CAN1.Init.TxBuffersNbr = 2;
if (HAL_FDCAN_Init(&CAN1) != HAL_OK)
{
Error_Handler();
}
}