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

Xtal is <undefined

Hi,

in MDK 3.40 Xtal is <undefined>.How can I solve this problem?

Parents
  • Hi,

    The definition provided above is not crucial, as you can configure it directly in your code.

    This configuration is specifically for the STM32F103C8 microcontroller, utilizing an 8 MHz external clock and setting the system frequency to 36 MHz. Please note that this information is based on my previous code, which I have copied here for reference.

    void CLOCK(void){
        
        RCC_DeInit();     
        
        RCC_LSICmd(ENABLE);
        while(RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == SET);
        
        RCC_HSEConfig(RCC_HSE_ON);
        
        while(RCC_WaitForHSEStartUp() != SUCCESS){}
            
                
        FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);    
        FLASH_SetLatency(FLASH_Latency_2);    
        
            
        RCC_HCLKConfig(RCC_SYSCLK_Div1);    
        RCC_PCLK1Config(RCC_HCLK_Div2);                         
        RCC_PCLK2Config(RCC_HCLK_Div1);                        
            
        
            
        RCC_PLLCmd(DISABLE);
            
        RCC_PLLConfig(RCC_PLLSource_HSE_Div2,RCC_PLLMul_12);
                    
        RCC_PLLCmd(ENABLE);
        
        while(RCC_GetFlagStatus( RCC_FLAG_PLLRDY)!=SET);
            
                
        RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
        
        while (RCC_GetSYSCLKSource() != 0x08){}
            
        FLASH_SetLatency(FLASH_Latency_1);    
        
    }

Reply
  • Hi,

    The definition provided above is not crucial, as you can configure it directly in your code.

    This configuration is specifically for the STM32F103C8 microcontroller, utilizing an 8 MHz external clock and setting the system frequency to 36 MHz. Please note that this information is based on my previous code, which I have copied here for reference.

    void CLOCK(void){
        
        RCC_DeInit();     
        
        RCC_LSICmd(ENABLE);
        while(RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == SET);
        
        RCC_HSEConfig(RCC_HSE_ON);
        
        while(RCC_WaitForHSEStartUp() != SUCCESS){}
            
                
        FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);    
        FLASH_SetLatency(FLASH_Latency_2);    
        
            
        RCC_HCLKConfig(RCC_SYSCLK_Div1);    
        RCC_PCLK1Config(RCC_HCLK_Div2);                         
        RCC_PCLK2Config(RCC_HCLK_Div1);                        
            
        
            
        RCC_PLLCmd(DISABLE);
            
        RCC_PLLConfig(RCC_PLLSource_HSE_Div2,RCC_PLLMul_12);
                    
        RCC_PLLCmd(ENABLE);
        
        while(RCC_GetFlagStatus( RCC_FLAG_PLLRDY)!=SET);
            
                
        RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
        
        while (RCC_GetSYSCLKSource() != 0x08){}
            
        FLASH_SetLatency(FLASH_Latency_1);    
        
    }

Children
No data