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

C++ RCC_PCLK1Config函数代码示例

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

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



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

示例1: SysClkSetHSI_4xPLLMul

void SysClkSetHSI_4xPLLMul (uint32_t PLLMul ) {
      if (PLLMul > RCC_PLLMul_12) {
            FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
            // Flash 2 wait state for freq > 4x12 48MHz
            FLASH_SetLatency(FLASH_Latency_2);
      }
      else if (PLLMul > RCC_PLLMul_6) {
            FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
            // Flash 1 wait state for freq > 4x6 24MHz
            FLASH_SetLatency(FLASH_Latency_1);
      }
      // PLL provides frequency multiplier of (HSI/2) i.e. 4MHz x ...
      RCC_PLLConfig(RCC_PLLSource_HSI_Div2, PLLMul);
      // 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);
      // AHB, AP2 and AP1 clock are necessary for the peripherals to function
      // HCLK for AHB = SYSCLK (max is SYSCLK, up to 72MHz)
      RCC_HCLKConfig(RCC_SYSCLK_Div1);
      // PCLK2 for APB2 = HCLK (max is SYSCLK, up to 72MHz)
      RCC_PCLK2Config(RCC_HCLK_Div1);
      if (PLLMul > RCC_PLLMul_9) {
            // PCLK1 for APB1 = HCLK/2 (> 4x9MHz max of 36MHz, use slower clock)
            RCC_PCLK1Config(RCC_HCLK_Div2);
      }
      else {
            // PCLK1 for APB1 = HCLK (HCLK <= 36MHz)
            RCC_PCLK1Config(RCC_HCLK_Div1);
      }
      RCC_GetClocksFreq(&ClksFreq); // update SYSCLK, HCLK, PCLK1 and PCLK2 in ClksFreq
}
开发者ID:CalcHack,项目名称:firmware,代码行数:36,代码来源:main.cpp


示例2: RCC_Configuration

/**
  * @brief  Configures the different system clocks.
  * @param  None
  * @retval None
  */
void RCC_Configuration(void)
{
  /* Setup the microcontroller system. Initialize the Embedded Flash Interface,  
     initialize the PLL and update the SystemFrequency variable. */
  SystemInit();

  /* PCLK1 = HCLK/4 */
  RCC_PCLK1Config(RCC_HCLK_Div4);

  /* TIM2 clock enable */
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);

  /* GPIOC clock enable */
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
}
开发者ID:jwithee,项目名称:bearboard,代码行数:20,代码来源:main.c


示例3: RCC_Internal_Configuration

void RCC_Internal_Configuration(void)
{
	ErrorStatus HSEStartUpStatus;

	//将外设 RCC寄存器重设为缺省值

	RCC_DeInit();

	RCC_HSICmd(ENABLE);

	while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET);

	if(HSEStartUpStatus == SUCCESS) 
	{

		RCC_HCLKConfig(RCC_SYSCLK_Div1);

		RCC_PCLK2Config(RCC_HCLK_Div1);

		RCC_PCLK1Config(RCC_HCLK_Div2);

		//设置 PLL 时钟源及倍频系数

		RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_2);

		//使能或者失能 PLL,这个参数可以取:ENABLE或者DISABLE

		RCC_PLLCmd(ENABLE);//如果PLL被用于系统时钟,那么它不能被失能

		//等待指定的 RCC 标志位设置成功 等待PLL初始化成功

		while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);

		//设置系统时钟(SYSCLK) 设置PLL为系统时钟源

		RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

		//等待PLL成功用作于系统时钟的时钟源

		// 0x00:HSI 作为系统时钟

		// 0x04:HSE作为系统时钟

		// 0x08:PLL作为系统时钟

		while(RCC_GetSYSCLKSource() != 0x08);
	}
}
开发者ID:zxynk666666,项目名称:bluenergy_wn,代码行数:48,代码来源:system_init.c


示例4: 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)
    {
    }
  }
}
开发者ID:zhanggyhz,项目名称:stm32dev,代码行数:55,代码来源:main.c


示例5: fastMode

void fastMode() {
    RCC_DeInit();

    RCC_HSEConfig(RCC_HSE_ON);
    if (RCC_WaitForHSEStartUp() == ERROR) {
        return;
    }
    RCC_PLLConfig(RCC_PLLSource_HSE, 8, 336, 2, 15);
    RCC_PLLCmd(ENABLE);

    RCC_WaitForPLLSturtUp();

    RCC_HCLKConfig(RCC_SYSCLK_Div4);
    RCC_PCLK1Config(RCC_HCLK_Div1);
    RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
}
开发者ID:ADTL,项目名称:stm32f4-examples,代码行数:16,代码来源:main.c


示例6: Sys_Clock_Init

void Sys_Clock_Init(void)
{
	ErrorStatus HSEStartUpStatus; 
	RCC_DeInit(); //     	/* RCC system reset(for debug purpose) 重置了RCC的设置*/
	RCC_HSEConfig(RCC_HSE_ON);		/* Enable HSE */  		/* 使能外部高速晶振 */
	HSEStartUpStatus = RCC_WaitForHSEStartUp();	  /* Wait till HSE is ready 等待高速晶振稳定*/ 	
	if(HSEStartUpStatus == SUCCESS)
	{
//		FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);	 	/* Enable Prefetch Buffer 使能flash预读取缓冲区*/  		
//		FLASH_SetLatency(FLASH_Latency_2);		  /* Flash 2 wait state 
//		令Flash处于等待状态,2是针对高频时钟的,这两句跟RCC没直接关系,可以暂且略过*/	   	
		RCC_HCLKConfig(RCC_SYSCLK_Div1);		  	/* HCLK = SYSCLK 设置高速总线时钟=系统时钟*/	   	
		RCC_PCLK2Config(RCC_HCLK_Div1);			  	/* PCLK2 = HCLK 设置低速总线2时钟=高速总线时钟*/  		
		RCC_PCLK1Config(RCC_HCLK_Div2);				/* PCLK1 = HCLK/2 设置低速总线1的时钟=高速时钟的二分频*/  
		 	
        RCC_ADCCLKConfig(RCC_PCLK2_Div6);		   	/* ADCCLK = PCLK2/6 设置ADC外设时钟=低速总线2时钟的六分频*/	

/*		RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);  // PLLCLK = 8MHz * 9 = 72 MHz 利用锁相环讲外部8Mhz晶振9倍频到72Mhz 	 
		RCC_PLLCmd(ENABLE);			// Enable PLL 使能锁相环		 																
		while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)		// Wait till PLL is ready 等待锁相环输出稳定
		{
		} */
		RCC_SYSCLKConfig(RCC_SYSCLKSource_HSE);
		//RCC_SYSCLKSource_HSI:	高速内部时钟信号 stm32单片机内带的时钟 (8M频率)	 
		//RCC_SYSCLKSource_HSE:(1)HSE外部晶体/陶瓷谐振器(晶振)  (2)HSE用户外部时钟
		//RCC_SYSCLKSource_PLLCLK:Select PLL as system clock source 将锁相环输出设置为系统时钟*/	
		while(RCC_GetSYSCLKSource() != 0x04)	//HSE used as system clock
// 		while(RCC_GetSYSCLKSource() != 0x08)	/* Wait till PLL is used as system clock source 等待PLL校验成功*/
		{
		}
	}
	/* 这个配置可使外部晶振停振的时候,产生一个NMI中断,不需要用的可屏蔽掉*/
	//RCC_ClockSecuritySystemCmd(ENABLE);
	/* Enable FSMC, GPIOD, GPIOE, GPIOF, GPIOG and AFIO clocks */
    //使能外围接口总线时钟,注意各外设的隶属情况,不同芯片的分配不同,查手册就可
	/* Enable peripheral clocks -------------------------------*/
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC, ENABLE);	  
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE); 	
//  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_FSMC, ENABLE);
//	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE |
//                         RCC_APB2Periph_GPIOF | RCC_APB2Periph_GPIOG |
//                         RCC_APB2Periph_AFIO, ENABLE);
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);	  // AFIO时钟,用来禁止JTAG
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);	  // 串口1时钟,
//	RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1, ENABLE);     //ADC1时钟 
//	RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);//使能DMA1时钟 	
} 
开发者ID:yu88my,项目名称:smartiny,代码行数:47,代码来源:System_conf.c


示例7: SetSysClockToHSE

/***************************************************************************//**
 * @brief  Selects HSE as System clock source and configure HCLK, PCLK2 and PCLK1 prescalers.
 ******************************************************************************/
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);

        /* Flash 0 wait state */
        FLASH_SetLatency( FLASH_Latency_0);

        /* 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:pedrominatel,项目名称:embedded,代码行数:50,代码来源:RCC.c


示例8: RCC_Config

void RCC_Config(void)
{
  RCC_DeInit();                 //RCC寄存器初始化
  RCC_HSEConfig(RCC_HSE_ON);    //使用外部時鐘
  //if(RCC_WaitForHSEStarUp()==SUCCESS)
  //{
    RCC_PLLCmd(DISABLE);//PLL前應先關閉主PLL
    RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);//選擇PLL時鐘為系統時鐘
    RCC_HCLKConfig(RCC_SYSCLK_Div1);//HCLK(AHB)時鐘為系統時鐘1分頻
    RCC_PCLK1Config(RCC_HCLK_Div4);//PCLK1(AHB1)時鐘為HCLK時鐘8分頻,則TIM2時鐘為HCLK時鐘4分頻
    RCC_PCLK2Config(RCC_HCLK_Div2);//PCLK1(AHB1)時鐘為HCLK時鐘2分頻
    RCC_PLLConfig(RCC_PLLSource_HSE,27,162,2,7);//PLL時鐘配置,公式見system_stm43f4xx.c'line149
    RCC_PLLCmd(ENABLE);         //PLL時鐘開啟
    while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY)==RESET){}//等待PLL時鐘準備好
    
  //}
}
开发者ID:ohohyeah,项目名称:FLU_Handheld,代码行数:17,代码来源:main.c


示例9: RCC_Config

/**************************************************************/
//程 序 名: RCC_Config()
//开 发 者: Haichao.Xie
//入口参数: 无
//功能说明: 系统时钟配置
//**************************************************************/
void RCC_Config(void)
{
	ErrorStatus HSEStartUpStatus;	//定义结构体
	/* RCC system reset(for debug purpose)将外设 RCC寄存器重设为缺省值 */
	RCC_DeInit();
	/* Enable HSE 设置外部高速晶振(HSE)*/
	RCC_HSEConfig(RCC_HSE_ON);
	/* Wait till HSE is ready 等待 HSE 起振*/
	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 设置 AHB 时钟(HCLK)*/
		RCC_HCLKConfig(RCC_SYSCLK_Div1);

		/* PCLK2 = HCLK 设置高速 AHB 时钟(PCLK2)*/
		RCC_PCLK2Config(RCC_HCLK_Div1);

		/* PCLK1 = HCLK/1 设置低速 AHB 时钟(PCLK1)*/
		RCC_PCLK1Config(RCC_HCLK_Div1);

		/* PLLCLK = 12MHz * 6 = 72 MHz 设置 PLL 时钟源及倍频系数*/
		RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_6);

		/* Enable PLL 使能或者失能 PLL*/
		RCC_PLLCmd(ENABLE);

		/* Wait till PLL is ready 等待指定的 RCC 标志位设置成功 等待PLL初始化成功*/
		while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
		{
		}
		/* Select PLL as system clock source 设置系统时钟(SYSCLK) 设置PLL为系统时钟源*/
		RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

		/* Wait till PLL is used as system clock source 等待PLL成功用作于系统时钟的时钟源*/
		while(RCC_GetSYSCLKSource() != 0x08)
		{
		}
	}
}
开发者ID:sunzhongmeng,项目名称:ufun-demo,代码行数:52,代码来源:main.c


示例10: RCC_Configuration

static void RCC_Configuration(void)
{
  /*---------------------------------*/
  /*  /!\  PLL2 not configured  /!\  */
  /*---------------------------------*/
  ErrorStatus HSEStartUpStatus;
  // 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);
    /* ADCCLK = PCLK2/4 */
    RCC_ADCCLKConfig(RCC_PCLK2_Div4);
    // 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)  ///????
    {;}
  }

    /* Enable peripheral clocks (FOR USART1)---------------------------------*/
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
    /* Enable GPIOA / GPIOC clock */
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
}
开发者ID:ozwin,项目名称:erts-project,代码行数:46,代码来源:bsp.c


示例11: vHardwareInit

void vHardwareInit()
{
  // Enable HSE:
  RCC_HSEConfig(RCC_HSE_ON);

  // Wait for HSE to be ready:
  while (RCC_WaitForHSEStartUp() != SUCCESS);

  // Set PLL to be 9 * HSE = 72 MHz:
  RCC_PLLCmd(DISABLE);
  RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
  RCC_PLLCmd(ENABLE);

  // Wait for PLL to be ready:
  while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) != SET);

  // Two wait states, if 48 MHz < SYSCLK <= 72 MHz:
  FLASH_SetLatency(FLASH_Latency_2);

  // Set PLL as system clock:
  RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

  // Disable HSI:
  RCC_HSICmd(DISABLE);

  // Set APB low-speed clock (PCLK1), divide by 2:
  RCC_PCLK1Config(RCC_HCLK_Div2);

  // Set APB high-speed clock (PCLK2), do not divide:
  RCC_PCLK2Config(RCC_HCLK_Div1);

  // Set AHB clock (HCLK), do not divide:
  RCC_HCLKConfig(RCC_SYSCLK_Div1);

  // 3 bits for pre-emption priority 1 bits for subpriority:
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_3);

  // Set core clock as SYSTICK source:
  SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);

#ifdef RAM_BOOT
  // Put vector interrupt table in RAM:
  NVIC_SetVectorTable(NVIC_VectTab_RAM, SCB_VTOR_TBLBASE);
#endif
}
开发者ID:imanaskari,项目名称:swiftler-bones,代码行数:45,代码来源:hardware.c


示例12: RCC_Configuration

/*
 * RCC时钟频率引脚配置
 */
void RCC_Configuration(void)
{
	//定义错误状态变量
	ErrorStatus HSEStartUpStatus;
	
	//将RCC寄存器重新设置为默认值
	RCC_DeInit();
	
	//打开外部高速时钟晶振
	RCC_HSEConfig(RCC_HSE_ON);
	
	//等待外部高速时钟晶振工作
	HSEStartUpStatus = RCC_WaitForHSEStartUp();
	if(HSEStartUpStatus != SUCCESS) return;
	
	//使能预取指缓存
	FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
	
	//设置FLASH代码延时
	FLASH_SetLatency(FLASH_Latency_2);

	//设置AHB时钟(HCLK)为系统时钟
	RCC_HCLKConfig(RCC_SYSCLK_Div1); 

	//设置高速AHB时钟(APB2)为HCLK时钟
	RCC_PCLK2Config(RCC_HCLK_Div1); 

  //设置低速AHB时钟(APB1)为HCLK的2分频
	RCC_PCLK1Config(RCC_HCLK_Div2);	

  //设置PLL时钟,为HSE的12倍频 PLLCLK = 12MHz/2 * 12 = 72 MHz
	RCC_PLLConfig(RCC_PLLSource_HSE_Div2, RCC_PLLMul_12);

	//使能PLL
	RCC_PLLCmd(ENABLE);

	//等待PLL准备就绪
	while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);

	//设置PLL为系统时钟源
	RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);

	//判断PLL是否是系统时钟
	while(RCC_GetSYSCLKSource() != 0x08);
}
开发者ID:yoy52012,项目名称:LoraSignalSlaveTest,代码行数:48,代码来源:main.c


示例13: 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(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);
			
			// the following is the selected part of the clock inicialization, according to your connecting devices
			
			//SPI1 clock open
			RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1,ENABLE);
			RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
			RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);
			
			//USART-XTend (wireless data transmittion) clock open
			RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE);
      
			//USART-GPS clock open
			RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
			
			//USART-sensor clock open
			RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
			
			//GPIO LED clock open
			RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
			
			//GPIO Launching clock open
			RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
			
			SysTick_ITConfig(ENABLE);
   }
}
开发者ID:dunchen,项目名称:ASR-project,代码行数:45,代码来源:main.c


示例14: main

int main(void)
{
	// Check that you flashed to the correct microcontroller
	uint32_t chipId1 = TM_ID_GetUnique32(0);
	uint32_t chipId2 = TM_ID_GetUnique32(1);
	uint32_t chipId3 = TM_ID_GetUnique32(2);
	if(chipId1 != 0x00290044 || chipId2 != 0x30345117 || chipId3 != 0x37333838){
		while(1);
	}
	
	// Configure the system clock.
	// The system clock is 168Mhz.
	RCC_HSEConfig(RCC_HSE_ON); // ENABLE HSE (HSE = 8Mhz)
	while(!RCC_WaitForHSEStartUp());  // Wait for HSE to stabilize
	
	SystemCoreClockUpdate();
	RCC_PCLK1Config(RCC_HCLK_Div4); // Set APB1=42Mhz (168/4)

	
	// Initialize peripheral modules
	InitGPIO();
	InitNVIC();
	InitPedalIntegrity();
	InitADC();
	InitCAN();
//	MCO_Config(); // Clock output
	
	
	
	
	/* Main code */
	while(1)
	{
		Delay(0xFF);
		/*
		if(CAN_GetITStatus(CAN1,CAN_IT_FMP0) == SET){
		
		CAN_Receive(CAN1,CAN_FIFO0,&msgRx);
		if(msgRx.StdId == 0x1){
			GPIOC->ODR |= GPIO_Pin_6;
		}
	}
		*/
	}
}
开发者ID:ION-Racing,项目名称:Pedalmodul,代码行数:45,代码来源:main.c


示例15: RCC_HSE_Configuration

void RCC_HSE_Configuration(void){
	RCC_DeInit(); /*将外设RCC寄存器重设为缺省值 */ 
	RCC_HSEConfig(RCC_HSE_ON); 	 /*设置外部高速晶振打开*/

	if(RCC_WaitForHSEStartUp() == SUCCESS) {  /*等待HSE起振,晶振稳定且就绪*/

		RCC_HCLKConfig(RCC_SYSCLK_Div1);/*设置AHB时钟*/
		RCC_PCLK2Config(RCC_HCLK_Div1); /*设置高速AHB时钟*/
		RCC_PCLK1Config(RCC_HCLK_Div2); /*设置低速AHB时钟*/

		RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);/*设置PLL时钟源、倍频系数*/		 
		RCC_PLLCmd(ENABLE);//使能PLL
		while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);//检查指定RCC标志位

		RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK); //设置系统时钟
		while(RCC_GetSYSCLKSource() != 0x08);    //PLL作为系统时钟
	}
}
开发者ID:InfiniteYuan1,项目名称:STM32,代码行数:18,代码来源:pData.c


示例16: TSVN_FOSC_Init

void TSVN_FOSC_Init(void)
{
	RCC_DeInit();								
	RCC_HSEConfig(RCC_HSE_ON);	
	while(RCC_WaitForHSEStartUp() != SUCCESS);
	RCC_PREDIV1Config(RCC_PREDIV1_Source_HSE, RCC_PREDIV1_Div1);
	RCC_HCLKConfig(RCC_SYSCLK_Div1); 
	RCC_PCLK2Config(RCC_HCLK_Div2);     
	RCC_PCLK1Config(RCC_HCLK_Div2);  
	RCC_PLLConfig(RCC_PLLSource_PREDIV1, RCC_PLLMul_9);
	RCC_PLLCmd(ENABLE);	
	while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
	RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK); 
	while(RCC_GetSYSCLKSource() != 0x08)
	SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK);
	SystemCoreClockUpdate();
	SysTick_Config(SystemCoreClock/1000);
}
开发者ID:NguyenTrongThinh,项目名称:FindPIDCoff,代码行数:18,代码来源:AMES_CLOCK.c


示例17: RCC_HSICmd

void Startup::clkInit()
{
	// Set STKALIGN in NVIC
	SCB->CCR |= 0x200;

	// 1. Clocking the controller from internal HSI RC (8 MHz)
	RCC_HSICmd(ENABLE);
	// wait until the HSI is ready
	while(RCC_GetFlagStatus(RCC_FLAG_HSIRDY) == RESET);
	RCC_SYSCLKConfig(RCC_SYSCLKSource_HSI);
	// 2. Enable ext. high frequency OSC
	RCC_HSEConfig(RCC_HSE_ON);
	// wait until the HSE is ready
	while(RCC_GetFlagStatus(RCC_FLAG_HSERDY) == RESET);
	// 3. Init PLL
	RCC_PLLConfig(RCC_PLLSource_HSE_Div1,RCC_PLLMul_9); // 72MHz
//  RCC_PLLConfig(RCC_PLLSource_HSE_Div2,RCC_PLLMul_9); // 72MHz
	RCC_PLLCmd(ENABLE);
	// wait until the PLL is ready
	while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
	// 4. Set system clock dividers
	RCC_USBCLKConfig(RCC_USBCLKSource_PLLCLK_1Div5);
	RCC_ADCCLKConfig(RCC_PCLK2_Div8);
	RCC_PCLK2Config(RCC_HCLK_Div1);
	RCC_PCLK1Config(RCC_HCLK_Div2);
	RCC_HCLKConfig(RCC_SYSCLK_Div1);

	// Flash 1 wait state
//	*(vu32 *)0x40022000 = 0x12;
//	*(vu32 *)0x40022000 = 0x01;

    // Enable Prefetch Buffer
    FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
    // Flash 2 wait state
    FLASH_SetLatency(FLASH_Latency_2);

	// 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:ozwin,项目名称:desenet,代码行数:44,代码来源:startup.cpp


示例18: RCC_Configuration

void RCC_Configuration(void)
{
     /* 定义枚举型变量HSEStartUpStatus */
    ErrorStatus HSEStartUpStatus;
    /* 复位系统时钟设置*/
    RCC_DeInit();
    /* 开启HSE*/
    RCC_HSEConfig(RCC_HSE_ON);
    /* 等待HSE启振并稳定*/
    HSEStartUpStatus = RCC_WaitForHSEStartUp();

    /*判断HSE是否起振成功, */
    if(HSEStartUpStatus == SUCCESS)
    {
        /* 选择HCLK(AHB)时钟源为 SYSCLK 1分频 */
        RCC_HCLKConfig(RCC_SYSCLK_Div1);
        /* 选择PCLK2时钟源为HCLK(AHB) 1分频*/
        RCC_PCLK2Config(RCC_HCLK_Div1);
        /* 选择PCLK1时钟源为HCLK(AHB) 2分频*/
        RCC_PCLK1Config(RCC_HCLK_Div2);
        /* 设置FLASH延时周期数为2 */
        FLASH_SetLatency(FLASH_Latency_2);
        /* 使能FLASH预缓存 */
        FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
        /* 选择锁相环(PLL)时钟源为HSE 1分频,倍频数为9,则PLL输出频率 8MHz * 9 = 72MHz */
        RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
        /* 使能PLL */
        RCC_PLLCmd(ENABLE);
        /* 等待PLL输出稳定 */
        while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET);
        /* 选择SYSCLK时钟源为PLL */
        RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
        /* 等待PLL成为SYSCLK时钟源*/
        while(RCC_GetSYSCLKSource() != 0x08);
    }

    /* 打开APB2总线上的GPIOA时钟*/
		RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1,ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA |RCC_APB2Periph_GPIOB|
													 RCC_APB2Periph_AFIO  |RCC_APB2Periph_USART1 ,ENABLE);       
		RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2 | RCC_APB1Periph_TIM4,ENABLE);
		

}
开发者ID:xinmulan,项目名称:RGB,代码行数:44,代码来源:bsp.c


示例19: RCC_HSE_Configuration

void RCC_HSE_Configuration(void) //HSE作为PLL时钟,PLL作为SYSCLK 
{ 
   RCC_DeInit(); /*将外设RCC寄存器重设为缺省值 */ 
   RCC_HSEConfig(RCC_HSE_ON); 	 /*设置外部高速晶振(HSE) HSE晶振打开(ON)*/ 

   if(RCC_WaitForHSEStartUp() == SUCCESS) {  /*等待HSE起振,  SUCCESS:HSE晶振稳定且就绪*/  

   RCC_HCLKConfig(RCC_SYSCLK_Div1);/*设置AHB时钟(HCLK)RCC_SYSCLK_Div1——AHB时钟 = 系统时*/  
   RCC_PCLK2Config(RCC_HCLK_Div1); /*设置高速AHB时钟(PCLK2)RCC_HCLK_Div1——APB2时钟 = HCLK*/     
   RCC_PCLK1Config(RCC_HCLK_Div2); /*设置低速AHB时钟(PCLK1)RCC_HCLK_Div2——APB1时钟 = HCLK / 2*/      

   RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);/*设置PLL时钟源及倍频系数*/    
   RCC_PLLCmd(ENABLE); 	 /*使能PLL */ 
   while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) ; /*检查指定的RCC标志位(PLL准备好标志)设置与否*/ 
    
   RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);  /*设置系统时钟(SYSCLK) */  
   while(RCC_GetSYSCLKSource() != 0x08);     /*0x08:PLL作为系统时钟 */	    
 } 
} 
开发者ID:Neutree,项目名称:Fire-Alarm-System,代码行数:19,代码来源:delay.c


示例20: RCC_Configuration

//===============================================
void RCC_Configuration(void)
{
	FLASH_PrefetchBufferCmd(ENABLE);
	FLASH_SetLatency(FLASH_ACR_LATENCY_1);
    RCC_DeInit();
    RCC_HSICmd(ENABLE);
	RCC_HCLKConfig(RCC_SYSCLK_Div1);
	RCC_PCLK1Config(RCC_HCLK_Div1);
	RCC_PCLK2Config(RCC_HCLK_Div1);
	RCC_ADCCLKConfig(RCC_PCLK2_Div6);
	RCC_PLLConfig(RCC_PLLSource_HSI_Div2, RCC_PLLMul_6);
	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:edosedgar,项目名称:atx12v_systest,代码行数:20,代码来源:InitPeripheral.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ RCC_PCLK2Config函数代码示例发布时间:2022-05-30
下一篇:
C++ RCC_LSICmd函数代码示例发布时间: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