cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Timer Counter Never Starts Counting

Elliott99
Associate II

Hi, I am attempting to enable TIM1 to act as my program's tick timebase as SysTick is being utilized by the FreeRTOS kernel to generate PendSV interrupts. I configured this in CubeMX (Timebase set to TIM1) but I cannot get TIM1 to start ticking. Attached is an image of TIM1's register set. I can't seem to figure out what configurations I am missing, CEN bit in CR1 is enabled and set to upcounting mode, and the ARR value is set to 0x3E7 to generate a tick increment every 1ms. 


notTicking.png

4 REPLIES 4
EXUE.2
ST Employee

it looks like there are no problem for you TIM1 registers, but if you have enabled TIM1EN clock in RCC_APB2ENR register?

@EXUE.2,

if the timer clock in RCC is not enabled, the individual registers wouldn't be readable, isn't it?

@Elliott99,

let the program run freely for some time and then look at the registers again. You may have the registers frozen during debugging in the respective DBGMCU register (there may be some setting in the GUI for that).

JW

So I did check that TIM1EN bit in that register and is set, so I don't think that's the issue.

Thank you for the reply. I am away from home for the weekend (and my setup for this is at home as it is a personal project) but I don't believe the registers are frozen as stepping through Hal_InitTick() and looking at both the memory view (at the TIM1 register addresses) and register view itself shows the registers being modified. One thing that *does* stand out as possibly being an issue is in IAR my debug driver is set to "Simulator" rather than "ST-Link". I am not quite sure what this leads to symptomatically but it should definitely be fixed. Outside of that, nothing in the register view really sticks out as being misconfigured correct?