This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit e2044cfdc9389c3a2c1b0a505fcdab4c97cfc021
Author: Jorge Guzman <[email protected]>
AuthorDate: Sun Oct 25 01:43:53 2026 -0300

    boards/gd-xd-w515-eval: sample the GD-Link USB supply
    
    PC0 (INT_VBUS2/2) is the GD-Link USB supply through a 10 kOhm /
    10 kOhm divider.  Add ADC channel 4 to the sequence of /dev/adc0: it
    reads about 2.6 V (5.2 V supply) with the GD-Link cable plugged in.
    PC1, the micro-USB supply, stays the /dev/gpio1 interrupt input.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Jorge Guzman <[email protected]>
---
 .../platforms/arm/gd32w51x/boards/gd-xd-w515-eval/index.rst       | 8 +++++---
 boards/arm/gd32w51x/gd-xd-w515-eval/src/gd32_bringup.c            | 7 ++++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git 
a/Documentation/platforms/arm/gd32w51x/boards/gd-xd-w515-eval/index.rst 
b/Documentation/platforms/arm/gd32w51x/boards/gd-xd-w515-eval/index.rst
index b3558ee1d9b..cadd028a6e7 100644
--- a/Documentation/platforms/arm/gd32w51x/boards/gd-xd-w515-eval/index.rst
+++ b/Documentation/platforms/arm/gd32w51x/boards/gd-xd-w515-eval/index.rst
@@ -57,7 +57,7 @@ USB detect     PC1 (micro-USB VBUS / 2)             
/dev/gpio1 (interrupt)
 Charger IRQ    PB2                                  GD30BC2416 driver (*)
 Charger enable PC3 (CHRG_EN, active high)           Held high
 Analog inputs  PA1, PA2, PA3, PC2                   ADC channels 1/2/3/6 (*)
-GD-Link VBUS   PC0 (mini-USB VBUS / 2)              ADC channel 4 (unused)
+GD-Link VBUS   PC0 (mini-USB VBUS / 2)              ADC channel 4 (*)
 Microphone     PA15 (MIC_OUT)                       Digital input
 QSPI flash     PA4 (SCK), PA5 (CS)                  GD25Q128E, AF3
 QSPI flash     PA6, PA7, PB3, PB4                   IO0..IO3, AF3
@@ -67,8 +67,10 @@ QSPI flash     PA6, PA7, PB3, PB4                   
IO0..IO3, AF3
 of the battery (PA2) and of the USB connector (PA3), each a 10 kOhm NTC
 with a 10 kOhm pull-up to 3.3 V, and the battery current (PC2): an
 INA181A1 (gain 20) on a 20 mOhm shunt with a 1.8 V offset, so
-``I = (V - 1.8) / 0.4`` A, negative while the battery charges. The battery
-voltage is only measured by the charger. PB2 is ``/dev/gpio3`` when the
+``I = (V - 1.8) / 0.4`` A, negative while the battery charges. PC0 is the
+GD-Link USB supply through a 10 kOhm / 10 kOhm divider: about 2.5 V with
+the GD-Link cable plugged in, near 0 V without it. The battery voltage is
+only measured by the charger. PB2 is ``/dev/gpio3`` when the
 charger driver is disabled.
 
 Fingerprint sensor
diff --git a/boards/arm/gd32w51x/gd-xd-w515-eval/src/gd32_bringup.c 
b/boards/arm/gd32w51x/gd-xd-w515-eval/src/gd32_bringup.c
index 991912ccd08..7e17fea5d16 100644
--- a/boards/arm/gd32w51x/gd-xd-w515-eval/src/gd32_bringup.c
+++ b/boards/arm/gd32w51x/gd-xd-w515-eval/src/gd32_bringup.c
@@ -152,13 +152,14 @@ int gd32_bringup(void)
   struct battery_charger_dev_s *charger;
 #endif
 #ifdef CONFIG_GD32W51X_ADC
-  /* The analog inputs: NTC_COIL (PA1), NTC_Battery (PA2), NTC_USB (PA3)
-   * and the battery current (PC2, ADC_I_VBAT)
+  /* The analog inputs: NTC_COIL (PA1), NTC_Battery (PA2), NTC_USB (PA3),
+   * the GD-Link USB supply halved by a 10 kOhm / 10 kOhm divider
+   * (PC0, INT_VBUS2/2) and the battery current (PC2, ADC_I_VBAT)
    */
 
   static const uint8_t chanlist[] =
   {
-    1, 2, 3, 6
+    1, 2, 3, 4, 6
   };
 
   struct adc_dev_s *adc;

Reply via email to