Skip to main content
Visitor II
August 22, 2025
Solved

FDCAN H5 Memory Access Failure

  • August 22, 2025
  • 1 reply
  • 529 views

I'm experiencing FDCAN Memory Access Failures on the STM32H503KBUX during CAN Rx. 

I am also experiencing intermittent CAN Rx message drops (every 1 in a 200), and I believe the two are related since no others errors are firing. I know the drops are happening on the STM32 because I can see the messages on the bus with my CAN debugger and there are no error frames. 

I'm struggling to understand why this Memory access error is happening and how to proceed with solving it. The only info I can find is in rm0492. However, it doesnt really say what might cause these events to happen. 

dnugent_0-1755890008288.png

Other relevant info:

- Using internal clock
- Freertos

- Using to `HAL_FDCAN_RxFifo0Callback` to read from FIFO

- Config

 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 = ENABLE;
 hfdcan1.Init.ProtocolException = ENABLE;
 hfdcan1.Init.NominalPrescaler = 16;
 hfdcan1.Init.NominalSyncJumpWidth = 128;
 hfdcan1.Init.NominalTimeSeg1 = 13;
 hfdcan1.Init.NominalTimeSeg2 = 2;
 hfdcan1.Init.DataPrescaler = 1;
 hfdcan1.Init.DataSyncJumpWidth = 16;
 hfdcan1.Init.DataTimeSeg1 = 1;
 hfdcan1.Init.DataTimeSeg2 = 1;
 hfdcan1.Init.StdFiltersNbr = 1;
 hfdcan1.Init.ExtFiltersNbr = 1;
 hfdcan1.Init.TxFifoQueueMode = FDCAN_TX_FIFO_OPERATION;

- Using a filter

void can_setupFilter(void) {
	FDCAN_FilterTypeDef sFilterConfig;
	sFilterConfig.IdType = FDCAN_EXTENDED_ID;
	sFilterConfig.FilterIndex = 0;
	sFilterConfig.FilterType = FDCAN_FILTER_RANGE;
	sFilterConfig.FilterConfig = FDCAN_FILTER_TO_RXFIFO0;
	sFilterConfig.FilterID1 = 0;
	sFilterConfig.FilterID2 = 0x1FFFFFFF;

	if (HAL_FDCAN_ConfigFilter(canPtr, &sFilterConfig) != HAL_OK) {
		Error_Handler();
	}
}

Happy to share additional details upon request.

 

Any ideas on how to debug or fix this issue?

Best,

Daniel

 

 

    This topic has been closed for replies.
    Best answer by dnugent

    I found the issue. It was a slow clock speed issue. 

     

    The FDCAN peripheral has 2 clocks: the FDCAN kernel clock controls the bit timing and APB1 controls the RX handler (and other stuff). It was the APB1 clock being too slow and not running the acceptance filter fast enough. It was clocked at 32Mhz so I upped it to 128Mhz and that fixed the issue.

     

    I did end up keeping FDCAN kernel clock at 100Mhz because we have other projects running at this speed so I kept it high. 

    1 reply

    Technical Moderator
    August 25, 2025

    Hello,


    @dnugent wrote:

    - Using internal clock


    1- Not recommended. Please use a crystal or other precise source of clock.

     


    @dnugent wrote:

    - Freertos


    2- Better to do the test without RTOS.

    3- Try to increase the value of the extended filter number:

     hfdcan1.Init.ExtFiltersNbr

     

    dnugentAuthor
    Visitor II
    August 26, 2025

    Thank you for your response!

    Increasing filter number did not help.

     

    I was able to subdue the MRAF error by creating a new barebone project, however, I still have packet drops. 

     

    The new bare bones project just has FDCAN enabled and no FreeRTOS. Im sending a fixed number of messages from a working STM32 and counting them with my CAN debugger and the H5. This new project still has a drop rate of 1 in 200.

     

    I've ordered a dev board to see if the external oscillator helps. I will report back with my findings.

     

    Thanks,

    Daniel

    dnugentAuthor
    Visitor II
    August 26, 2025

    I misspoke, the MRAF error is still firing with the barebones project.