Solved
stm32g071rb problem with PWM generation using TIM1 and PA8 pin
Hello,
I'm studing timers with stm32g071rb and I wanna generate a PWM signal using PA8 pin.
At the moment I write this code:
GPIOA->MODER &= 0xeffcffff;
At the moment I write this code:
GPIOA->MODER &= 0xeffcffff;
GPIOA->MODER |= 2<<16; //alternate function mode for PA8
GPIOA->OSPEEDR |= 1<<17; //PA8 at high speed
GPIOA->AFR[1] |= 2; //alternate function for PA8(TIM1_CH1)
rcc->APBENR2 |= RCC_APBENR2_TIM1EN_Msk;
rcc->IOPENR |= RCC_IOPENR_GPIOAEN_Msk;
timer->ARR = 20;
timer->PSC = 16000 - 1;
timer->CCR1 = 1;
timer->CCMR1 |= 0x60; //PWM mode 1
timer->CCMR1 |= TIM_CCMR1_OC1PE_Msk;
timer->CR1 |= TIM_CR1_ARPE_Msk;
timer->EGR = TIM_EGR_UG_Msk;
timer->CCER |= 1 << 0;
timer->CR1 |= TIM_CR1_CEN_Msk;
I connected an oscilloscope in PA8 pin but there is no signal...
Please could you help me?
Thanks a lot!
Please could you help me?
Thanks a lot!
