Тёмный
No video :(

Stm32 Timers in PWM mode 

Eddie Amaya
Подписаться 10 тыс.
Просмотров 48 тыс.
50% 1

visit: www.edwinfairc...
more videos coming soon 2024

Опубликовано:

 

27 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 118   
@subramaniantr2091
@subramaniantr2091 4 года назад
Probably the only tutorial series on stm32 I really value in the RU-vid. Thank you for opening the registers unlike other videos which dwell on the shortcut cube mx.
@joseernestolinareschavez3235
True, I love him
@king998100
@king998100 5 лет назад
This is the best and most intuitive tutorial ever...
@gerardelbers2882
@gerardelbers2882 4 года назад
Hi. A small detail that I learned from a colleaugue. If you want to divide your clock by 72 you sould load PSC with 72-1 = 71 because counting from 0 to 71 is 72 intervals. You will see that your period will change from 985.4 Hz to 999.8 Hz. That's what you wanted. This is true for all counters (also ARR), if you want N then load value N-1.
@EdwinFairchild
@EdwinFairchild 4 года назад
Ahh thank you!!!!!! I'll update the description
@jacobdavis000
@jacobdavis000 5 лет назад
I got your code to work with my bluepill. Thanks a lot for the excellent tutorial. I just started learning to program this MCU and I appreciate showing me code that works. It helps a lot with the learning curve this thing has.
@EdwinFairchild
@EdwinFairchild 5 лет назад
thanks for the comment! keep an eye out for my website edwinfairchild.com i will be uploading new content shortly , currently its under construction so its incomplete on most pages but itll get good once i get going
@jacobdavis000
@jacobdavis000 5 лет назад
I just added it to my dev literature links. Thanks!
@alirezamoosavian3143
@alirezamoosavian3143 3 года назад
can you please somehow send me your code on bluepill? it dosen't work for mine.
@DS-ls7ck
@DS-ls7ck 2 года назад
The best explanation ever. English is not my language. Even I understood your explanation
@lulighttec
@lulighttec 4 года назад
I have enjoyed watching these timer tutorials, and I plan to watch the others about the STM32, as I have a project that needs an MCU and I have limited knowledge and experience with them, so thanks for putting these together! Now, if you could do one on how to use these timer PWM to individually control several small bipolar steppers, say, using some L293D Quad H-bridges to drive the motors, that would be SUPER useful, especially if that could be expanded on to control more motors than the STM32 has timer channels... I feel like that might have something to do with Bitwise operations and Shift registers? After I have that part worked out, I can work on the rest of it.
@EdwinFairchild
@EdwinFairchild 4 года назад
glad they can help
@rtsservices3511
@rtsservices3511 5 лет назад
hi eddie , thank you so much for all your tutorials. your last words are priceless: make your own videos or try to explain all this to other. thats really the best way to learn and show yourself if you are able to explain all this with your own words ! you re so right
@damianmelamed1706
@damianmelamed1706 3 года назад
Hey man! i've found why the frequency was wrong. The preesclaer is set to "PSC + 1". So you were dividing 72MHz by 73000 resulting in 986Hz. Besides thatt, it's just a great video
@kenwallace6493
@kenwallace6493 3 года назад
Still a great video for the bare metal folks. Carry on, Eddie.
@matteociofani2881
@matteociofani2881 4 года назад
This video is incredibly useful!!!! I’ll see all the other in the playlist, thank you so much!!
@MuhammadAbdullah-ch2ow
@MuhammadAbdullah-ch2ow 2 года назад
Thanks a lot👍 Really helpful tutorial. We didn't have enough time to study it in the semester but you saved me. Implementing this in my project. Works perfectly. Amazing work👍
@guilhermeartuzo7630
@guilhermeartuzo7630 4 года назад
Great lesson on PWM, the best one i've found so far ! I have just started to learn this concepts and this was really helpfull and informative. By the way, i think you should have tried 72-1 on the PSC register, that might be the thing you were looking for in the end.
@EdwinFairchild
@EdwinFairchild 4 года назад
correct!!!!
@uber-jaianada
@uber-jaianada 5 лет назад
DUDE! your presentation is superb and helps demystify and shorten the learning curve by A LOT! THANK YOU!!
@arunprakasan4948
@arunprakasan4948 5 лет назад
Hi..Your tutorials are awesome.Please do a tutorial on how to use RTC in STM32. Thanks in advance
@BeMuslimOnly
@BeMuslimOnly 2 года назад
PSC should be 72-1 for 1 kHz frequency... Thanks for your video..
@ecarvalho17
@ecarvalho17 4 года назад
Nice video. Do you plan to do a tutorial on PWM input too?
@mistymisty4480
@mistymisty4480 5 лет назад
Another excellent video thanks
@thomasbaars5948
@thomasbaars5948 3 года назад
This video helped immensely, thank you very much.
@julian10g
@julian10g 3 года назад
Thanks Eddie!
@elifklnc6240
@elifklnc6240 3 года назад
Hi Eddie ! I did not understand. How do we find the midpoint of the pwm signal ? Can you help me ?
@practicallife3377
@practicallife3377 2 года назад
your videos are awesome Can you please provide a tutorial on DMA COMPARE MATCH IN PWM
@EdwinFairchild
@EdwinFairchild 2 года назад
Hmm never heard of compare match dma , what's it use case?
@timowolff1105
@timowolff1105 4 года назад
Sir, this is a great informative video thank you so much for uploading this. However i got a question, if you want to create a „sinusoidal“ output at least for the motor pretended would you have to set a seperate register which changes the CCR4 register figure every period or how would you do this?
@EdwinFairchild
@EdwinFairchild 4 года назад
If you just changed the ccr4 register it would only make you signal be wider or shorter it would not change the amplitude like a real sine wave. There is a way . I might make a video on it soon
@timowolff1105
@timowolff1105 4 года назад
Eddie Amaya I'm looking forward. Abo is sure. But meanwhile I spotted the mistake myself. I'm trying to understand working and signal generation of a three phase Inverter using Space vector Modulation. In Space Vector modulation, there is no need to create a sinusoidal looking waveform right? There are up and down counting timers with a ccr4 value hitting twice per time period which is enough for the motor to run.
@last-zura8899
@last-zura8899 Год назад
Thank you
@GregLangford89
@GregLangford89 3 года назад
Hey Eddie, thanks for the great videos do you know if there is a way with SWV to show an output waveform of a timer? In my case I am generating a PWM signal and I wanted to use something like SWV trace timeline to view the generated waveform, is this at all possible?
@Awhobiwom
@Awhobiwom 5 лет назад
Hi Eddie, thanks for the great tutorial. How do I configure it if want to change the duty cycle each time I press the blue button (portA 0)
@fakharealiraza1205
@fakharealiraza1205 Год назад
hi eddie . I had one question. Is the desired frequency , the counter clock frequency? or the pwm frequency? which one is it?
@fakharealiraza1205
@fakharealiraza1205 Год назад
In my opinion the desired frequency is just the counter clock frequency which gives us the time of each count until we reach ARR value , right? whereas the pwm frquency is dependent on arr value.i.e the time period of ARR which translates into frquency.
@phamngocat1564
@phamngocat1564 2 года назад
thanks a lot
@vikasmarkanday6663
@vikasmarkanday6663 5 лет назад
wow... what a tutorial !!!
@Diego4322237
@Diego4322237 4 года назад
Excelente video. Thanks.
@allinthefamiliy3122
@allinthefamiliy3122 2 года назад
Thanks man, to me it was very helpful. The counter frequency is fpwm=fosc/((ARR+1)*(PSC+1)), that is why you had a difference on your logic analyzer. I have a question I want to build a synchronous Buck Converter and need to use the PWM on TIM1 ch1..3 with it's complementary outputs and the programmable dead time for that. You talked about the fact that using TIM1 for PWM was not a good idea. The blue pill has these function only on TIM1 ch1..3 so what is the reason that you said that using TIM1 for PWM is not a good idea. Anyone that can help me is appreciated.
@linwei1390
@linwei1390 4 года назад
Gesus thanks for making this!!!
@jamescullins2709
@jamescullins2709 5 лет назад
Do you have a video on the One Pulse Mode? I need to use an external interrupt and start a timer to generate one pulse each time it is triggered and use a 12bit analog sig to control the pulse width.
@EdwinFairchild
@EdwinFairchild 5 лет назад
I do not have a video on one pulse mode, and I am currently working on a freelance project. But I will get it soon as I'm done in the new few days maybe by the weekend. Sorry
@jamescullins2709
@jamescullins2709 5 лет назад
@@EdwinFairchild Great! I am looking fwd to viewing it.
@sheikabdullah8475
@sheikabdullah8475 Год назад
Hi eddy, I'm using the same way how you did but with timer1 channel3 in stm32f103c8t6 (PA10), It is not working will you help me?
@roderickdiaz3834
@roderickdiaz3834 5 лет назад
If I want to have a Fixed frequency and the variable duty cycle (the problem is not the duty cycle) the problem is to set a frequency above 15khz which forms utilisations to establish in the code and have a similar output since they always appear only 1khz with the scope
@EdwinFairchild
@EdwinFairchild 5 лет назад
Not sure what the question is
@roderickdiaz3834
@roderickdiaz3834 5 лет назад
@@EdwinFairchild generate pwm from minimum 10khz to 25khz
@EdwinFairchild
@EdwinFairchild 5 лет назад
@@roderickdiaz3834 if you are only getting 1Khz even when having different ARR values something is wrong. I dont know what your code is , i dont know what speed the microcontroller is operating at..so idk how i can help
@Ech01378
@Ech01378 5 лет назад
Hello, Thanks for the Video! I am trying to make my own board, but the problem is that when I program the micro using the stlink, it dies (smoking!). The thing is that I've designed Boot0 and Boot1 to GND directly with no resistor, and the OSC32_IN to GND and the OSC32_OUT to sink the current from a pair resistor-led connected to the 3.3v. Idk why it is burning my stm32f103c8 when I program it. Could you help me?
@EdwinFairchild
@EdwinFairchild 5 лет назад
Email me a picture of your schematic
@Ech01378
@Ech01378 5 лет назад
@@EdwinFairchild sure, could you tell me what's your email?
@ahmedsaeed234
@ahmedsaeed234 3 года назад
I NEED PWM TO CONTROL SERVO MOTOR WHAT IS THE CHANGE I CAN DO IN THIS CODE??
@mariammansoor2279
@mariammansoor2279 3 года назад
Me too
@buildlover9959
@buildlover9959 4 года назад
Awesome! Very nice tutorial. Thanks man. Actually your waveform is pretty accurate because your actual prescaler is 72+1=73 and ARR value is 1000+1=1001, So (72Mhz/(73*1001))= 985.3 hz . May I know what kind of logic analyzer is that?
@EdwinFairchild
@EdwinFairchild 4 года назад
It's a Saleae logic analyzer , but they have better software beta version now but the hardware is too expensive there are cheaper options , this one I got through my school discount
@buildlover9959
@buildlover9959 4 года назад
@@EdwinFairchild Thanks. I checked it's really expensive.
@EdwinFairchild
@EdwinFairchild 4 года назад
@@buildlover9959 the cheap ones from Amazon work just fine for me also
@Stimmenhotel
@Stimmenhotel 4 года назад
@@EdwinFairchild ​ @Iman Davoudi Just a little hint: Sigrock Pulseview! (Free and Open Source) If you use the Saleae official client with clones it is not legal. I don't know how much difference is between both softwares, since my clone won't even run with the saleae software... Maybe I killed the support while trying to have it running with pulseview and after having it running it wasn't detected on the saleae one. But I am very happy with the clone and pulseview anyway ;-) PS: Thanks for your indepth video! Sadly I try to use CubeMX for configuration and don't get a higher frequency as 8MHz if I change the coresponding clocks in the clock tree ... only if I mess with the PLL Prescaler ...
@EdwinFairchild
@EdwinFairchild 4 года назад
@@Stimmenhotel that is the purpose of pll to get higher clock frequencies
@MilanKarakas
@MilanKarakas 5 лет назад
One, maybe stupid question - I tried to run Timer 1, but all I got is printf output with changing numbers, but can't get anything at the output pin (GPIO A11). Does it can work as a PWM or not? Thanks.
@EdwinFairchild
@EdwinFairchild 5 лет назад
you should really use the resources you have. Open CUBEMX select stm32f103c8 then select timer 1 and look at the channel that corresponds to PA11 and see if that channel can do PWM..... also the manual/datasheet will tell you that TIM1 is an advanced timer versus a general purpose timer so maybe it needs more configuration. You have a lot of tools to help
@MilanKarakas
@MilanKarakas 5 лет назад
@@EdwinFairchild Thanks. Yes, it has PWM. Spent whole night trying to get it running, but got only svprinf() output that shows change in 'TIM1->CNT'. No output to PA11. Here is how I enabled this port: void gpioA11enable() //enabling pin A11 for alternate PP, 50 MHz, output { GPIOA->CRH |= GPIO_CRH_MODE11_0 | GPIO_CRH_MODE11_1 | GPIO_CRH_CNF11_1; //50 MHz, alternate PP 1/2 (4,5,7) GPIOA->CRH &= ~(GPIO_CRH_CNF11_0); //second part //alternate PP 2/2 (6) } And, timer 1 enable function. Perhaps something is set wrong. I guessed, turning on and off.... void timer1enable() { RCC->APB2ENR |= RCC_APB2ENR_IOPBEN | RCC_APB2ENR_IOPAEN | RCC_APB2ENR_AFIOEN; //port B clock enabled (3), port A clock enable (2), Alternate IO clock enable (0) RCC->APB2ENR |= RCC_APB2ENR_TIM1EN; //timer 1 clock enable (2) TIM1->CCER |= TIM_CCER_CC4E; //capture/compare timer1 output enable TIM1->CR1 |= TIM_CR1_ARPE; //auto reload preload enable TIMxARR is buffered TIM1->CCMR2 |= TIM_CCMR2_OC4M_1 | TIM_CCMR2_OC4M_2 | TIM_CCMR2_OC4PE; //output compare 4 mode 0b110 (14:12)?, output compare 4 preload enable TIM1->CCMR2 &= TIM_CCMR2_OC4M_0; //TIM1->BDTR |= TIM_BDTR_MOE| TIM_BDTR_AOE; TIM1->BDTR |= 1; TIM1->CR2 |= TIM_CR2_MMS_0|TIM_CR2_MMS_1|TIM_CR2_MMS_2; //PWM freq = Fclk/PSC/ARR 72MHz/1000 //PWM Duty = CCR4/ARR TIM1->PSC = 72; //prescaler value, 72 MHz divided by: TIM1->ARR = 10; //auto reload register, 1000 to get 72e6/1e3 TIM1->CCR4= 5; //capture/compare value, duty cycle 25% TIM1->RCR |=10; TIM1->CR1 &= ~(TIM_CR1_UDIS); //not yet, just to see whether it works without TIM1->SMCR &= (TIM_SMCR_SMS_0 | TIM_SMCR_SMS_1 | TIM_SMCR_SMS_2); TIM1->SMCR &= ~(TIM_SMCR_ECE); TIM1->EGR |= TIM_EGR_UG; //update generation, re-initialize TIM1->CR1 |= TIM_CR1_CEN; //counter enabled }
@zlac
@zlac 4 года назад
So it's 4 PWM outputs max? Or is it 16? As I understand it, there are 4 PWM timers so we can have 4 different (or same) time bases. Each timer can output to 4 different OC pins with different duty cycle so we can actually have 16 PWM outputs. Or am I getting something wrong here?
@EdwinFairchild
@EdwinFairchild 4 года назад
Correct 4 per timer that has PWM
@amolmotar3933
@amolmotar3933 5 лет назад
Hi Eddie i want to generate 512khz pwm signal from 48mhz input signal .. Can you help me to find formula which can correctly set prescaler(psc),time period(ARR ),pulse..I tried with few formula but it fails to generate output of 512khz
@aboabdo3516
@aboabdo3516 Год назад
Hi, please can i have the link for this stm32fxx datasheet you are using here?
@hendrasutanto9724
@hendrasutanto9724 5 лет назад
Hey eddie thx for the video 👍. Btw could you send the link or share the datasheet that youre using. I have download the datasheet from stm but it's not the same with yours. Thx
@EdwinFairchild
@EdwinFairchild 5 лет назад
It's called RM reference manual. Go to the site it's called RM008 www.st.com/en/microcontrollers/stm32f103c8.html#design-scroll
@shayanghezelbash8938
@shayanghezelbash8938 4 года назад
hey eddie nice video if you could just make a video wich you adjust a dc motor by this program what would be great ... :p
@EdwinFairchild
@EdwinFairchild 4 года назад
Yeah that's a good idea, but it's a lot more electronics involved, I was making a DC motor controller a while ago, you just have to take this pwm signal into some logic level mosfets arranged in an h-bridge. And obviously protections for shoot through and induction spikes should be implemented. The code part is the easiest it's just this PWM with some dead time implemented, I think the stm32 has a PWM mode with deadtime implemented to drive stuff like DC motors
@shayanghezelbash8938
@shayanghezelbash8938 4 года назад
@@EdwinFairchild ohlala ..... alright , thank you for quick respond
@phamquoctrung2207
@phamquoctrung2207 4 года назад
thank u!
@annaoaulinovna
@annaoaulinovna 4 года назад
Why timer1 of stm32f103c disables moe bits every time? And how can we remap pa0- wakeup pin? timer2 channel 1 is mixed with pa0 wake-up pin. Why stm32f103c timer1 dont give good output over 0.7v when we use over 50khz 0.5 duty cycle.
@EdwinFairchild
@EdwinFairchild 4 года назад
I'll have to answer all that when I get home and can really read what you're asking...
@jaydenyu8542
@jaydenyu8542 4 года назад
Hi, How do you determine the pre scaler value?
@yvindaure2135
@yvindaure2135 3 года назад
Can this do PWM phase shift?
@manisrinivas_hyd
@manisrinivas_hyd 4 года назад
Great video - can you us how to create a project in keil?
@EdwinFairchild
@EdwinFairchild 4 года назад
I did already
@andygyakobo7122
@andygyakobo7122 5 лет назад
You the boss man!
@bobdole27
@bobdole27 5 лет назад
Im happy I can finally find a decent STM32 guide that doesn't use the dam HAL library This guy is a legend in my book
@rupeshjha7006
@rupeshjha7006 4 года назад
Hi, Could you please help me with Phase shift in PWM. Thanks
@manardyab6268
@manardyab6268 5 лет назад
thanks for your very good demo but its hard for me to understand what i should write first and what should write at the end can you upload the working code that you test ....
@EdwinFairchild
@EdwinFairchild 5 лет назад
You have to watch the entire video series not just the first video. And I don't upload code because then people just copy and paste and it does not stick in their brain.
@damnedattendant2536
@damnedattendant2536 5 лет назад
@@EdwinFairchild One hell of a reply ... You are a true teacher mister .... Thanks for the awesome videos ....
@zulkarnaine
@zulkarnaine 3 года назад
i need phase shift for this if you know please help
@AS-zs7jw
@AS-zs7jw 3 года назад
You selected alternate function for timer4 on PB9 , if there are more than one alternate function on a pin how we will select particular alternate function?
@EdwinFairchild
@EdwinFairchild 3 года назад
It depends on what chip you are using. Some chips have a register where you select the alternate function . Alternate function is just the mode. There is also an alternate function register that can be used. Again refer to the manual. These videos are somewhat old and the chip itself is very old. I don't use F1 anymore. Will make.new videos soon
@AS-zs7jw
@AS-zs7jw 3 года назад
@@EdwinFairchild in stm32f407 or stm32f429 there is a register to select alternate function number AF0 or AF1 etc, to select paritcular alernate function if a pin has more than one alternate functions. but in stm32f103c8 what there is no such register, can you please make video of PWM with complementary output? waiting for your video, thankyou very much for such a great register level progamming play list
@AS-zs7jw
@AS-zs7jw 3 года назад
​@@EdwinFairchild in stm32f407 or stm32f429 there is a register to select alternate function number AF0 or AF1 etc, to select paritcular alernate function if a pin has more than one alternate functions(pin has UART, TIM1, ADC1). but in stm32f103c8 what there is no such register( how we will connect pin to TIM1 etc if pin has UART, TIM1, ADC1 etc ), can you please make video of PWM with complementary output? waiting for your video, thankyou very much for such a great register level progamming play list
@EdwinFairchild
@EdwinFairchild 3 года назад
@@AS-zs7jw in F1 , if you select a pin for alternate function then configure a Timer to use that pin then it will use it. If you configure UART then uART will use it. The point is you don't manually select which alternate fucntion. You just configure to accept alternate function and then when you set up a peripheral that uses it then that's it. It is the programmers job to know which peripherals use it and not to use 2 peripherals on the same pin. If 2 pin has UART, and Timer, and I2C function , then it's your job to make sure you're don't mess up and try to use multiple things on the same pin. And you can refer to the datasheet to see pin functions.
@AS-zs7jw
@AS-zs7jw 3 года назад
@@EdwinFairchild thank you, it is clear now, please make video for complementry pwm with dead time.
@ShivamKumar-ky6vm
@ShivamKumar-ky6vm 2 года назад
What is the differnce between PWM and TIMERS IN PWM MODE ??
@EdwinFairchild
@EdwinFairchild 2 года назад
Timers in PWM is how you acheive PWM lol ... its the same thing ... except it sounds weird if you always say "i used timer in pwm mode to fade this LED" so people just say PWM
@ShivamKumar-ky6vm
@ShivamKumar-ky6vm 2 года назад
@@EdwinFairchild no sir there is a difference , which i might guess u do know , have u ever used TIVA , kindly check its datasheet. We have a PWM register to generate PWM instead of doing the same work by using timers . Do let me know if im wrong , ill share the link where PWM is not generated using timers , however by using the PWM module .
@EdwinFairchild
@EdwinFairchild 2 года назад
@@ShivamKumar-ky6vm ok well yeah now youre talking about a different micro, since the questioned was posed in an STM32 timers video the answer still stand with respect to this context. What other Micros do is a muc broader conversaation. How ever if you get down to the design of that TIVA im sure when you look at the design or a timer and a hardware dedicated pwm peripheral you will see a whole lot of similarities , maybe they offer a softcore on an FPGA so you can get an idea of how similar that will be compared to a timer.
@ShivamKumar-ky6vm
@ShivamKumar-ky6vm 2 года назад
@@EdwinFairchild i got your points ✌️
@imcnx1563
@imcnx1563 4 года назад
hi, how to use logic analyzer with keil?
@Stimmenhotel
@Stimmenhotel 4 года назад
It is a external device. the original one is called saleae logic analyzer and can be connected externaly to the controller. There are cheap clones avaiable as well which nicely runs with a software called pulseview
@MilanKarakas
@MilanKarakas 5 лет назад
Please help. Following this video and copy/paste your code (infrequent screen "flashing")... Here is what I got, but not working PWM: #include "stm32f10x.h" #include #include "string.h" #include "stdlib.h" #include "stdarg.h" #define DEBUG_UART USART1 void delay(long cycles); void strobe(void); static void printMsg(char *msg, ...); void delay(long cycles) { while(cycles >0) cycles--; } void strobe() { GPIOB->BSRR = (1CRH &= ~(GPIO_CRH_CNF9_0); //port A9(6) //clkPer/(baudRx16)=72MHZ/9600x16) //468.75 USART1->BRR = 0x1D4C; //468 = 0x1D4, 0.75*16=12 or 0xC, together 0x1D4C USART1->CR1 |= USART_CR1_TE; USART1->CR1 |= USART_CR1_UE; //enabling pin B1 for push-pull, 2 MHz, output RCC->APB2ENR |=(1
@EdwinFairchild
@EdwinFairchild 5 лет назад
rewatch @23:19 you are setting bits pin 9 for general purpose output , this is PWM which is an alternate function.... general purpose means just to drive pin high or low...PWM is totaly different. ... 7 and 6 need to be set to Alternate function push pull
@MilanKarakas
@MilanKarakas 5 лет назад
@@EdwinFairchild Oh, thanks. I am lost with all that names. What I am used to is thinking about switches inside registers, sorted by numbers above the name, not names itself. Now I am halfway, and it works. Thanks! Here is how now looks working version (still need to "translate" words into numbers for the rest): #include "stm32f10x.h" #include #include "string.h" #include "stdlib.h" #include "stdarg.h" #define DEBUG_UART USART1 void delay(long cycles); void strobe(void); void usart1enable(void); void gpioB1enable(void); void gpioB9enable(void); void timer4enablePWM(void); static void printMsg(char *msg, ...); void delay(long cycles) { while(cycles >0) cycles--; } void strobe() { GPIOB->BSRR = (1CRH &= ~(GPIO_CRH_CNF9_0); //port A9(6) //clkPer/(baudRx16)=72MHZ/9600x16) //468.75 USART1->BRR = 0x1D4C; //468 = 0x1D4, 0.75*16=12 or 0xC, together 0x1D4C USART1->CR1 |= USART_CR1_TE; //whatever USART1->CR1 |= USART_CR1_UE; //whatever } void gpioB1enable() //enabling pin B1 for push-pull, 2 MHz, output { RCC->APB2ENR |=(1
@mehmetberatsen2150
@mehmetberatsen2150 4 года назад
İ cant get an output via PB9 help please
@EdwinFairchild
@EdwinFairchild 4 года назад
😔 what chip do you have and what have you typed . And have tried pressing reset on the mcu after uploading the code
@mehmetberatsen2150
@mehmetberatsen2150 4 года назад
@@EdwinFairchild can i get your mail adress for sending my code?
@mehmetberatsen2150
@mehmetberatsen2150 4 года назад
@@EdwinFairchild #include "stm32f10x.h" int main() { RCC->APB2ENR |= RCC_APB2ENR_IOPBEN | RCC_APB2ENR_AFIOEN; RCC->APB1ENR |= RCC_APB1ENR_TIM4EN ; GPIOB->CRH |= GPIO_CRH_MODE9_0 | GPIO_CRH_MODE9_1 | GPIO_CRH_CNF9_1; GPIOB->CRH &= ~(GPIO_CRH_CNF9_0 ); TIM4->CCER |= TIM_CCER_CC4E; TIM4->CR1 |= TIM_CR1_ARPE; TIM4->CCMR2 |= TIM_CCMR2_OC4M_1 | TIM_CCMR2_OC4M_2 | TIM_CCMR2_OC4PE; //PWM FREQ =FCLK/PSC/ARR //PWM DUTY =CCR4/ARR TIM4->PSC = 72; TIM4->ARR = 1000; TIM4->CCR4 = 1000; TIM4->EGR |= TIM_EGR_UG; TIM4->CR1 |= TIM_CR1_CEN; while(1) { } }
@csxinfo1
@csxinfo1 4 года назад
Hey great video, I'm looking for the datasheet and I can't found can someone gives me a link pls
@EdwinFairchild
@EdwinFairchild 4 года назад
Really??? Google 🤣
@EdwinFairchild
@EdwinFairchild 4 года назад
Google "stm32f103 reference manual "
@csxinfo1
@csxinfo1 4 года назад
🤣 🤣 🤣 🤣 No I mean I didn't find the same one with the register haha 😂 😂 I'm not that dump, u now all genius follow your ytb channel
@csxinfo1
@csxinfo1 4 года назад
OK I'm that dump, I just google it and it was the first result I dropped by myself the qi average of this channel by 200 at once sry for bothering you
@Synthetech
@Synthetech 5 лет назад
Tweak those PWM's a bit further.. throw on a 10k pot, hook up the gpios to a stereo and get this.. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-sf8gkzmJMAo.html ;-)
Далее
Stm32 Delay Using Timers or Systick
24:42
Просмотров 36 тыс.
STM32 Guide #3: PWM + Timers
20:24
Просмотров 140 тыс.
😭Телеграм УДАЛЯЮТ❌
00:50
Просмотров 70 тыс.
Stm32 Intro To timers
24:34
Просмотров 53 тыс.
Stm32 ADC Pt:1 OverView
20:17
Просмотров 30 тыс.
STM32 PWM basics
18:31
Просмотров 20 тыс.
STM32 UART Part 1: Datasheet overview
29:59
Просмотров 16 тыс.
STM32 DMA PT 1
26:40
Просмотров 39 тыс.
STM32 SPI: Pt 6
34:05
Просмотров 7 тыс.
STM32CubeMX ADC with Interrupts
15:02
Просмотров 10 тыс.
Using I2C for any device on STM32 with HAL | VIDEO 26
37:51
STM32 SPI: Pt 2
5:32
Просмотров 6 тыс.