2017-07-25 05:59 PM
Cannot get it to fire the IC Capture interrupt, and the macro that decodes the PWM Pulse finished interrupt might be broken becuase all running timers seem to be sent a handle to that callback. htim->Instance TIM2 gets a callback, when i tried.
LED shows the PWM ringing away from TIM1 but TIM2 never gets the IC Capture callback
STM32CubeMX 4.22
STM32Cube_F1_1.6
Timer 1:
prescaler 7199
period 9999
pulse 5
Output to pin PA11
Timer 2:
prescaler 0
period 65535
input TI1FP1 on PA0
The CubeMX application generates:
/**TIM2 GPIO Configuration
PA0-WKUP ------> TIM2_CH1 */ GPIO_InitStruct.Pin = GPIO_PIN_0; GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Pull = GPIO_NOPULL;and GPIO_MODE_AF_INPUT is the same as MODE_INPUT
DIER is set for interrupt on CC1IE and CC2IE
can't get CCR1 to set
Registers:
AFIO->MAPR: 0x02000000
GPIOA->CRL: 0x4434AA44
GPIOA->CRH: 0x8884B444GPIOA->IDR: 0x0000F7DEGPIOA->ODR: 0x0000A000GPIOA->BSRR: 0x00000000GPIOA->BRR: 0x00000000GPIOA->LCKR: 0x00000000TIM1->CR1: 0x00000001
TIM1->CR2: 0x00000000TIM1->PSC: 0x00001C1FTIM1->ARR: 0x0000270FTIM1->RCR: 0x00000000TIM1->DIER: 0x00000010TIM1->SMCR: 0x00000000TIM1->CCER: 0x00001000TIM1->CCMR1: 0x00000000TIM1->CCMR2: 0x00006C00TIM1->CCR1: 0x00000000TIM1->CCR2: 0x00000000TIM1->CCR3: 0x00000000TIM1->CCR4: 0x00000005TIM1->EGR: 0x00000000TIM1->DCR: 0x00000000TIM1->DMAR: 0x00000001TIM1->CNT: 0x0000027BTIM1->SR: 0x00000011TIM2->CR1: 0x00000001
TIM2->CR2: 0x00000000TIM2->PSC: 0x00000000TIM2->ARR: 0x0000FFFFTIM2->RCR: 0x00000000TIM2->DIER: 0x00000006TIM2->SMCR: 0x00000054TIM2->CCER: 0x00000002TIM2->CCMR1: 0x00000201TIM2->CCMR2: 0x00000000TIM2->CCR1: 0x00000000TIM2->CCR2: 0x00000000TIM2->CCR3: 0x00000000TIM2->CCR4: 0x00000000TIM2->EGR: 0x00000000TIM2->DCR: 0x00000000TIM2->DMAR: 0x00000001TIM2->CNT: 0x00005821TIM2->SR: 0x000000592017-07-25 11:21 PM
Good morning.!
The period of timer1 to give an pwm output is 80000000 fclocks (supose APB2 prescaler is 1 or 2 )
The period that Timer 2 can measure is at most 65536 fclocks (supose APB1 presc is 1 or 2)
You can catch PWMs with cycle period less than tim2 max count period. ((presc+1)*reload val)