Browse Source

Fix mistakes.

Vladimir N. Shilov 3 years ago
parent
commit
b0cb92be79
2 changed files with 16 additions and 16 deletions
  1. 2 2
      Inc/board.h
  2. 14 14
      Src/board.c

+ 2 - 2
Inc/board.h

@@ -91,9 +91,9 @@
 #define PWM_5_GPIO_Port GPIOA
 #define PWM_5_Pin GPIO_PIN_6
 #define PWM_B_GPIO_Port GPIOA
-#define PWM_B_Pin GPIO_PIN_10
+#define PWM_B_Pin GPIO_PIN_11
 #define PWM_G_GPIO_Port GPIOA
-#define PWM_G_Pin GPIO_PIN_11
+#define PWM_G_Pin GPIO_PIN_10
 #define PWM_R_GPIO_Port GPIOA
 #define PWM_R_Pin GPIO_PIN_9
 #define SHDN_GPIO_Port GPIOA

+ 14 - 14
Src/board.c

@@ -42,10 +42,10 @@ void Board_Init(void)
 	TIM1_Init();
   TIM3_Init();
 
-	TIM14_Init();
+	//TIM14_Init();
 
-  TIM16_Init();
-  TIM17_Init();
+  //TIM16_Init();
+  //TIM17_Init();
 }
 
 /**
@@ -62,16 +62,16 @@ void SystemClock_Config(void)
 
   /* Main PLL configuration and activation */
   RCC->PLLCFGR &= ~(RCC_PLLCFGR_PLLSRC | RCC_PLLCFGR_PLLM | RCC_PLLCFGR_PLLN | RCC_PLLCFGR_PLLR);
-  RCC->PLLCFGR |= (RCC_PLLCFGR_PLLSRC_HSI | RCC_PLLCFGR_PLLM_0 | (9 << RCC_PLLCFGR_PLLN_Pos) | RCC_PLLCFGR_PLLM_1);
-  RCC->CR |= RCC_CR_PLLON; // RCC_PLL_Enable
+  RCC->PLLCFGR |= (RCC_PLLCFGR_PLLSRC_HSI | (9 << RCC_PLLCFGR_PLLN_Pos) | RCC_PLLCFGR_PLLR_2 | RCC_PLLCFGR_PLLR_0);
   RCC->PLLCFGR |= RCC_PLLCFGR_PLLREN; // RCC_PLL_EnableDomain_SYS
+  RCC->CR |= RCC_CR_PLLON; // RCC_PLL_Enable
   while((RCC->CR & RCC_CR_PLLRDY) == 0)
   {
   }
 
   /* Set AHB prescaler*/
-  RCC->CFGR &= ~(RCC_CFGR_HPRE);
-  RCC->CFGR |= 0x00000000U;
+  //RCC->CFGR &= ~(RCC_CFGR_HPRE);
+  //RCC->CFGR |= 0x00000000U;
 
   /* Sysclk activation on the main PLL */
   RCC->CFGR &= RCC_CFGR_SW;
@@ -80,9 +80,9 @@ void SystemClock_Config(void)
   {
   }
 
-  /* Set APB1 prescaler*/
-  RCC->CFGR &= RCC_CFGR_PPRE;
-  RCC->CFGR |= 0x00000000U;
+  /* Set APB1 prescaler !!! uncorrect !!! */
+  //RCC->CFGR &= RCC_CFGR_PPRE;
+  //RCC->CFGR |= 0x00000000U;
 
 #ifdef USES_SYSTICK
   /* Configure the SysTick to have interrupt in 1ms time base */
@@ -155,10 +155,10 @@ static void TIM1_Init(void)
   GPIO_SetPinPull(PWM_B_GPIO_Port, PWM_B_Pin, GPIO_PUPDR_DW);
   GPIO_SetAFPin_8_15(PWM_B_GPIO_Port, PWM_B_Pin, GPIO_AF_2);
 
-  GPIO_SetPinMode(PWM_G_GPIO_Port, PWM_B_Pin, GPIO_MODE_AFF);
-  GPIO_SetPinSpeed(PWM_G_GPIO_Port, PWM_B_Pin, GPIO_OSPEED_HI);
-  GPIO_SetPinPull(PWM_G_GPIO_Port, PWM_B_Pin, GPIO_PUPDR_DW);
-  GPIO_SetAFPin_8_15(PWM_G_GPIO_Port, PWM_B_Pin, GPIO_AF_2);
+  GPIO_SetPinMode(PWM_G_GPIO_Port, PWM_G_Pin, GPIO_MODE_AFF);
+  GPIO_SetPinSpeed(PWM_G_GPIO_Port, PWM_G_Pin, GPIO_OSPEED_HI);
+  GPIO_SetPinPull(PWM_G_GPIO_Port, PWM_G_Pin, GPIO_PUPDR_DW);
+  GPIO_SetAFPin_8_15(PWM_G_GPIO_Port, PWM_G_Pin, GPIO_AF_2);
 }
 
 /**