cancel
Showing results for 
Search instead for 
Did you mean: 

HardFault when trying to access more than 128K DTCM on STM32N6 Nucleo Board.

IO1
Associate

Hello,

I am trying to extend DTCM to 256K. I followed FLEXMEM Configurations example but I get HardFault as soon as I try to access DTCM in 0x30020000 - 0x30040000 address range. 

Could someone please provide working example of how to extend DTCM to 256K?

3 REPLIES 3

"The FLEXMEM configuration depends upon CFGDTCMSZ[3:0] and CFGITCMSZ[3:0] in SYSCFG_CM55TCMCR. It configuration cannot be changed at runtime, a reboot is needed."

https://developer.arm.com/documentation/101051/0101/Signal-descriptions/Static-configuration-signals

https://github.com/STMicroelectronics/STM32CubeN6/blob/main/Projects/NUCLEO-N657X0-Q/Examples/SYSCFG/FLEXMEM_Configurations/README.md?plain=1

https://github.com/STMicroelectronics/STM32CubeN6/blob/main/Projects/NUCLEO-N657X0-Q/Examples/SYSCFG/FLEXMEM_Configurations/FSBL/Src/main.c#L100

The POWER-ON reset might be a challenge from the debugger.

Would suggest doing without it, perhaps instrument HardFault Handler via the USART, and have success/failure indicated by LEDs, so you can observe if it faults, or that it completed the access tests.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
RomainR.
ST Employee

Hello @IO1 

This discussion should help you. See the link below. 

https://community.st.com/t5/stm32-mcus-products/stm32n6-hard-fault-when-accessing-tcm/td-p/757557

Best regards,

Romain

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.

IO1
Associate

From FLEXMEM example. How is this code supposed to work? Am I missing something here?

Writing to DTCM_ADDRESS_BASE location DTCM_SIZE_WORD times. How would that prove 

that addresses other that  0x30000000 are accessible?

 

#define DTCM_ADDRESS_BASE 0x30000000
/* DTCM size in words : 256KB / 4 bytes per word */
#define DTCM_SIZE_WORD (256*1024 / 4 )

 

/* Show that memory access to DTCM is extended beyond the default 128KB */
for(int i = 0; i < DTCM_SIZE_WORD; i++)
{
uint32_t * dtcm_ptr = (uint32_t *) DTCM_ADDRESS_BASE;
*dtcm_ptr = 0xa5a5a5a5;
}

 

 
Thank you for your reply. I followed the discussion you posted and was able to use DTCM in the range of 0x30000000 to 0x30020000.
 
 However the attempt to  access the extended 0x30020000 - 0x30040000 region fails. Is there any additional FLEXMEM configuration needed? MPU? I use secure access. Again could you please confirm that I need to powercycle as there is no mention of it in the example.