stm32f4 encoder interface mode
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2014-08-08 9:51 PM
Posted on August 09, 2014 at 06:51
Hi there!
I'm using my stm32f4 timer 5 in encoder interface mode. In reference manual it is written for CCxNP/CCxP pins that they should not written 11 (i.e. polarity of trigger on both edges) in encoder interface mode which inhabiting me from getting interrupt on all four edges of encoder. Is there any way to get all four interrupts of encoder signal in encoder interface mode. Below is my initialization code - GPIOH->AFR[1] |= 0x00002200;//PinPH10,PH11 in alternate function mode tim5 ch1 and ch2 respectively RCC->APB1ENR |= RCC_APB1ENR_TIM5EN;//Clock source for timer5 enabled TIM5->ARR = 0xffff;//Auto relode value for timer5TIM5->PSC = 0;TIM5->CCMR1 |= TIM_CCMR1_CC1S_0|TIM_CCMR1_CC2S_0; //Timer5 ch1 & ch2as input captureTIM5->CCMR1 &= ~TIM_CCMR1_CC1S_1|TIM_CCMR1_CC2S_1;TIM5->DIER |= (TIM_DIER_CC1IE | TIM_DIER_CC2IE);//tim5 capture/compare ch1 and ch2 interrupt enable TIM5->SMCR |= TIM_SMCR_SMS_0|TIM_SMCR_SMS_1;//tim5 counter counts on both edgesNVIC_EnableIRQ(TIM5_IRQn);//globally enable timer 5 interruptTIM5->CCER |= TIM_CCER_CC1E|TIM_CCER_CC2E; //capture/compare 1 and 2 enableTIM5->CR1 |= TIM_CR1_CEN;Thanks #stm32f4-encoder-interface
Labels:
- Labels:
-
STM32F4 Series
This discussion is locked. Please start a new topic to ask your question.
0 REPLIES 0
