cancel
Showing results for 
Search instead for 
Did you mean: 

How to setup a Timer to output a squarewave?

LMI2
Lead
Posted on March 04, 2016 at 20:50

The Cube is not clear in this. I want to output squarewave 1kHz-0.1Hz from a pin. There are no examples about this and explanations are not clear either.

I want to use STM32F1 CPU.

#je-ne-l'aime-cube
6 REPLIES 6
Posted on March 04, 2016 at 21:31

PWM with 50/50 duty,Toggle?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
LMI2
Lead
Posted on March 04, 2016 at 22:19

50% off, 50% on, it is not very critical. What is toggle in this context? Keying or gating with an other signal? Let's keep it simple, I can fine tune details myself, I hope.

LMI2
Lead
Posted on March 05, 2016 at 00:56

I found a DM00154093 pdf which talks about the Cube in a way. There is something about timer modes and the Cube tool itself has something similar. I understand a little more about the Cube. I'll try again with the project.

And with  extra parenthesis. Code from the Cube:

else if((htim->State == HAL_TIM_STATE_READY))

LMI2
Lead
Posted on March 06, 2016 at 19:50

I found an example which does what I want

STM32Cube_FW_F4_V1.11.0\Projects\STM32F4-Discovery\Examples\TIM\TIM_TimeBase

There are no CubeMX projects in those packages. I wonder why. I'll ask ST to include CubeMX projects in their examples.

Walid FTITI_O
Senior II
Posted on March 07, 2016 at 12:32

Hi mich.lei,

You find the examples for STM32F1 at

http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/LN1897/PF260820

at this path stm32cubef1\STM32Cube_FW_F1_V1.3.0\Projects\STM3210C_EVAL\Examples\TIM

> There are no CubeMX projects in those packages. I wonder why. I'll ask ST to include CubeMX projects in their examples.

The CubeMx does not aim to create a hole project but , infact, it helpsto generate an initialization code to be a start point for the project developement.

-Hannibal-
LMI2
Lead
Posted on March 10, 2016 at 23:43

I just noticed a new post.

We are talking about projects and CubeMx projects. In my opinion Cubemx is a good idea, I mean the visual setup the HW. But it must be used and supported. Giving just initializing code without CubeMx is not so useful, there already is one such interface, I think.

Timers have quite many operating modes, so they are one place where CubeMX could help.

Besides, Cubemx shows which pins are available and which are taken.