Skip to main content
Marco Perciavalle
Associate III
October 30, 2017
Question

Pwm input mode F401RE

  • October 30, 2017
  • 11 replies
  • 2981 views
Posted on October 30, 2017 at 11:09

Hi, i have a problem about pwm input mode for f401re board. Forse my purpose, I use cubemx and set Tim 9 slave controller in reset mode, TI1FP1 ad trigger source, Channel 1 in input capture direct mode and Channel 2 in input capture indirect mode, as It is written in ref manual. Then I thick 'internal clock', choose an ARR value and prescaler values compatible with my test signal to mesure and generate the code.

On IAR, I only enable timer input capture mode using 'HAL_TIM_IC_Start(&htim9,TIM_CHANNEL_ALL' function. What i see is that the counter Tim 9 works, CNT is continuosly updated, but Tim9_ccr1 and tim9_ccr2 always remain at 0 values despite the test pwm signal has the right frequency according to counter's range. It seems the board doesn t recognize signal's edges. On reference manual is written that ccrx values should not reset despite of the reset mode. So, is there anything else to do?

Thanks for all the answer. Best regards.

#stm32-f4 #pwm #input-capture-mode

Note: this post was migrated and contained many threaded conversations, some content may be missing.
This topic has been closed for replies.

11 replies

waclawek.jan
Super User
October 30, 2017
Posted on October 30, 2017 at 11:15

GPIO for given pin set properly?

Read out related GPIO and TIM registers' content and post.

JW

Marco Perciavalle
Associate III
October 31, 2017
Posted on October 31, 2017 at 14:41

Hi, thanks a lot for the answer.

Here are posted screens about TIM9 and GPIOA.

In this particular project the same board generate also PWM signal, using another timer (TIM1). If I use two different board, the result is the same. PA2 is a pin linked to TIM9, used to acquire information from a PWM signal. PA8 is linked to TIM1 which generates PWM signal. It seems that the generation has success. Otherwise, IDR8 is costant, but it changes.

0690X00000604BMQAY.jpg

GPIOA

0690X00000604BRQAY.jpg

TIM9

I notice that CC2IE and CC1IE are at 0 value. I modify it manually but the result is the same.

waclawek.jan
Super User
October 31, 2017
Posted on October 31, 2017 at 14:49

Neither channel's capture is enabled in CCER.

JW

waclawek.jan
Super User
November 1, 2017
Posted on November 01, 2017 at 20:17

That's more hummm.

PA2 is also TIM5_CH3. Can you please try to set it up in GPIO for AF2 for TIM5, set TIM5 to run (enable clock in RCC, ARR=0xFFFFFFFF, CR1.CEN=1), CH3 for straight capture (CCMR2.CC3S = 1, CCER.CC3E = 1) and observe CCR3?

JW

Marco Perciavalle
Associate III
November 1, 2017
Posted on November 01, 2017 at 23:05

It works using another pin (pa0) and timer (tim5) and I don't know why! However thank you for all the answers. 

Tesla DeLorean
Guru
November 1, 2017
Posted on November 01, 2017 at 23:40

PA2 is used for the VCP/USART on the NUCLEO-F401RE, if that's what you're using, the post lacks specificity on the board.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..