cancel
Showing results for 
Search instead for 
Did you mean: 

TIM9 External Clock Source Mode 1

thomasweber9
Associate
Posted on September 20, 2016 at 16:14

Hello,

I try to count impulses from a rotating motor (pulse length: 280 us)

I use STM32CubeMX (Version 4.16.1; STM32Cube V1.0) to configure the STM32F746.

I configured TIM9 slave mode for external clock source mode, TI1FP1(GPIO PE5) as trigger source.

I want to read the CNT register every 1 second. Is it the right way? 

Can someone verify, if CubeMX generates the code right?

The resulting code seems not to configure the input correctly. (CCMR1 is 0x00), should be 0x01 in my opinion.

The CNT register is always 0 (also if motor is rotating)

Thanks in advance

#stm32
2 REPLIES 2
Posted on September 20, 2016 at 23:24

I don't and won't use Cube, but what happens if you set CCMR1 to the value you deem correct?

JW

Walid FTITI_O
Senior II
Posted on September 21, 2016 at 10:59

Hi twe,

In addition to the STM32CubeMx which is a tool that generate an initialization code, to add user code you can get help from the ready-to-use example of STM32Cube package. I recommend the ''TIM_InputCapture'' example of the

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef7.html

firmware package at this path: STM32Cube_FW_F7_V1.4.0\Projects\STM32756G_EVAL\Examples\TIM\TIM_InputCapture

You can apply the same call back code there.

-Hannibal-