AnsweredAssumed Answered

why led blink when any clock source not selected?

Question asked by hossein hosseini on Oct 19, 2017
Latest reply on Oct 19, 2017 by ra hummel

hi,

on this code:

#include "stm32f10x.h"
#include "delay.h"

int main()
{   
 
  SystemInit ();

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA , ENABLE);  
    
  GPIO_InitTypeDef gpio;
  gpio.GPIO_Pin = GPIO_Pin_0;
  gpio.GPIO_Speed = GPIO_Speed_2MHz;
  gpio.GPIO_Mode = GPIO_Mode_Out_PP;
  GPIO_Init(GPIOA , &gpio);  
 
  while(1)
    
  {
    GPIOA->BSRR = GPIO_Pin_0;
    delay_ms(300);

    
    GPIOA->BSRR = (GPIO_Pin_0<<16);
    delay_ms(300);
  }
}

when there is SystemInit ();   , it work corrctly. 

and when  i delete the SystemInit ();  when the system clock not set , but the led blink and time is more then 300 ms , i dont know why the clock isnt set , but the led blink ??
i write RCC_LSICmd  ( DISABLE) ; to disable internal clock , but this CMD doesnt work , and the led still blink.

 

NOTE:

i want to understand how does the clock or RCC work in stm32 , for this , i try to test these ways.And i want to set the RCC myself.

 

 

so thanks.

Outcomes