• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ RCC_PCLK2Config函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中RCC_PCLK2Config函数的典型用法代码示例。如果您正苦于以下问题:C++ RCC_PCLK2Config函数的具体用法?C++ RCC_PCLK2Config怎么用?C++ RCC_PCLK2Config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了RCC_PCLK2Config函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: RCC_Configuration

/*******************************************************************************
 * Function Name  : RCC_Configuration
 * Description    : Configures the different system clocks.
 * Input          : None
 * Output         : None
 * Return         : None
 *******************************************************************************/
void RCC_Configuration(void)
{
	/* RCC system reset(for debug purpose) */
	RCC_DeInit();

	/* Enable HSE */
	RCC_HSEConfig(RCC_HSE_ON);

	/* Wait till HSE is ready */
	HSEStartUpStatus = RCC_WaitForHSEStartUp();

	if(HSEStartUpStatus == SUCCESS)
	{
		/* Enable Prefetch Buffer */
		FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);

		/* Flash 2 wait state */
		FLASH_SetLatency(FLASH_Latency_2);

		/* HCLK = SYSCLK */
		RCC_HCLKConfig(RCC_SYSCLK_Div1);

		/* PCLK2 = HCLK */
		RCC_PCLK2Config(RCC_HCLK_Div1);

		/* PCLK1 = HCLK/2 */
		RCC_PCLK1Config(RCC_HCLK_Div2);

		/* PLLCLK = 8MHz * 9 = 72 MHz */
		RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);

		/* Enable PLL */
		RCC_PLLCmd(ENABLE);

		/* Wait till PLL is ready */
		while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) {}

		/* Select PLL as system clock source */
		RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

		/* Wait till PLL is used as system clock source */
		while(RCC_GetSYSCLKSource() != 0x08) {}
	}

	/* PCLK2 = HCLK/2 */
	RCC_PCLK2Config(RCC_HCLK_Div2);

	//enable AFIO clock
    	RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);

	/* Enable GPIO clock for SPIz */
	RCC_APB2PeriphClockCmd(SPIz_GPIO_CLK | RCC_APB2Periph_AFIO, ENABLE);

	/* Enable SPIz Periph clock */
	RCC_APB1PeriphClockCmd(SPIz_CLK, ENABLE);
}
开发者ID:pavelruban-org,项目名称:arm,代码行数:63,代码来源:c_entry.cpp


示例2: RCC_Configuration

void RCC_Configuration(void)
{
    RCC_DeInit();
    {
        RCC_HCLKConfig(RCC_SYSCLK_Div1);
        RCC_PCLK1Config(RCC_HCLK_Div2);
        RCC_PCLK2Config(RCC_HCLK_Div1);
        RCC_ADCCLKConfig(RCC_PCLK2_Div6);
        FLASH_SetLatency(FLASH_Latency_2);
        FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
        RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_16);
        RCC_PLLCmd(ENABLE);
        while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
        RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
        while(RCC_GetSYSCLKSource()!=0x08);
    }

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOC, ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM4, ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM1, ENABLE);//72
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);//36
}
开发者ID:alvinyeats,项目名称:Quadrotor-Rebuilding,代码行数:27,代码来源:rcc.c


示例3: RCC_Configuration

//配置系统时钟
void RCC_Configuration(void)
{
	ErrorStatus HSEStartUpStatus;                    //定义外部高速晶体启动状态枚举变量

	RCC_DeInit();                                    //复位RCC外部设备寄存器到默认值
	RCC_HSEConfig(RCC_HSE_ON);                       //打开外部高速晶振
	HSEStartUpStatus = RCC_WaitForHSEStartUp();      //等待外部高速时钟准备好
	if(HSEStartUpStatus == SUCCESS)                  //外部高速时钟已经准别好
	{
		FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable); //开启FLASH预读缓冲功能,加速FLASH的读取。所有程序中必须的用法.位置:RCC初始化子函数里面,时钟起振之后
		FLASH_SetLatency(FLASH_Latency_2);                    //flash操作的延时
			
		RCC_HCLKConfig(RCC_SYSCLK_Div1);               //配置AHB(HCLK)时钟等于==SYSCLK
		RCC_PCLK2Config(RCC_HCLK_Div1);                //配置APB2(PCLK2)钟==AHB时钟
		RCC_PCLK1Config(RCC_HCLK_Div2);                //配置APB1(PCLK1)钟==AHB1/2时钟
			 
		RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);  //配置PLL时钟 == 外部高速晶体时钟 * 9 = 72MHz
		RCC_PLLCmd(ENABLE);                                   //使能PLL时钟
   
		while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)    //等待PLL时钟就绪
		{
		}
		RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);            //配置系统时钟 = PLL时钟
		while(RCC_GetSYSCLKSource() != 0x08)                  //检查PLL时钟是否作为系统时钟
		{
		}
	}
}
开发者ID:catoffly,项目名称:TI_KONG,代码行数:29,代码来源:sys.c


示例4: SetSysClockToHSE

/**
  * @brief  Selects HSE as System clock source and configure HCLK, PCLK2
  *   and PCLK1 prescalers. 
  * @param  None
  * @retval None
  */
void SetSysClockToHSE(void)
{
  /* SYSCLK, HCLK, PCLK2 and PCLK1 configuration -----------------------------*/   
  /* RCC system reset(for debug purpose) */
  RCC_DeInit();

  /* Enable HSE */
  RCC_HSEConfig(RCC_HSE_ON);

  /* Wait till HSE is ready */
  HSEStartUpStatus = RCC_WaitForHSEStartUp();

  if (HSEStartUpStatus == SUCCESS)
  {
    /* Enable Prefetch Buffer */
    FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);

#ifndef STM32F10X_CL
    /* Flash 0 wait state */
    FLASH_SetLatency(FLASH_Latency_0);
#else
    if (HSE_Value <= 24000000)
	{
      /* Flash 0 wait state */
      FLASH_SetLatency(FLASH_Latency_0);
	}
	else
	{
      /* Flash 1 wait state */
      FLASH_SetLatency(FLASH_Latency_1);
	}
#endif /* STM32F10X_CL */
 
    /* HCLK = SYSCLK */
    RCC_HCLKConfig(RCC_SYSCLK_Div1); 
  
    /* PCLK2 = HCLK */
    RCC_PCLK2Config(RCC_HCLK_Div1); 

    /* PCLK1 = HCLK */
    RCC_PCLK1Config(RCC_HCLK_Div1);

    /* Select HSE as system clock source */
    RCC_SYSCLKConfig(RCC_SYSCLKSource_HSE);

    /* Wait till PLL is used as system clock source */
    while (RCC_GetSYSCLKSource() != 0x04)
    {
    }
  }
  else
  { /* If HSE fails to start-up, the application will have wrong clock configuration.
       User can add here some code to deal with this error */    

    /* Go to infinite loop */
    while (1)
    {
    }
  }
}
开发者ID:DerekTan,项目名称:STM32F107_ucosIII,代码行数:66,代码来源:main.c


示例5: main

int main(void) {
  /* Configure Clocks (GPIO and DMA clocks already enabled by startup.c) */
  RCC_PCLK2Config(RCC_HCLK_Div2);
  RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_1Div5);
  RCC_APB2PeriphClockCmd(    SPI_ENGINE_RCC, ENABLE);
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE);

  /* Configure On-board LED */
  GPIO_Init(PORT_LED, &GPIO_InitStructure_LED);

  /* Configure SPI Port */
  GPIO_Init(   GPIOA, &GPIO_InitStructure_SPIOUT);
  GPIO_Init(   GPIOA, &GPIO_InitStructure_SPIIN);
  GPIO_Init( PORT_SS, &GPIO_InitStructure_SPISS);

  /* Configure SPI Engine with DMA */
  spi_conf(SPI_DEFAULT_SPEED);

  /* Configure USB Interrupt */
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
  NVIC_Init(&NVIC_InitStructure);

  /* Enable all peripherals */
  USB_Init();

  /* Main loop */
  while(1) {
    /* Get command */
    serprog_handle_command(usb_getc());
    /* Flush output via USB */
    usb_sync();
  }

  return 0;
}
开发者ID:peterwillcn,项目名称:serprog-stm32vcp,代码行数:35,代码来源:serprog.c


示例6: RCC_Configuration

void RCC_Configuration(void)
{   
  
  RCC_DeInit();										// RCC system reset(for debug purpose) 
	RCC_HSEConfig(RCC_HSE_ON);			// Enable HSE 
	HSEStartUpStatus = RCC_WaitForHSEStartUp();		// Wait till HSE is ready 

  if(HSEStartUpStatus == SUCCESS)
  {
		FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable); //开启FLASH预读缓冲功能,加速FLASH的读取。所有程序中必须的用法.位置:RCC初始化子函数里面,时钟起振之后
    FLASH_SetLatency(FLASH_Latency_2);                    //flash操作的延时
    
    RCC_HCLKConfig(RCC_SYSCLK_Div1); 			//HCLK = SYSCLK 
		RCC_PCLK2Config(RCC_HCLK_Div1);  			// PCLK2 = HCLK 
		RCC_PCLK1Config(RCC_HCLK_Div2);				// PCLK1 = HCLK/2 
		FLASH_SetLatency(FLASH_Latency_2); 		// Flash 2 wait state 
		FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable); 		// Enable Prefetch Buffer 
		RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);			// PLLCLK = 8MHz * 9 = 72 MHz 
		RCC_PLLCmd(ENABLE);			// Enable PLL 

		while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) 				// Wait till PLL is ready 
    {
    }
		RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);								// Select PLL as system clock source 
		while(RCC_GetSYSCLKSource() != 0x08)											// Wait till PLL is used as system clock source 
    {
    }
  } 
	
	
}
开发者ID:moranzcw,项目名称:QuadCopter,代码行数:31,代码来源:rcc_conf.c


示例7: Set_System

/*******************************************************************************
 * System Clock Configuration
 *******************************************************************************/
void Set_System(void)
{
	RCC_DeInit();
	RCC_HSEConfig(RCC_HSE_ON);
	HSEStartUpStatus = RCC_WaitForHSEStartUp();
	if(HSEStartUpStatus == SUCCESS)
	{
		FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
		FLASH_SetLatency(FLASH_Latency_2);    //Flash 2 wait state
		RCC_HCLKConfig(RCC_SYSCLK_Div1);      //HCLK = SYSCLK
		RCC_PCLK2Config(RCC_HCLK_Div1);       //PCLK2 = HCLK
		RCC_PCLK1Config(RCC_HCLK_Div2);       //PCLK1 = HCLK/2
		RCC_ADCCLKConfig(RCC_PCLK2_Div4);     //ADCCLK = PCLK2/4 = 18MHz
		RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);  //PLLCLK = 72 MHz
		RCC_PLLCmd(ENABLE);
		while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET){}
		RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
		while(RCC_GetSYSCLKSource()!=0x08){}
	}
	RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA, ENABLE);

	RCC_APB2PeriphClockCmd(
	                       RCC_APB2Periph_ADC1  | RCC_APB2Periph_ADC2  | RCC_APB2Periph_GPIOA |
	                       RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOD |
	                       RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO  | RCC_APB2Periph_TIM1, ENABLE);

	RCC_APB1PeriphClockCmd(
	                       RCC_APB1Periph_TIM2 | RCC_APB1Periph_TIM3 | RCC_APB1Periph_TIM4 |
	                       RCC_APB1Periph_SPI2, ENABLE);

	RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_1Div5);     //USBCLK = 48MHz
	RCC_APB1PeriphClockCmd(RCC_APB1Periph_USB, ENABLE);  //Enable USB clock

}
开发者ID:thinrope,项目名称:Nano_MCA,代码行数:37,代码来源:HW_V1_Config.c


示例8: RCC_Config

void RCC_Config(void)
//konfigurowanie sygnalow taktujacych
{
  ErrorStatus HSEStartUpStatus;  //zmienna opisujaca rezultat uruchomienia HSE

  RCC_DeInit();	                                         //Reset ustawien RCC
  RCC_HSEConfig(RCC_HSE_ON);                             //Wlaczenie HSE
  HSEStartUpStatus = RCC_WaitForHSEStartUp();		         //Odczekaj az HSE bedzie gotowy
  if(HSEStartUpStatus == SUCCESS)
  {
    FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);//
    FLASH_SetLatency(FLASH_Latency_2);                   //ustaw zwloke dla pamieci Flash; zaleznie od taktowania rdzenia
	                                                       //0:<24MHz; 1:24~48MHz; 2:>48MHz
    RCC_HCLKConfig(RCC_SYSCLK_Div1);                     //ustaw HCLK=SYSCLK
    RCC_PCLK2Config(RCC_HCLK_Div1);                      //ustaw PCLK2=HCLK
    RCC_PCLK1Config(RCC_HCLK_Div2);                      //ustaw PCLK1=HCLK/2
    RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9); //ustaw PLLCLK = HSE*9 czyli 8MHz * 9 = 72 MHz
    RCC_PLLCmd(ENABLE);                                  //wlacz PLL
    while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);  //odczekaj na poprawne uruchomienie PLL
    RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);           //ustaw PLL jako zrodlo sygnalu zegarowego
    while(RCC_GetSYSCLKSource() != 0x08);                //odczekaj az PLL bedzie sygnalem zegarowym systemu

	/*Tu nalezy umiescic kod zwiazany z konfiguracja sygnalow zegarowych potrzebnych w programie peryferiow*/
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);//wlacz taktowanie portu GPIO A
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);//wlacz taktowanie portu GPIO B
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);//wlacz taktowanie portu GPIO C
  	RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1, ENABLE); //wlacz taktowanie SPI        
    //RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); //wlacz taktowanie funkcji alternatywnych GPIO

  } else {
  } 
}
开发者ID:develorn,项目名称:ARM_function_kamami,代码行数:32,代码来源:main.c


示例9: RCC_Config_HSI_PLL_Max

void RCC_Config_HSI_PLL_Max(void){
RCC_DeInit();
FLASH_SetLatency(FLASH_Latency_2);

/*configurar clock a 64Mhz (max)*/




//divisão do prescaler AHB por 1
RCC_HCLKConfig(RCC_SYSCLK_Div1);
//divisão do prescaler APB1 por 2
RCC_PCLK1Config(RCC_HCLK_Div2);
//divisão do prescaler APB2 por 1
RCC_PCLK2Config(RCC_HCLK_Div1);
//é usado a PLL com a source HSI (clock interno) e 16 de factor multiplicativo
RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_16);

//depois de configurado a PLL fazer enable
RCC_PLLCmd(ENABLE);
while(RCC_GetFlagStatus( RCC_FLAG_PLLRDY)==RESET);

RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
//garantir que o clock da pll está correcto
while(RCC_GetSYSCLKSource()!=0x08);




}
开发者ID:flv1991,项目名称:STM32_LAMEC_CAN,代码行数:30,代码来源:1100419_TIMER_main.c


示例10: sysclockInit

uint8_t sysclockInit(void)
{
    ErrorStatus HSEStartUpStatus;
	
    RCC_DeInit();/* RCC重置 */
    RCC_HSEConfig(RCC_HSE_ON); /*使能HSE*/
    HSEStartUpStatus = RCC_WaitForHSEStartUp();
    if(HSEStartUpStatus == SUCCESS)   //外部晶振使能成功
    {
        RCC_HCLKConfig(RCC_SYSCLK_Div1); /* 配置HCLK = SYSCLK */
        RCC_PCLK2Config(RCC_HCLK_Div1); /* 配置PCLK2 = HCLK */
        RCC_PCLK1Config(RCC_HCLK_Div2); /* 配置PCLK1 = HCLK/2 */

        FLASH_SetLatency(FLASH_Latency_2);
        FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
		
        RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);  /* RCC_PLLSource_HSE_Div1为外置晶振的分频系数;RCC_PLLMul_9为倍频数 */
        RCC_PLLCmd(ENABLE);
        while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET); //等待pll工作
        RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);   /* 选定PLL为系统主时钟 */
        while(RCC_GetSYSCLKSource() != 0x08); //判断pll是否为系统时钟
		return 1;

	}
	else
		return 0;
}
开发者ID:ninfeion,项目名称:BBFLIGHT_FIRMWARE_3.0_KEIL,代码行数:27,代码来源:systeminit.c


示例11: SetHSICLK

/**
  * @brief  To select HSI as System clock source 
  * @caller ADC_Icc_Test
  * @param None
  * @retval None
  */
void SetHSICLK(void)
{
  /* Enable HSI Clock */
  RCC_HSICmd(ENABLE);
  
  /*!< Wait till HSI is ready */
  while (RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET);
  
  /* Enable 64-bit access */
  FLASH_ReadAccess64Cmd(ENABLE);
  
  /* Enable Prefetch Buffer */
  FLASH_PrefetchBufferCmd(ENABLE);
  
  /* Flash 1 wait state */
  FLASH_SetLatency(FLASH_Latency_1);
  
  RCC_SYSCLKConfig(RCC_SYSCLKSource_HSI);
  
  while (RCC_GetSYSCLKSource() != 0x04);
      
  RCC_HCLKConfig(RCC_SYSCLK_Div1);  
  /* PCLK2 = HCLK */
  RCC_PCLK2Config(RCC_HCLK_Div1);

  /* PCLK1 = HCLK */
  RCC_PCLK1Config(RCC_HCLK_Div1);    
 
}
开发者ID:bzdegluk,项目名称:ACQ,代码行数:35,代码来源:icc_measure.c


示例12: init_HSI_24MHz

void init_HSI_24MHz(void) {
	/* RCC system reset(for debug purpose) */
	RCC_DeInit();
	/* Enable Prefetch Buffer */
	FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
	/* Flash 2 wait state */
	FLASH_SetLatency(FLASH_Latency_2);
	/* HCLK = SYSCLK */
	RCC_HCLKConfig(RCC_SYSCLK_Div1);
	/* PCLK2 = HCLK */
	RCC_PCLK2Config(RCC_HCLK_Div1);
	/* PCLK1 = HCLK/2 */
	RCC_PCLK1Config(RCC_HCLK_Div2);
	/* ADCCLK = PCLK2/6 10.67MHz */
	RCC_ADCCLKConfig(RCC_PCLK2_Div2);
	/* PLLCLK = 4MHz * 6 = 24 MHz */
	RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_6);
	/* Enable PLL */
	RCC_PLLCmd(ENABLE);
	/* Wait till PLL is ready */
	while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
	/* Select PLL as system clock source */
	RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
	/* Wait till PLL is used as system clock source */
	while(RCC_GetSYSCLKSource() != 0x08);
}
开发者ID:khiewty,项目名称:STM32F10xCx_BreakoutBoard,代码行数:26,代码来源:main.c


示例13: RCC_Configuration

/*
********************************************************************************
** 函数名称 : RCC_Configuration(void)
** 函数功能 : 时钟初始化
** 输    入	: 无
** 输    出	: 无
** 返    回	: 无
********************************************************************************
*/
void RCC_Configuration(void)
{   
 	RCC_DeInit();

    RCC_HSEConfig(RCC_HSE_ON);
    HSEStartUpStatus = RCC_WaitForHSEStartUp();
    if(HSEStartUpStatus == SUCCESS)
    {
      FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
      FLASH_SetLatency(FLASH_Latency_2);
      RCC_HCLKConfig(RCC_SYSCLK_Div1);
      RCC_PCLK2Config(RCC_HCLK_Div1);
      RCC_PCLK1Config(RCC_HCLK_Div2);
      RCC_PLLConfig(RCC_PLLSource_HSE_Div1,RCC_PLLMul_9);

      RCC_PLLCmd(ENABLE);

      while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY)==RESET)
      {
       }

      RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
      
      while(RCC_GetSYSCLKSource() != 0x08)
      {
       }
      
     }
      
}
开发者ID:fjbali,项目名称:stm32-diy,代码行数:39,代码来源:bsp.c


示例14: Hdriver_init

/*******************************************************************************
* Function Name  : Set_System
* Description    : Configures Main system clocks & power
* Input          : None.
* Return         : None.
*******************************************************************************/
void Hdriver_init(void)
{
//  GPIO_InitTypeDef GPIO_InitStructure;

  /* Setup the microcontroller system. Initialize the Embedded Flash Interface,  
     initialize the PLL and update the SystemFrequency variable. */
	SystemInit();
  	RCC_PCLK1Config(RCC_HCLK_Div1);			//设置低速AHB时钟
  	RCC_PCLK2Config(RCC_HCLK_Div1);			//设置高速AHB时钟
	JTAG_Set(SWD_ENABLE);		//加
  
  /* Enable GPIOA, GPIOD and USART1 clock */
//  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOD, ENABLE);

  /* Enable USB_DISCONNECT GPIO clock */
//  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIO_DISCONNECT, ENABLE);
  /* Configure USB pull-up pin */
//  GPIO_InitStructure.GPIO_Pin = USB_DISCONNECT_PIN;
//  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
//  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;	//改
//  GPIO_Init(USB_DISCONNECT, &GPIO_InitStructure);

/*
  // Configure USART1 Rx (PA.10) as input floating 
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
  GPIO_Init(GPIOA, &GPIO_InitStructure);

  // Configure USART1 Tx (PA.09) as alternate function push-pull 
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  GPIO_Init(GPIOA, &GPIO_InitStructure);
*/
}
开发者ID:fanqh,项目名称:stm32f103_RFID-cola-,代码行数:41,代码来源:hw_config-.c


示例15: RCC_Configuration

void RCC_Configuration(void)
{
	RCC_DeInit ();                        /* RCC system reset(for debug purpose)*/
	RCC_HSEConfig (RCC_HSE_ON);           /* Enable HSE */
	
	/* Wait till HSE is ready */
	while (RCC_GetFlagStatus(RCC_FLAG_HSERDY) == RESET);
	
	RCC_HCLKConfig   (RCC_SYSCLK_Div1);   /* HCLK   = SYSCLK  */
	RCC_PCLK2Config  (RCC_HCLK_Div1);     /* PCLK2  = HCLK    */
	RCC_PCLK1Config  (RCC_HCLK_Div1);     /* PCLK1  = HCLK/2  */
	
	FLASH_SetLatency(FLASH_Latency_2);    /* Flash 2 wait state */
	FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
	
	/* PLLCLK = 8MHz * 9 = 72 MHz */
	RCC_PLLConfig (RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
	
	RCC_PLLCmd (ENABLE);                  /* Enable PLL */
	
	/* Wait till PLL is ready */
	while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
	
	/* Select PLL as system clock source */
	RCC_SYSCLKConfig (RCC_SYSCLKSource_PLLCLK);
	
	/* Wait till PLL is used as system clock source */
	while (RCC_GetSYSCLKSource() != 0x08);
}
开发者ID:bg8wj,项目名称:icar-firmware,代码行数:29,代码来源:init.c


示例16: RCC_Config_HSE_Default

void RCC_Config_HSE_Default(void){
RCC_DeInit();
/*configurar clock externo a 12Mhz */
//bypass pois está ligado no OSC_IN um circuito oscilatorio externo
RCC_HSEConfig(RCC_HSE_Bypass);
//Após a ativação do HSE deveremos esperar até que o sinal de relógio esteja pronto e estável
ErrorStatus HSEStartUpStatus;
HSEStartUpStatus=RCC_WaitForHSEStartUp();

if(HSEStartUpStatus==SUCCESS) /*retorna SUCCESS ou ERROR*/
{

//divisão do prescaler AHB por 1
RCC_HCLKConfig(RCC_SYSCLK_Div1);
//divisão do prescaler APB1 por 1
RCC_PCLK1Config(RCC_HCLK_Div1);
//divisão do prescaler APB2 por 1
RCC_PCLK2Config(RCC_HCLK_Div1);

    //arrancar com o clock externo
    RCC_SYSCLKConfig(RCC_SYSCLKSource_HSE);

    //confirmar que o clock está correcto logo esperar que a fonte de relógio esteja correta
    while(RCC_GetSYSCLKSource()!=0x04);
    //clock configurado com sucesso 
}
else
 while(1); /*se deu erro o micro nao arranca*/

}
开发者ID:flv1991,项目名称:STM32_LAMEC_CAN,代码行数:30,代码来源:1100419_TIMER_main.c


示例17: RCC_Configuration

/************************************************************************************************
** Function name :			
** Description :配置48M系统时钟
** RCC配置(使用外部8MHz晶振),6倍频
** Input :
** Output :
** Return :
** Others :
** 
************************************************************************************************/
void RCC_Configuration(void)
{	
	ErrorStatus HSEStartUpStatus;
  	//SystemInit(); 
	/*将外设RCC寄存器重设为缺省值 */   
	RCC_DeInit();
	/*设置外部高速晶振(HSE)*/    
	RCC_HSEConfig(RCC_HSE_ON);   //RCC_HSE_ON——HSE晶振打开(ON)     
	/*等待HSE起振*/    
	HSEStartUpStatus = RCC_WaitForHSEStartUp();     
	if(HSEStartUpStatus == SUCCESS){      //SUCCESS:HSE晶振稳定且就绪 
	/*设置AHB时钟(HCLK)*/       
	RCC_HCLKConfig(RCC_SYSCLK_Div1);  //RCC_SYSCLK_Div1——AHB时钟 = 系统时钟        
	/* 设置高速AHB时钟(PCLK2)*/      
	RCC_PCLK2Config(RCC_HCLK_Div1); //RCC_HCLK_Div1——APB2时钟 = HCLK        
	/*设置低速AHB时钟(PCLK1)*/      
	RCC_PCLK1Config(RCC_HCLK_Div2);   //RCC_HCLK_Div2——APB1时钟 = HCLK /  2       
	/*设置FLASH存储器延时时钟周期数*/      
	FLASH_SetLatency(FLASH_Latency_2);    //FLASH_Latency_2  2延时周期       
	/*选择FLASH预取指缓存的模式*/       
	FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable); // 预取指缓存使能       
	/*设置PLL时钟源及倍频系数*/       
	RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_6);  // PLL的输入时钟 = HSE时钟频率;RCC_PLLMul_5——PLL输入时钟x 5         
	/*使能PLL */      
	RCC_PLLCmd(ENABLE);        
	/*检查指定的RCC标志位(PLL准备好标志)设置与否*/        
	while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET){        
	}       
	/*设置系统时钟(SYSCLK) */       
	RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);   //RCC_SYSCLKSource_PLLCLK——选择PLL作为系统时钟       
	/* PLL返回用作系统时钟的时钟源*/      
	while(RCC_GetSYSCLKSource() != 0x08);   //0x08:PLL作为系统时钟         {         }      
	}     
}
开发者ID:FreedomSnail,项目名称:STM32F103_BOOT_USB_AES,代码行数:44,代码来源:bsp.c


示例18: RCC_Configuration

void RCC_Configuration(void)
{
    ErrorStatus HSEStartupStatus;
    RCC_DeInit();
    RCC_HSEConfig(RCC_HSE_ON);
    HSEStartupStatus = RCC_WaitForHSEStartUp();

    if(HSEStartupStatus == SUCCESS)
    {
        RCC_HCLKConfig(RCC_SYSCLK_Div1);
        RCC_PCLK2Config(RCC_HCLK_Div1);
        RCC_PCLK1Config(RCC_HCLK_Div2);
        FLASH_SetLatency(FLASH_Latency_2);
        FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
        RCC_PLLConfig(RCC_PLLSource_HSE_Div1,RCC_PLLMul_9);
        RCC_PLLCmd(ENABLE);
        while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
        RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
        while(RCC_GetSYSCLKSource() != 0x08);
    }

    RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA 
        ,ENABLE);
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
}
开发者ID:timmy00274672,项目名称:STM32-Learning,代码行数:25,代码来源:main.c


示例19: RCC_Config

// Clocks
void RCC_Config(void) {
    ErrorStatus HSEStartUpStatus;
    // Configuration of SYSCLK, HCLK, PCLK2 + PCLK1
    RCC_DeInit();
    RCC_HSEConfig(RCC_HSE_ON);
    HSEStartUpStatus = RCC_WaitForHSEStartUp();
    if (HSEStartUpStatus == SUCCESS) {
        RCC_HCLKConfig(RCC_SYSCLK_Div1);
        RCC_PCLK2Config(RCC_HCLK_Div1);
        RCC_PCLK1Config(RCC_HCLK_Div2);
        // PLLCLK = 8MHz * 9 = 72 MHz
        RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
        RCC_PLLCmd(ENABLE);
        while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) {}
        RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
        while (RCC_GetSYSCLKSource() != 0x08) {}

        /* Enable GPIOA clock */
        RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOC, ENABLE);
    } else {
        // HSE start error - clock configuration will be wrong
        // maybe say about it?
        while (1) {}
    }
}
开发者ID:semicontinuity,项目名称:embedded,代码行数:26,代码来源:main.c


示例20: RCC_Configuration

/**
  * @brief  Configures the different system clocks.
  * @param  None
  * @retval None
  */
void RCC_Configuration(void)
{
    /* PCLK2 = HCLK/2 */
    RCC_PCLK2Config(RCC_HCLK_Div2);

    /* Enable peripheral clocks --------------------------------------------------*/
    /* Enable SPI_SLAVE DMA clock */
    RCC_AHBPeriphClockCmd(SPI_SLAVE_DMA_CLK, ENABLE);

#ifdef USE_STM3210C_EVAL
    /* Enable GPIO clock for SPI_MASTER and SPI_SLAVE */
    RCC_APB2PeriphClockCmd(SPI_MASTER_GPIO_CLK | SPI_SLAVE_GPIO_CLK |
                           RCC_APB2Periph_AFIO, ENABLE);

    /* Enable SPI_MASTER Periph clock */
    RCC_APB1PeriphClockCmd(SPI_MASTER_CLK, ENABLE);

#else
    /* Enable SPI_MASTER clock and GPIO clock for SPI_MASTER and SPI_SLAVE */
    RCC_APB2PeriphClockCmd(SPI_MASTER_GPIO_CLK | SPI_SLAVE_GPIO_CLK |
                           SPI_MASTER_CLK, ENABLE);
#endif
    /* Enable SPI_SLAVE Periph clock */
    RCC_APB1PeriphClockCmd(SPI_SLAVE_CLK, ENABLE);
}
开发者ID:glocklueng,项目名称:QuadVolucer,代码行数:30,代码来源:main.c



注:本文中的RCC_PCLK2Config函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ RCC_PLLCmd函数代码示例发布时间:2022-05-30
下一篇:
C++ RCC_PCLK1Config函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap