2022-04-19 05:01 AM
Hello,
I've been using the STM32L5 FDCAN HAL Driver but I have some problems with it.
When i try sending some CAN 2.0 frames to the STM32, an isr is called and the error Message RAM access failure is raised.
Sometimes, the ACK is sent but the interrupt is not even called.
if( HAL_FDCAN_ActivateNotification( &hfdcan1 , FDCAN_IT_LIST_RX_FIFO0 | FDCAN_IT_GROUP_RX_FIFO0 , (uint32_t) NULL ) != HAL_OK ){
monitor_errorHandler( MONITOR_CRITICAL_FAULT( 16 ) , 1 );
}
if( HAL_FDCAN_ActivateNotification( &hfdcan1 , FDCAN_IT_GROUP_RX_FIFO1 , (uint32_t) NULL ) != HAL_OK ){
monitor_errorHandler( MONITOR_CRITICAL_FAULT( 16 ) , 20 );
}
if( HAL_FDCAN_ActivateNotification( &hfdcan1 , FDCAN_IT_GROUP_TX_FIFO_ERROR | FDCAN_IT_GROUP_MISC | FDCAN_IT_GROUP_BIT_LINE_ERROR | FDCAN_IT_GROUP_PROTOCOL_ERROR , (uint32_t) NULL ) != HAL_OK ){
monitor_errorHandler( MONITOR_CRITICAL_FAULT( 16 ) , 2 );
}
if( HAL_FDCAN_ActivateNotification( &hfdcan1 , FDCAN_IT_TX_COMPLETE , FDCAN_TX_BUFFER0|FDCAN_TX_BUFFER1|FDCAN_TX_BUFFER2 ) != HAL_OK ){
monitor_errorHandler( MONITOR_CRITICAL_FAULT( 16 ) , 3 );
}
/*
* Gestion Erreur CAN
*/
if( HAL_FDCAN_ActivateNotification( &hfdcan1 , FDCAN_IT_LIST_TX_FIFO_ERROR , (uint32_t) NULL ) != HAL_OK ){
monitor_errorHandler( MONITOR_CRITICAL_FAULT( 16 ) , 4 );
}
if( HAL_FDCAN_ActivateNotification( &hfdcan1 , FDCAN_IT_LIST_MISC , (uint32_t) NULL ) != HAL_OK ){
monitor_errorHandler( MONITOR_CRITICAL_FAULT( 16 ) , 5 );
}
if( HAL_FDCAN_ActivateNotification( &hfdcan1 , FDCAN_IT_LIST_BIT_LINE_ERROR | FDCAN_IT_GROUP_BIT_LINE_ERROR ,(uint32_t) NULL ) != HAL_OK ){
monitor_errorHandler( MONITOR_CRITICAL_FAULT( 16 ) , 6 );
}
if( HAL_FDCAN_ConfigGlobalFilter(&hfdcan1, FDCAN_REJECT, FDCAN_REJECT, FDCAN_REJECT_REMOTE, FDCAN_REJECT_REMOTE) != HAL_OK ){
monitor_errorHandler( MONITOR_CRITICAL_FAULT( 16 ) , 7 );
}
2022-04-19 06:21 AM
As for the initialisation code, the FDCAN1's clock is 110 MHz :
hfdcan1.Instance = FDCAN1;
hfdcan1.Init.ClockDivider = FDCAN_CLOCK_DIV1;
hfdcan1.Init.FrameFormat = FDCAN_FRAME_CLASSIC;
hfdcan1.Init.Mode = FDCAN_MODE_NORMAL;
hfdcan1.Init.AutoRetransmission = ENABLE;
hfdcan1.Init.TransmitPause = DISABLE;
hfdcan1.Init.ProtocolException = ENABLE;
hfdcan1.Init.NominalPrescaler = 2;
hfdcan1.Init.NominalSyncJumpWidth = 8;
hfdcan1.Init.NominalTimeSeg1 = 40;
hfdcan1.Init.NominalTimeSeg2 = 14;
hfdcan1.Init.DataPrescaler = 5;
hfdcan1.Init.DataSyncJumpWidth = 6;
hfdcan1.Init.DataTimeSeg1 = 16;
hfdcan1.Init.DataTimeSeg2 = 6;
hfdcan1.Init.StdFiltersNbr = 28;
hfdcan1.Init.ExtFiltersNbr = 0;
hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;
if (HAL_FDCAN_Init(&hfdcan1) != HAL_OK)
{
Error_Handler();
}