The ADC of PY32 is indeed different from STM32, and some parts I have already tried to implement in Rust, such as:
When the ADC is in single-shot mode, after the conversion is complete, the ADC module needs to be re-enabled (ADC_EN = 1) to start the next conversion.
The special calibration of PY32.
When reading the internal Vrefint after powering up, the value can be a random number between 1.2V and 1.9V, such as 2072, 2160, 1500.
There’s about a 30% chance that the value is correct upon power-up.
The external channels work fine.
Delaying power-up doesn’t help, and adding a delay after enabling Vref doesn’t help either. External power supply does not resolve the issue.
https://github.com/py32-rs/py32-hal/blob/5586cfc9c99d5fb1e78bf9033177b74508fec828/examples/py32f030/src/bin/adc.rs#L18-L40
The ADC of PY32 is indeed different from STM32, and some parts I have already tried to implement in Rust, such as: When the ADC is in single-shot mode, after the conversion is complete, the ADC module needs to be re-enabled (ADC_EN = 1) to start the next conversion. The special calibration of PY32.