The ADC AREF design is flawed.
I ran this loop:
while (true) {
for ( int i = 0; i < 50000; i++) {
analogRead(A0);
}
delay(2000);
}
I measured the AREF pin which is connected directly to VREF+ on the STM32H747XIH6. The voltage drops well over 0.1 volt when the ADC is active which explains over a 1000 count change which is close to the jump on the graph.
Guess connecting AREF to an external reference would fix it.
I am done with Portenta, too many problems.
Edit: I did one more test. I looked at regulation of the 3V3 power.
The 3V3 is not very well regulated. It's about 2.99 V average but fluctuates a lot when running the ADC test program. The USB is supplying an average of 4.96 V at 0.04A.
The voltage rises a lot in the delay call, the CPU must sleep in a low power mode. The USB current drops to almost zero during delay.
The power management chip is really complex.