Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted


This is a demo project showing 8-bit Sine (or arbitrary shape) wave generation using custom component (WaveGen) and standard PWM. The wave generator is RAM-DMA-PWM bridge transferring 8-bit data from RAM buffer to PWM. The PWM period is set to 255 to match 8-bit incoming data. Sine wave frequency is controlled with high resolution by the DDS32 generator.

The demo project provides examples of 32 and 256 wave points/period. External RC-filtering of the PWM output needed to produce a smooth sine wave. Like with all PWM-generated analog signals, the maximum achievable output frequency is quite limited. The upper frequency for this design is limited by the maximum DDS output frequency (BUS_CLK/2). For example, using 32 samples/period, Fmax = (BUS_CLK/2) / ( 256 x 32) = 2.9 kHz.

Draft version of the WaveGen component is included in the project. The DDS32 component can be found here:

Re: DDS24: 24-bit DDS arbitrary frequency generator component


Figure 1. Sine wave production using RAM-DMA-PWM bridge (WaveGen) and DDS32.


Figure 2. Yellow trace - PWM output at 32 points/period, Cyan trace - WaveGen reference signal.


1 Reply
5 comments on KBA First comment on KBA 10 questions asked

Thanks for the sharing.

Roy Liu