Skip to main content
Endika Caño de Miguel
Associate III
November 22, 2017
Question

Problems with the ADC/DAC

  • November 22, 2017
  • 6 replies
  • 2454 views
Posted on November 22, 2017 at 11:45

Hello:

I�m using my STM32L432 to input a signal from the Signal Generator and I�m trying to get the same signal, after 

using the ADC and DAC (photo below)

0690X0000060PEMQA2.jpg

Here is the program I write, but it doesn�t work. Could someone help me please???

Thank you in advance

0690X00000604AyQAI.jpg0690X0000060PFYQA2.jpg

#dac #signal #adc #stm32 #stm32l432
This topic has been closed for replies.

6 replies

S.Ma
Principal
November 22, 2017
Posted on November 22, 2017 at 13:11

A very crude way is to start ADC in free running mode (keeping scanning over and over) and activate DAC once.

In the while loop, you read the ADC.DR (with the proper bit formatting, 8 bit, 12 bit, left or right aligned), format it to the DAC output (unless programmed to be the same) with its buffer enabled.

A cleaner way: Program a timer with 2 output channels, one channel gpio output will go to the ADC trigger (and you can monitor on a oscilloscope before using an internal signal routing later), use the other channel gpio to trigger the DAC output. Then use DMA to push the ADC value to a cyclic RAM buffer, and DMA from cyclic RAM buffer to DAC.

You'll be able to run this pass through, control the sampling and skew rate, and it will work without running SW... the HW will oblige.

AvaTar
Senior III
November 22, 2017
Posted on November 22, 2017 at 13:30

I would suggest to use the ADC interrupt instead of DMA, and copy the value manually.

I think I see where it's going - manipulating the value before output.

At least for low update rates, this is easier achieved via interrupts.

Endika Caño de Miguel
Associate III
November 23, 2017
Posted on November 23, 2017 at 12:07

.