Sync DAC output and ADC reading
Hello,
I have an application where I am using the DAC output to generate a signal which runs through a circuit and is read back on the ADC. The issue I am struggling with is how to control the ADC sampling so that it does not occur at the same moment as the DAC output change. So I think ideally I would like to stagger these two events so that the ADC sample has stabilized before I sample it. Say start sampling the ADC half way through the DAC period. Currently I have two timers and I used an open loop delay (call to HAL_Delay) to create some separation as I measured on a scope. That worked as a temporary prototype but I am now trying to make this more robust.
I've been thinking that timer synchronization may be the solution. I looked through some of the modes described in the reference manual but didn't think any of them fit my situation. Could anyone give me some advice on what mode I might want to accomplish this or recommend an alternative method?
Background: Both the DAC and ADC are being driven at the same sampling rate by two separate timers started at different times. I am using DMA to copy between the memory and peripherals on these same timers. I am using the STM32L432KC microcontroller (Nucleo eval board). I am using the HAL/LL and CubeMx application.
Thank you in advance for any help.
Mike
