cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure adc sampling snapshot and trigger other things during sampling?

lectricidiot
Associate

Hi. I'm new to stm32 and have an h7 nucleo board to play with. This is my goal/problem.

I want to read from the adc at reasonably high speed (2 Msamples/s, 10-bit will do as I don't need especially high resolution) for say 10 us. In that period I want to send a 2 us gpio pulse to trigger an LED via a driver (low side switch MOSFET and gate driver) as part of an analysis system, where the LED is triggered after 2-3 us into the adc read. I then want to find the maximum adc value in the buffer. If the max value is greater than a threshold value then I want to send the max value in over serial to be logged externally, then wait for 0.5-1 ms before restarting the sampling loop. If the value is less than the threshold then wait for 100 us before restarting the sampling loop.

So far I'm not finding anything in the literature to get pointed where I want to be, partly because I'm not quite sure what I need to be asking to get appropriate information! Any illumination on this would be much appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
MasterT
Senior III

Select Timer, configure two PWM channels - one for LED, and another to trigger adc start conversion.   If done properly, you would have full control on phases for both PWM.  If LED  power regulation required than DAC may be triggered as well to output pre-set voltage/ current levels for LED.

 So, seems like long learning curve, start with a timer. I-net is full with examples of code

View solution in original post

1 REPLY 1
MasterT
Senior III

Select Timer, configure two PWM channels - one for LED, and another to trigger adc start conversion.   If done properly, you would have full control on phases for both PWM.  If LED  power regulation required than DAC may be triggered as well to output pre-set voltage/ current levels for LED.

 So, seems like long learning curve, start with a timer. I-net is full with examples of code