Page 1 of 1

Problem with Hardware Timer example on STM32L476RG.

Posted: Thu Mar 26, 2020 6:27 pm
by Fabaum
Hello friends,

I am trying unsuccessfully to test the Timebase_callback.ino example found at https://github.com/stm32duino/wiki/wiki ... er-library.
I just changed output D2 to PA5, which is Led1 on the board.
Unfortunately it didn't work, the led just doesn't flash ...
I found the topic viewtopic.php?f=62&t=222&p=1500&hilit=timer#p1500, where someone else had a similar problem, but he managed to solve it.
Does anyone have a suggestion on how to solve this?

Re: Problem with Hardware Timer example on STM32L476RG.

Posted: Thu Mar 26, 2020 11:25 pm
by stas2z
Use examples bundled with core
github examples are for newer unreleased yet core version and some things changed since 1.8 release

Re: Problem with Hardware Timer example on STM32L476RG.

Posted: Fri Mar 27, 2020 5:44 am
by fpiSTM
Which board you used?
As stas2z said you should use the latest release of the library to avoid issue.
Add the setMode like this
https://github.com/stm32duino/STM32Exam ... 0a3352f716

Re: Problem with Hardware Timer example on STM32L476RG.

Posted: Fri Mar 27, 2020 1:52 pm
by Fabaum
Hello friends,

Thanks for the answers.
I'm using the STM32L476RG board.
The sample file I used initially is here: https://github.com/stm32duino/STM32Exam ... llback.ino
Then, I found the site https://www.arduinolibraries.info/libra ... o-examples, and downloaded all the examples.
I found the example Timebase_callback.ino (that works!) And then compared it with the example that was on github.
In the github example, a line of code was missing:

MyTim-> setMode (2, TIMER_OUTPUT_COMPARE);

Just as you indicated, fpiSTM!
Thank you all for your help!