2020-06-30 09:32 AM
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
2020-07-02 03:40 AM
> 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.
2020-07-02 03:47 AM
I want to convert 5 channels in continuos mode. I have used DMA in circular mode for peripheral to memory transfer.
2020-07-02 06:18 AM
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.
2020-07-06 02:43 AM
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
2020-07-06 02:47 AM
I could not completely understand your suggestion. Could you please elaborate if you dont mind.
2020-07-06 02:57 AM
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.