Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

STM32 Tutorial #15 – Sine wave on DAC with DMA

10.9K views on YouTube

In this video we continue our dive into the DAC peripheral by calculating and feeding it a sine wave. We will be using DMA to reduce the load on the actual CPU core. Taking this approach speeds up to 1 Msps is possible.

New version of this video enabling two channels and other waveforms: https://www.youtube.com/watch?v=50bHuO2Dfg0

In this video it was never mentioned how to actually install the CMSIS DSP library. We made a short video explaining that here: https://www.youtube.com/watch?v=QxqnBByUvKE

Update: a new video showing two-channel setup running under FreeRTOS here: https://www.youtube.com/watch?v=i9j63SeN1H8

Description of Sine wave: https://stm32world.com/wiki/Sine_Wave
STM32World Wiki: https://stm32world.com/wiki
STM32F405 Documentation: https://stm32world.com/wiki/STM32_Official_Documentation#stm32f405

Wiki page on DAC w. DMA: https://stm32world.com/wiki/STM32_ADC_and_DAC_with_DMA
Dual Sine with output to I2S: https://www.youtube.com/watch?v=vOAf3xxGq_o

Watch this video for using the ADC with DMA: https://youtu.be/rb3j78–7xU

Project Files: https://github.com/STM32World/stm32fun

#stm32 #tutorial #stm32cubeide #stm32cubemx #hal #dac #dma #stm32world #arduino

00:00 Intro and recap
01:10 The DACs
02:35 Diving into it
05:00 Configuring a timer
06:52 Testing the timer
09:34 Configuring the DAC
11:18 Adding the DAC code
18:00 Adding simple sawtooth wave
20:10 Adding the sine math
24:10 Increasing the sample rate
26:05 Pushing it too far
27:30 Profiling with the debugger
28:17 Using CMSIS DSP library to calculate faster
32:30 Avoiding clipping
34:20 Profiling again