How to generate a PWM Signal with STM32

  Рет қаралды 14,938

CMTEQ

CMTEQ

Күн бұрын

Пікірлер: 41
@CMTEQ
@CMTEQ Жыл бұрын
If you ❤ my content and find it helpful, please Subscribe and hit the Bell 🔔 👇 SUBSCRIBE TO CMTEQ CHANNEL NOW 👇 kzbin.info
@botak333
@botak333 6 ай бұрын
Hi mate, can wi fix the pwm duty cycle is 50% or 70%?? Or if we leaf the pulse to 0 is what happen???
@CMTEQ
@CMTEQ 6 ай бұрын
Yes, you can fix the duty cycle at any value you want between 0 and 100%. If you leave the duty cycle at 0, the signal will be off, zero. If you leave it at 100% , the signal will be 5V continuous
@botak333
@botak333 6 ай бұрын
@@CMTEQ no, i see on the mc workbench is pulse=0 sir. What is that mean?? Because i used for motor control, and i want to fix the pwm on 50 or 70% sir.
@CMTEQ
@CMTEQ 6 ай бұрын
@@botak333 Hi, did you come right with your test for 50% PWM Duty cycle?
@botak333
@botak333 6 ай бұрын
@@CMTEQ i dont know, because the code from x cube mcsdk, that is deferent with code from cube mx sir. In cube mx i can set the ccr, but on mc sdk i see on the code is (pwm_duty) / 2; like that sir. Not the fix number like 1000 or semilar
@iliketrainsguy5918
@iliketrainsguy5918 2 ай бұрын
I just saw 1/4 video and I'm already serious thinking about subscribing rn, what a nice and useful video, right what I needed
@CMTEQ
@CMTEQ 2 ай бұрын
Thank you, I'm glad it was useful
@tomas_soeterik
@tomas_soeterik 9 ай бұрын
Very good video, underrated in every way, ai needed some explanation on pwm
@CMTEQ
@CMTEQ 9 ай бұрын
Thank you for your feedback. Please support by sharing, much appreciated 🙏.
@richardprogramming9402
@richardprogramming9402 10 ай бұрын
This video was very useful!! Thanks!!
@CMTEQ
@CMTEQ 10 ай бұрын
You are most welcome !
@BillyChrist-r2k
@BillyChrist-r2k 7 ай бұрын
Your content is great, but just ONE reminder about like/subscribe somewhere in your video is all you need. Having random animations appear over your video with tones takes away from your content! Anyways, your work here has saved me many hours of research, and I am a happy subscriber!
@CMTEQ
@CMTEQ 7 ай бұрын
Hi William, Thank you for the feedback, well Noted.
@CMTEQ
@CMTEQ 11 ай бұрын
Analyze PWM signal using SIGLENT SDS 1104X-E Digital Storage Oscilloscope kzbin.info/www/bejne/Y4GkYZ-oaKysd7M
@ashleed6800
@ashleed6800 9 ай бұрын
Are the terminals from GND (black wire) and PWM/D11 (red wire) both directly connected to the oscilloscope? What is your wiring set up?
@CMTEQ
@CMTEQ 9 ай бұрын
Yes that is correct. I'm doing a simple GND reference measurement. Scope croc clip connected to GND(Black Wire) and Scope Channel 1 (Yellow) probe connected to Red wire D11.
@ashleed6800
@ashleed6800 9 ай бұрын
@@CMTEQThank you so much! I am currently using PWM for this STM (and this code) and with Escon 50/5 motor driver. What wiring set up would you recommend? I connected PWM/D11 to the Input PWM pin on Escon. What about the ground & power supply connections?
@CMTEQ
@CMTEQ 9 ай бұрын
Hi Ashlee, if your Escon 50/5 motor driver and stm32 board are sharing the same power supply then you can connect your Escon 50/5 motor driver GND to the same GND black wire on your stm32 or on your power supply, while keeping the PWM Pin connected on the Escon PWM input. You should be able to control your motor. If you need more assistance, like schematic and hardware connection, you can consider joining my low voltage membership, I will provide you technical assistance.
@ashleed6800
@ashleed6800 9 ай бұрын
@@CMTEQ I will look into your membership! Thanks again. :)
@botak333
@botak333 6 ай бұрын
hi mate how about like this??? Code: htim1.Init.Period = ((PWM_PERIOD_CYCLES) / 2); Code: sConfigOC.Pulse = (uint32_t)(((PWM_PERIOD_CYCLES) / 2) * 0.6); It will working?? So no need set pwmc setphasavoltage, because global pwm duty (pulse) already set max 60%?? Or this will set all tim for 60% sir?? Any idea?? Thank u@@CMTEQ
@johnfrancis923
@johnfrancis923 6 ай бұрын
In my case, I am using an external oscillator to generate the system clock. However, I'm not finding an option to select the external clock as the source. What should I do? i am using cubeMX tool to configure?
@CMTEQ
@CMTEQ 6 ай бұрын
Hi, I will have a look later. Please check my video on clock configuration. kzbin.info/www/bejne/eYbKgYuqaa94lcU
@mohamedansari_stm
@mohamedansari_stm 7 ай бұрын
Fantastic video mate !! . What should be the prescaler and period value if i want to have a frequency of 400khz?
@CMTEQ
@CMTEQ 7 ай бұрын
Hi thank you for your feedback. If you want to generate a 400kHz frequency you just need to play with the Prescaler and period value, I mentioned it in the video. So for 400kHz you can setup your values as follow prescaler = 20 and period = 7. depending on measuring equipment you might not get the exact 400kHz, if thats the case you can decrease the prescaler = 19. Please note that this is based on the 64MHz clock frequency if your frequency is higher or less than you just need to play with the period and prescaler value until you get your desired frequency,.
@mohamedansari_stm
@mohamedansari_stm 7 ай бұрын
Mate.. You are the best, This is the most underrated channel ever@@CMTEQ . I have achieved 400khz freq. THanks to you. Now i am trying to create a function that gets uint32_t input data from user and converts into pwm signals with logical 1 having 70% high and 30% low and logical 0 -vice versa. Can you help me?
@CMTEQ
@CMTEQ 7 ай бұрын
That sound very easy to implement. I'm not sure which method you gonna use to get user input, buttons/keyboard etc... But you can first create a function that increment your uint32_t var locally and pass it into your Timer Init function to change the duty cycle value. Once you have that working you should see your pwm duty cycle change automatically as the code runs. Once you are satisfied you can then get the value externally by a user, sound like a nice project, an LCD would be a great addidtion to see whats going on. Time is always an issue, the best way to get assitance fast is by become the channel member.
@lenzneethling3164
@lenzneethling3164 6 ай бұрын
Very helpful !!
@CMTEQ
@CMTEQ 6 ай бұрын
Great 👍, I'm glad it was helpful
@shamilsha7618
@shamilsha7618 7 ай бұрын
Can we shift the pwm sideways by 50% of the counter period?
@CMTEQ
@CMTEQ 7 ай бұрын
Hi, by sideway I believe you mean shifting left or right, leaving the Frequency and period fixed, you can probably achieve that by playing with the Duty Cycle, you can either halve or double the high time. Try playing with those values and see what you get.
@STrAnGeR785
@STrAnGeR785 9 ай бұрын
can you please share the code
@CMTEQ
@CMTEQ 9 ай бұрын
Hi, I have attached the main.c file under the video description. Try to follow the tutorial you should be able to produce the same PWM signal.
@kylekingsberry5680
@kylekingsberry5680 Жыл бұрын
The pulse width wasn't being modulated here lol you just showed how to generate a square wave.
@CMTEQ
@CMTEQ Жыл бұрын
Hi, Thank you for your humorous comment. A square wave is a PWM signal with a constant duty cycle and amplitude. More control can be introduced, like changing the duty cycle periodically in the code to achieve the desired modulation.
11. How to configure stm32 adc using DMA Conversion
19:20
STM32: PWM шаг за шагом на STM32CubeIDE
10:51
G1Tech
Рет қаралды 28 М.
Sigma baby, you've conquered soap! 😲😮‍💨 LeoNata family #shorts
00:37
啊?就这么水灵灵的穿上了?
00:18
一航1
Рет қаралды 101 МЛН
How to whistle ?? 😱😱
00:31
Tibo InShape
Рет қаралды 22 МЛН
How PWM works | Controlling a DC motor with a homemade circuit
10:01
Analog output from PWM and a low-pass filter
14:13
nLab
Рет қаралды 11 М.
STM32 Guide #3: PWM + Timers
20:24
Mitch Davis
Рет қаралды 147 М.
STM32 TIMERS #1. PWM Output || DMA
12:36
ControllersTech
Рет қаралды 131 М.
Flawless PCB design: RF rules of thumb - Part 1
15:45
Hans Rosenberg
Рет қаралды 82 М.
How do Graphics Cards Work?  Exploring GPU Architecture
28:30
Branch Education
Рет қаралды 1 МЛН
STM32 Guide #4: Generated Code, HAL, and Bare Metal
26:20
Mitch Davis
Рет қаралды 84 М.
STM32 PWM basics
18:31
Random Rick
Рет қаралды 21 М.
Sigma baby, you've conquered soap! 😲😮‍💨 LeoNata family #shorts
00:37