2024-03-22 02:13 AM
Hi, guys:
I want to excute code from sdram with stm32h747i-DISCO board,but it run into MemManager Fault.
I read the AN5188,but find no example for stm32h747i-DISCO board. So I build 2 projects to test with this board.
First project is the "bootloader" ,it copy the "application" bin from SDCard to SDRAM(0xD0000000).I refer to the codes from ExtMem_Boot demo for Stm32h750 board.
Second project is the "application",it's only toggle the LED. I refer to the codes from LedTogging Demo for Stm23h743 board,especially the linker script code and the startup code, I change the FLASH ORIGIN to 0xD0000000.
When I debug the bootloader , it's run into MemManage_Handler.
When I change the MPU DisableExec config(for 0xD0000000) to MPU_INSTRUCTION_ACCESS_ENABLE , it's run into HardFault_Handler. So i think the MPU allow the excute ,but what else block the excute.
I want to know what may case this , is stm32h747 support excute code from SDRAM,and Is there a demo code for this board?
Thanks everyone.
Solved! Go to Solution.
2024-03-22 02:22 AM - edited 2024-03-25 12:17 AM
Hello,
Are you sure your SDRAM interface / GPIOs pins are well configured? Start by doing write operations to SDRAM and read back its content to unsure that the HW and Software config are OK (you can inspire from the BSP SDRAM driver of the board here). You must succeed this test before going further (disable the cache for this test).
There is no demo for this board but there is a demo from X-CUBE-PERF-H7 (related to the AN4891). / see the config 10 - D1_SDRAM_Swapped - D1_DTCM : execution from SDRAM / Data in DTCM
Loot at system_stm32h7xx.c / especially the function SystemInit_ExtMemCtl() where the external memories on FMC and QSPI are configured.
H743 and H747 are the same die. You need to adapt this example to your board.
PS: read AN4891 for more detail.
2024-03-22 02:22 AM - edited 2024-03-25 12:17 AM
Hello,
Are you sure your SDRAM interface / GPIOs pins are well configured? Start by doing write operations to SDRAM and read back its content to unsure that the HW and Software config are OK (you can inspire from the BSP SDRAM driver of the board here). You must succeed this test before going further (disable the cache for this test).
There is no demo for this board but there is a demo from X-CUBE-PERF-H7 (related to the AN4891). / see the config 10 - D1_SDRAM_Swapped - D1_DTCM : execution from SDRAM / Data in DTCM
Loot at system_stm32h7xx.c / especially the function SystemInit_ExtMemCtl() where the external memories on FMC and QSPI are configured.
H743 and H747 are the same die. You need to adapt this example to your board.
PS: read AN4891 for more detail.
2024-03-24 09:00 PM
Thanks for reply.
Finally,I find the key. It's really about the SDRAM config.
In the " application" project created normally through the wizard. In the SystemInit function, there is an operation to disable the SDRAM. The comment writes "This prevents CPU speculation access on this bank which blocks the use of FMC during 24us" . But It's not import for the jump "application".
FMC_Bank1_R->BTCR[0] = 0x000030D2;
Comment out this line , everything works fine.