This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Hard fault in SystemInit_ExtMemCtl()

Hi

I hope someone here can help guide me.

I'm using a custom designed board which uses the same SDRAM memory configuration as the ST32429I-EVAL board.

In the Keil file system_stm32f427x.c I have uncommented

#define DATA_IN_ExtSRAM


so that the procedure SystemInit_ExtMemCtl() is called.

The very first line of this procedure is

/* Enable GPIOD, GPIOE, GPIOF and GPIOG interface clock */
RCC->AHB1ENR   = 0x00000078;

This line causes a hard fault after jumping back to system_stm32f427x.s and then trying to jump to __main.
If I comment that line out then the code jumps to __main with no problems.

The strange thing is, if I add a breakpoint to the line right after

// RCC->AHB1ENR   = 0x00000078;


and then change the RCC->AHB1ENR register manually so GPIOD, GPIOE, GPIOF and GPIOG interface clocks are enabled the code runs fine into __main.

Even though the code now runs I haven't got the external RAM to work yet so this may be part of a bigger problem or a configuration problem.

I'm using an old version of uVision V4.71.2.0 so does anyone know if there were bugs in the Keil provided system_stm32f427x.s and system_stm32f427x.c files?

Any help would be appreciated.

Thanks