Skip to main content
Associate III
June 18, 2024
Solved

How to generate a sine wave using DAC and DMA with the STM32H563ZIT6?

  • June 18, 2024
  • 2 replies
  • 2763 views

Hi, I'm trying to generate a sine wave using the DAC and DMA with the STM32H563ZIT6. How should I configure the IOC setup? I want to generate a 100 Hz frequency with a 50% duty cycle. Can anyone please help me?

Best answer by mƎALLEm

Hello, 

You can inspire from the example provided in STM32H5 cube: https://github.com/STMicroelectronics/STM32CubeH5/tree/main/Projects/NUCLEO-H563ZI/Examples/DAC/DAC_SignalsGeneration

For this, you need to create a sine wave lookup table as done for the above example to generate the escalator wave (aEscalator8bit[6]).

You can also refer to the AN3126 "Audio and waveform generation using the DAC
in STM32 products" mainly the section 2.1 Using the DAC to generate a sine waveform:

SofLit_0-1718719030620.png

 

2 replies

mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
June 18, 2024

Hello, 

You can inspire from the example provided in STM32H5 cube: https://github.com/STMicroelectronics/STM32CubeH5/tree/main/Projects/NUCLEO-H563ZI/Examples/DAC/DAC_SignalsGeneration

For this, you need to create a sine wave lookup table as done for the above example to generate the escalator wave (aEscalator8bit[6]).

You can also refer to the AN3126 "Audio and waveform generation using the DAC
in STM32 products" mainly the section 2.1 Using the DAC to generate a sine waveform:

SofLit_0-1718719030620.png

 

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Associate III
June 19, 2024

Thank you for your answer! I'm confused about configuring of IOC. Could you share a screenshot of the IOC configuration?

mƎALLEm
ST Technical Moderator
June 19, 2024

The ioc file is available in the link I provided here:

SofLit_0-1718784568330.png

And need to read the readme file of the example and also read the AN to apply changes to the ioc file to fit your needs. There is no Sine Wave generation ST example off the shelf for H5.

 

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Associate III
June 20, 2024

thank you so much!!!