cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H750 XiP Clock change

ESawa.1
Senior

Hey together, 

I have a question regarding changing the clock while running in XiP mode. Upfront everything works so far very well. 

On our STM32H750 we have a very simple bootloader. This bootloader configures the QSPI and the STM32H7 to run the appliction code in XIP. Therefore we configure the QSPI clock to use the HCLK3 in the bootloader. We use an external crystal 8MHz and the PLL as SYSCLK to generate the 240MHz for the HCLK3. Then we jump to the application code. 

The applicaiton code resets the System Clock Mux in the startup code calling "SystemInit ()" inside the system_stm32h7xx.c to use the HSI (64MHz) for SYSCLK. This results at first in a drop of external crystal signal as well as a clock drop of the QSPI Clock from 240MHz to 64MHz. Then we reconfigure in the application code, while running in XiP, the System Clock Mux to use the external crystal and the PLL. Going back to the 240MHz for the QSPI. 

So far this seems to work perfectly fine, as there is always a clock present on the QSPI and we do not stuck or so. The question is: Can we keep this as it is? Otherwise we would have to prevent the clock reset inside the "SystemInit()" function somehow. Regenerating via CubeMX will then overwrite this part i guess. 

 

ESawa1_0-1761134946554.png

Best regards,

Eric 

1 REPLY 1
AScha.3
Super User

Hi,

is the basic code generated from Cube or IDE?

-

Because in my (generated) code is no new clock switching...

SystemInit () is just :

void SystemInit(void)
{
  /* Configure the Vector Table location -------------------------------------*/
  SCB->VTOR = INTVECT_START;

  /* FPU settings ------------------------------------------------------------*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
  SCB->CPACR |= ((3UL << 20U)|(3UL << 22U));  /* set CP10 and CP11 Full Access */
#endif
}
If you feel a post has answered your question, please click "Accept as Solution".