- This topic has 0 replies, 1 voice, and was last updated 6 years, 8 months ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
Home › Forums › Mastering STM32 book support forum › MARRED PWM Based SINE WAVE
Dear Mr. Carmine Noviello,
Hope all is well. I have purchased your book to be able to speak and write in HAL.
At this point, I have a particular question regarding PWMs. I have two independent codes in which 3 bytes oF freq and amplitude info are transmitted and received and a sine wave is drawn by a PWM timer.
Once I try to combine both into one code that is governed by timers (timer10 that has a period of 1.5ms for UART TX, UART RX is done by an USART interrupt, TIM3 working at 2kHz which is so far only responsible for using another timer, TIMER2 that works at 10KHz. Eventually I got 50Hz and many other sines/shapes propagating based on the setcompare function on the scope independently but once I combine the codes in which 3 bytes of amp. and freq are transmitted and received then a sine wave is determined subsequently, there exists such an ugly sine as in attached. I believe TIMER2 based PWM is affected on simultaneous activation and more specifically I have never put HAL_TIM_PWM_Stop and let PWM start once and run for all.
Could you pls let me know what the probable reasons might be?
Hope I am clear and look forward to hearing from you soon.
BR,
Serkan