2021-07-19 06:10 AM
Hi,
how to generate the sine wave using pulse width modulation for 5Khz frequency using Sine wave look up table. I have already created the sine wave look up table but I am not getting how to do with the help of sine wave look up table to generate the sine wave.
Please help me how to write the code for this concept.
Thank you.
2021-07-19 06:47 AM
To do this, you would use DMA to transfer the duty cycle values into CCRx after each timer update or OC event. You can use HAL_TIM_PWM_Start_DMA to do this.
2021-07-19 10:02 PM
Thank you.
is it required to generate a timer with interrupt to vary the duty cycle 0% to 95% to generate the sine wave for 360 points form by generating pulse width modulation . For every 4msec I have to generate one sine wave form.
2021-07-20 03:34 AM
Maybe you should take a look at this https://deepbluembedded.com/stm32-change-pwm-duty-cycle-with-dma-for-sine-wave-generation/
2021-07-20 03:45 AM
Thank you
I have referred this one but they are using DAC to generate the sine wave. I am not using DAC. I just want by generating the PWM signals at 5Khz frequency in stm32f103c8t6.
In created sine look up table they have defined as an array from the look up table. How to defined that numbers from the sine lookup table in code.
plz help me.
2021-07-20 05:11 AM
Im quite sure they do PWM not only DAC, you should read the tutorial trough
Scroll down to the STM32 PWM-To-DAC WaveForm Generator – LAB25
part
2021-07-20 05:32 AM
Thank you.
2021-07-20 05:32 AM
Thank you.
2021-07-20 06:18 AM
If the lookup table never changes, you can do this asynchronously with DMA. No need to regenerate a table that doesn't change.
2021-07-20 08:20 PM
Thank you.
plz if u have any example code share it to me. If I saw the example code it is easy to understand for me.