Skip to main content
Mikk Leini
Senior
February 27, 2026
Question

SRAM3, 4, 5 and 6 clock enable missing in STM32CubeMX generated code

  • February 27, 2026
  • 2 replies
  • 317 views

Confirming that CubeMX loading problem has been fixed.

But I need to point out that RAMCFG enabling still comes with issue:

AXISRAM clocks enabling code is not generated. As I wrote in another post, clocks are partially enabled by RIF code: STM32N6 RIF and MMT autoconfiguration errors - STMicroelectronics Community

But AXISRAM3 clock is not enabled, so firmware halts. And power needs to be enabled also.

My workaround is to enable all the AXISRAM clocks and power in HAL_RAMCFG_MspInit:

void HAL_RAMCFG_MspInit(RAMCFG_HandleTypeDef* hramcfg)
{
 /* USER CODE BEGIN RAMCFG_MspInit 0 */

 /* USER CODE END RAMCFG_MspInit 0 */
 /* Peripheral clock enable */
 __HAL_RCC_RAMCFG_CLK_ENABLE();
 /* USER CODE BEGIN RAMCFG_MspInit 1 */

 /* AXI SRAM1-2 is already enabled by BootROM.
 * Enable AXI SRAM3-6 clocks manually because CubeMX doesn't do it. */
 __HAL_RCC_AXISRAM3_MEM_CLK_ENABLE();
 __HAL_RCC_AXISRAM4_MEM_CLK_ENABLE();
 __HAL_RCC_AXISRAM5_MEM_CLK_ENABLE();
 __HAL_RCC_AXISRAM6_MEM_CLK_ENABLE();

 /* Power the RAMs */
 RAMCFG_SRAM3_AXI_NS->CR &= ~RAMCFG_CR_SRAMSD;
 RAMCFG_SRAM4_AXI_NS->CR &= ~RAMCFG_CR_SRAMSD;
 RAMCFG_SRAM5_AXI_NS->CR &= ~RAMCFG_CR_SRAMSD;
 RAMCFG_SRAM6_AXI_NS->CR &= ~RAMCFG_CR_SRAMSD;

 /* USER CODE END RAMCFG_MspInit 1 */

}

Another issue is that this function is called 4 times from this path because there are 4 memory areas:

main() -> MX_RAMCFG_Init() +--> HAL_RAMCFG_Init() -> HAL_RAMCFG_MspInit()
+--> HAL_RAMCFG_Init() -> HAL_RAMCFG_MspInit()
+--> HAL_RAMCFG_Init() -> HAL_RAMCFG_MspInit()
\--> HAL_RAMCFG_Init() -> HAL_RAMCFG_MspInit()

 

It's not a big deal, but in embedded world feels a bit unclean.

Edit: Post moved from STM32N6 RIF and MMT autoconfiguration errors after after reporting same issue in this discussion.

2 replies

Technical Moderator
May 18, 2026

Hello @Mikk Leini 

Thank you for reporting and sharing the workaround.
I will raise this issue to the dedicated team for further review and fix.

BR, Souhaib

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Technical Moderator
May 19, 2026

Hello @Mikk Leini @unknown 

Thank you for sharing your feedback and workaround. This additional information is valuable and will assist our team in further investigating the issue.

This issue has been escalated to dedicated team for further investigationInternal ticket number: CDM0062749 (This is an internal tracking number and is not accessible or usable by customers.)

BR, Souhaib

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.