Solved
STM32G030K6T6 with PWM
Hi,
I'm trying to configure the PWm with STM32G030K6T6. But pwm is not generate.
below I given my code and i don't know where i made a mistake if any one know help me.
RCC->IOPENR |= (RCC_IOPENR_GPIOAEN); // I/O port A clock enable
GPIOA->MODER &= ~(GPIO_MODER_MODE8); // clear 8th pin
GPIOA->MODER |= (GPIO_MODER_MODE8_1); // 10: Alternate function mode
/********** TIMER 1 Init **********/
RCC->APBENR2 |= RCC_APBENR2_TIM1EN; // TIM1 CLOCK ENABLE
TIM1->CR1 &= ~TIM_CR1_DIR; //Set Counter Direction as Up-Counter
TIM1->ARR = 1; //ARR VALUE IS 0-65535
TIM1->PSC = 2000-1; //PERSCALER VALUE IS 0-65535
TIM1->CCR1 = 1000; //Duty Cycle
TIM1->CNT = 0; //COUNT START IN 0
TIM1->RCR = 0;
TIM1->CCMR1 |= 0x00000068; //Configure the pins as PWM
TIM1->EGR = TIM_EGR_UG; // Update generation
TIM1->CCER |= TIM_CCER_CC1E; //Capture/Compare 1 output enable
TIM1->BDTR |= (TIM_BDTR_OSSR | TIM_BDTR_MOE); // Off-state selection for Run mode & Main output enable
TIM1->CR1 |= (TIM_CR1_CMS_0 | TIM_CR1_CEN); // COUNTER ENABLE & Center-aligned mode selection (01: Center-aligned mode 1)