AnsweredAssumed Answered

STM32f2xx HSI configuration does not work correctly

Question asked by khodarahmi.ehsan on Jul 1, 2013
Latest reply on Jul 1, 2013 by Clive One
I'm using below settings (in SystemInit function) to configure a STM32F215RG MCU to work at maximum speed (120MHZ) with USB support:

    RCC_DeInit(); 
    RCC_HSICmd(ENABLE); 
    while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET); 
 
    /* Flash 3 wait state, prefetch buffer and cache ON */ 
    FLASH_SetLatency(FLASH_Latency_3); 
    FLASH_PrefetchBufferCmd(ENABLE); 
    FLASH_InstructionCacheCmd(ENABLE); 
    FLASH_DataCacheCmd(ENABLE); 
 
    /* HCLK = SYSCLK */ 
    RCC_HCLKConfig(RCC_SYSCLK_Div1); 
    /* PCLK2 = HCLK/2 */ 
    RCC_PCLK2Config(RCC_HCLK_Div2); 
    /* PCLK1 = HCLK/4 */ 
    RCC_PCLK1Config(RCC_HCLK_Div4); 
    /* Configure the main PLL clock to 120 MHz */ 
    RCC_PLLConfig(RCC_PLLSource_HSI, PLL_M, PLL_N, PLL_P, PLL_Q); 
    /* Enable the main PLL */ 
    RCC_PLLCmd(ENABLE); 
    /* Wait till the main PLL is ready */ 
    while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET); 
 
    /* Select the main PLL as system clock source */ 
    RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK); 
 
    /* Wait till the main PLL is used as system clock source */ 
    while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);

& here are PLL config params:

#define PLL_M      16 
#define PLL_N      240 
 
#define PLL_P      2 
#define PLL_Q      5
But seems there is a problem with HSI because MCU does NOT start to work after restarting.
But when I configure it to use HSE instead (with 8MHZ crystal, PLL_M=8) the MCU works as expected.
Is there any mistake in my configuration?

Outcomes