cancel
Showing results for 
Search instead for 
Did you mean: 

Set up a general purpose timer and verify its operation.

RonH
Associate II

I have a new NUCLEO-H743ZI2 board and STM32CubeIDE.

I've made a Blinky project and seen it work - via led and debugger.

I'd like to configure a timer - using MX gui or not - and see it working in the debugger.

I tried this...

I created a new STM32 project.

Using MX, I setup TIM3 as below.

Then, I pressed the debug icon.

The debugger stops at  HAL_Init().

I open the live expression window and put a breakpoint in main.c - as shown below.

Then, I press the 'Resume' button repeatedly.

The code stops at my breakpoint each time.

I assume the timer is running all the time.

So, I'm expecting TIM3->CNT to have a different value each time I push the 'Resume' button.

But TIM3->CNT is always zero.

What am I doing wrong?

Here's what I put in the MX configuration for TIM3...

0690X00000At9kXQAR.png

0690X00000At9kSQAR.png

 I didn't edit the MX-generated code - just added breakpoint.

0690X00000At9khQAB.png

Here's TIM3 in the debugger expression window..

0690X00000At9kcQAB.png

6 REPLIES 6
RonH
Associate II

I found the problem: need to enable the timer.

This method works.

Count has a different value (almost) every time I press 'Resume'.

Is it the/a right way?

0690X00000AtBDGQA3.png

> Is it the/a right way?

Once you decided for Cube/HAL, I presume you should use the Cube/HAL function for this. I don't know which one is it, I don't use Cube, but Cube is open source, I assume you'll find it easily searching for "CEN".

JW

RonH
Associate II

Thanks JW!

I'm not decided for Cube/HAL.

What do you do instead?

For example this.

JW

RonH
Associate II

Jan,

Thanks for the link.

I looked at some of your code there - for example, 'a simple clock'.

OHHH! I like the looks of that!

It's not clear to me how I might get the code compiled and onto a board - if I had the right board.

I see clock.zip has a c.bat.

So I guess I need an ARMTools directory with some stuff in it - like a gcc.

Where should I get that? Keil maybe? GNU-RM?

(Guesses based on seeing the name around.)

BTW, I'm also a fan of the Beverly Clock which I only knew as the Atmos clock till yesterday.

Ron,

Thanks.

If you have some of the factory-recommended free tools (which depending on the season of year may be any of Atollic, AC6 or CubeIDE, the former two coming under a bunch of different names to make things more interesting), you already have some gcc installed. I am not fan of eclipsoids so I don't know where.

I use ARM-made binaries, https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm (more precisely, https://launchpad.net/gcc-arm-embedded/ which are old, but I almost never change a working toolchain, I don't think there's any merit in replacing the 2014 or so vintage I am using). You also need the headers augmenting the device headers - I beg for yerars ST to put these constants into the CMSIS-mandated headers, but so far they probably did not even understand what I am talking about - there's comment on that page and in the source telling that.

Surely you can use Keil's or IAR's, they certainly have standalone compilers too. The binary quality will undoubtedly be higher, but I am cheap.

I did not have time nor energy to bring that clock to a finished state, but the direction - using solar cell for primary source, big ceramics for nighttime storage and the sub-100nA-RTC - is most probably correct.

Jan