In this Tutorial im showing how and STM32 Timer ( TIM ) works, and how to use it. My social accounts : / weblearning1 / weblearning1 / weblearning1 Thanks. / weblearning
sir needs some clarification at 2:03 s of video, in 1 sec we get 1000 pulse , do you want to say that the pulse is high for 500 and low for 500, or for 1 complete cycle is 1/1000 =0.001
Good video, thanks. I have not used Cube5 for timers yet but in Cube4 the prescaler and period values equated to the set value +1. I.e. to divide input frequency by 1000, one needed to set the register value to 999. Did Cube5 change this to be more intuitive?
This behaviour is not due to CubeMX, but rather internal implementation details. You can find the Prescaler equation on the Timer Cookbook PDF from ST. There's also an image explaining the reason for the adjustment on auto reload register. Basically, when the timer reaches the "Pulse" value (CCRx), it immediately changes the output, but it waits one timer counting cycle to reset once reaching the auto-reload value (ARR). Thus, you should subtract 1 from ARR and from the Prescaler value, but not from Pulse.
hi! thank you for the video! i want a 200khz pwm output and a i have set the internal clock to 8Mhz so i set the prescalar to 40 to have a prescalar output 200khz and when i put 200000 in the ARR(counter period) box it is impossible and the same thing with the CCR(pulse) box please help!
is there a formula that links the system's clock, presclaer,counter period and the required time in seconds? How should I obtain a period of 0,2s? Thanks for the video.
I have 2: 1. Rigol 4 ch color scope that i have. I made a video on how to fix it. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Z2NIYO1gUJ0.html 2. A smaller and simpler one that I use for my videos: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-tmF5B6mdrLY.html
I wish BlueNRG-2 was STM32 so CubeMX could be used. Is there any way to leverage PWM on STEVAL-BCN002V1's RGB LED(s) ? Maybe with MFT2_TON & TOFF in PWM_config.h that includes BlueNRG1_mft.h in Micro_Hello_World project of DK 1.0.9 ? Or, software ones on PWM2-4_PIN defines ? Thanks for your awesome videos... They are VERY well done and we are very appreciative. :-)
In the end of the video, the waveform was displayed and max voltage was around 3..can i increase or decrease that voltage level with the settings in cubemx?
No, the PWM is only 1 and a 0 of your voltage. You can use a Low pass filter and depending on the frequency, you can make it as a DAC. There are also other ways, with more GPIO and resistors as voltage dividers.
How does one edit code using this method? Do you get to save all your menu settings for each timer you setup? (Ex. What if a year from now, I have my code but want to change the pin#/timing etc. But I don't remember the cube Mx stuff I setup that generated the code. ) Just curious. Thanks for the video.
Well, first it's best to save all you project in one place and the cube IOC file in the same place. if you still can't find the file, the you can read and see all your settings in the main.c file or peripheral files depends how you set it. See the movie that I made on who the cube generate the code.
@@Weblearning1 nope i did not buy but i am still planning to, thank you, yes i will watch it during my holidays which is coming up in less than a week, anyways also, thank you for your videos!
would it be possible to use a function generator insteat of the internal clock? I am connecting a function generator (1000KHz, 3V, 1.5 Offset) to the positive pin of the comparator and in the negative I am using the VRefInt. However I just get a HIGH in the output of the comparator. :(
@@Weblearning1 yes. But I don’t know what is the best option for this. I’m afraid that connection a 3.3V, 1KHz signal is gonna be a too high frequency to get to trigger at the voltage reference (1.2V).
Hi, What I have understood from your example is that you set the frequency in CubeMX. There is a way to change the frequency while running. Let say that I want to modulate several frequencies from 30HZ up to 32MHZ, it is possible?