joaomariolago opened a new pull request, #19196:
URL: https://github.com/apache/nuttx/pull/19196

   ## Summary
   
   Enable `ADC1.OR.OP0` on STM32H5 when ADC1 channel 0 is selected, or when 
channel 1 is used in differential mode.
   
   On STM32H5, `ADC1.OR.OP0` enables the GPIO switch that connects PA0 to the 
ADC mux for `ADC1_INP0` and `ADC1_INN1`. Without this bit set, PA0 remains 
disconnected and ADC conversions return invalid values.
   
   Additional details are available in the [Reference 
manual](https://www.st.com/resource/en/reference_manual/rm0481-stm32h52333xx-stm32h56263xx-and-stm32h573xx-armbased-32bit-mcus-stmicroelectronics.pdf)
 section `26.6.23 ADC option register (ADC_OR)`
   
   ## Impact
   
   Fixes ADC1 conversions for:
   
   * `ADC1_INP0` on PA0
   * `ADC1_INN1` on PA0 when channel 1 is configured in differential mode
   
   ## Testing
   
   Tested on STM32 Nucleo-H563ZI with:
   
   ```sh
   cmake -B build -DBOARD_CONFIG=nucleo-h563zi:adc -GNinja
   ```
   
   Readings were taken from NSH using the `adc` command.
   
   ### ADC1_INP0 on PA0
   
   Board configuration used for this test is available in 
[nucleo-h563zi-adc1-inp0-test.patch](https://github.com/user-attachments/files/29233746/nucleo-h563zi-adc1-inp0-test.patch).
   
   With this change:
   
   ```text
   INP0 = 3.3V: 4095
   INP0 = GND:  0
   ```
   
   Without this change:
   
   ```text
   INP0 = 3.3V: 124~1137
   INP0 = GND:  119~1135
   ```
   
   ### ADC1_INP1 / ADC1_INN1 differential mode
   
   Board configuration used for this test is available in 
[nucleo-h563zi-adc1-inn1-test.patch](https://github.com/user-attachments/files/29233740/nucleo-h563zi-adc1-inn1-test.patch).
   
   With this change:
   
   ```text
   IN1P = 3.3V, IN1N = GND:  4095
   IN1P = 3.3V, IN1N = 3.3V: 2047
   IN1P = GND,  IN1N = GND:  2000
   IN1P = GND,  IN1N = 3.3V: 0
   ```
   
   Without this change:
   
   ```text
   IN1P = 3.3V, IN1N = GND:  2862~3791
   IN1P = 3.3V, IN1N = 3.3V: 3743~4095
   IN1P = GND,  IN1N = GND:  2092~2882
   IN1P = GND,  IN1N = 3.3V: 2109~2880
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to