Anything you do changes the problems with Portenta. I used a USB 3.0 port and noise changes. You can create various patterns with different delays.
Here is the same program with a USB 3.0 port incredible noise.
The STM32H7 is a fine processor. Here is a result with a Nucleo H743ZI board. ChibiOS is about 30 times faster for simple ADC reads than Arduino so I over-sampled 64X per point. It's accurate and very low noise. The board is on the same USB 3 port.
Without the over-sampling the range for the Nucleo is about 12 counts, not 2000.
Edit: I think I see the AREF problem. There is a 100k resistor between 3V1 and the VREF+ pin on the STM32H747XIH6. The Nucleo has no resistor. It has a solder bridge bridge to select the VREF source.

