cancel
Showing results for 
Search instead for 
Did you mean: 

5 ADc channels to scan within 20us.

BDasa.1
Associate II

Hi I'm currentlz working on STM32G071RB nucleo board to measure five different voltages across a laser within the ON duration of the Laser i.e 20us using DMA. My ADC finishes conversion every 17us(checked using LED in the ADCconcmplt callback). When there is no time constraint(i.e when the laser is always ON) the ADC gives out the correct voltages across 5 nodes but when I try to read the ADC voltages within 20us it appears that the ADC voltages at two nodes are almost halfed. I'm using an exti to trigger the ADC. I collect the ADC smples in the ADCconvcmplt call back and I use a timer of 1s to average the samples collected. Any inputs regarding this is really appreciated. I tried debugging the software but is of no help. kindly help me with your suggestions

15 REPLIES 15
TDK
Guru

> ContinuousConvMode = ENABLE;

This seems wrong here, if you're just trying to convert one channel per trigger. Not sure though.

> Do I have to Stop my ADC in the call back and start it again?

No, you shouldn't need to do this. Ensure DMA is in circular mode and it shouldn't stop.

If you feel a post has answered your question, please click "Accept as Solution".
BDasa.1
Associate II

I want to convert 5 channels in continuos mode. I have used DMA in circular mode for peripheral to memory transfer.

S.Ma
Principal

Does G0 provide a trigger pin to launch a one shot dma circular round? Ideally use twice buffer size so you have double buffer time to process the previous batch while new one is being converted. then with dma interrupts you will latency relax constrains.

But since I'm using DMA the HAL overhead of the ADC IRQ handler should not affect my results right? correct me if I'm wrong

BDasa.1
Associate II

I could not completely understand your suggestion. Could you please elaborate if you dont mind.

If you have a single buffer holding the conversion results, the first element(s) could be overwritten by the first conversion result of the next cycle.

Moreover, the HAL overhead slows down the main thread by 30 to 40 % if interrupts happen every 20 μs.