user1923363
user1923363

Reputation: 75

How to debug a timer

Im having problem setting up the TIM1 in "External Source Mode 1". Im writing to CH1 programmatically but nothing comes out of the timer no matter what settings I try. Is there a way to debug a timer, meaning checking the values at every stage, for example values of TI2FP1, IC1, and then IC1PS. I cant find them while debugging Edit: If you're familiar these are not the names of the ordinary config registers. Those I know how to find.

Upvotes: 2

Views: 1176

Answers (1)

David Collins
David Collins

Reputation: 3012

The IC1F and IC1PS configuration bits you refer to are found within the TIM1 CCMR1 register. In Truestudio - in the debug perspective, in the SFRs tab - expand TIM1 and then CCMR1_Input. See picture. (That screenshot is for an STM32F302RC, but I believe the TIM1 registers are very similar - if not almost identical - for the STM32F411RE).

enter image description here

TI2FP1, on the other hand, is a signal - not a configuration bit stored in the microcontroller's memory.

If you are using global variables inside the timer ISRs, don't forget to declare them volatile. Otherwise they may not be updating as you expect (at least once you enable optimization).

Upvotes: 4

Related Questions