2025-03-08 6:54 PM
I'm running the ADC on STM32G071 and I am seeing double spikes when the ADC takes a reading. Any idea why there are two spikes? I expect to see just one. Below you see two spikes followed by another two spikes 1ms later. My software starts an ADC reading every 1ms. ADC frequency is 32MHz using synchronous clock mode divided by 2.
The circuit being sampled is not connected to any other circuit that is sampled. Each pair of spikes is 12.5uS apart. There is no oversampling. Interestingly enough, when oversampling is active there will be negative spikes. So 4x oversampling results in 1 large positive spike, followed by 3 negative spikes, followed by an additional positive spike. The negative spikes are 15us apart. Which is interesting because that's about how far apart the two positive spikes will be if I don't have oversampling active. I'm using the DMA.
2025-03-09 12:17 AM
Dear @Carl_G ,
Interesting question , Can you share your external hardware of the samples AIN and in particular the Source impedance and external capacitance .
See Chapter 4.4 : https://www.st.com/resource/en/application_note/cd00211314-how-to-optimize-the-adc-accuracy-in-the-stm32-mcus-stmicroelectronics.pdf
Here the behavior is most likely a Charge transfer between the external capacitance and internal one based on the level of its Charged value and discharging when our internal switch is closed/Open .
I would suggestion add a big capacitance on external and see the effect .
Hope it helps ,
STOne-32
2025-03-09 6:30 AM
Here is a schematic of the circuit. The DP_IN goes to MCU pin 10 PA4 ADC_IN4. I do expect there to be 1 spike. That is definitely transfer from the channel measured previously. It's intensity follows the voltage on that previous channel. And I can explain the 3 reverse spikes as being caused by the sampling cap being discharged prior to taking oversamples. These do not cause a problem for me. However, you did make me realize this is my only channel that doesn't have a filter cap on it. I will have to add one.
In any event the final spike that is the largest, I can't account for. What's the MCU doing here?