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

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


The following commit(s) were added to refs/heads/master by this push:
     new ee2d20c01ea boards/risc-v/gd32vw553k-start: fix the LED pins
ee2d20c01ea is described below

commit ee2d20c01eae19e7325705d6ce041b32fbe7bad7
Author: Jorge Guzman <[email protected]>
AuthorDate: Sun Oct 18 01:41:12 2026 -0300

    boards/risc-v/gd32vw553k-start: fix the LED pins
    
    The LEDs are on PB0 (red), PA12 (green) and PB4 (blue), not PC0-PC2.
    
    PB0 was also the I2C0 fallback SCL (SPI on), so move that fallback to
    PB15/PA8, and route ADC_IN8 (PB0) only when the LEDs are not in use.
    Update the board documentation accordingly.
    
    Tested on hardware with the periph configuration and the leds example.
    
    Signed-off-by: Jorge Guzman <[email protected]>
---
 .../gd32vw55x/boards/gd32vw553k-start/index.rst    | 46 +++++++++++++---------
 .../gd32vw55x/gd32vw553k-start/include/board.h     | 41 ++++++++++---------
 .../gd32vw55x/gd32vw553k-start/src/gd32_autoleds.c |  2 +-
 .../gd32vw55x/gd32vw553k-start/src/gd32_userleds.c |  2 +-
 4 files changed, 51 insertions(+), 40 deletions(-)

diff --git 
a/Documentation/platforms/risc-v/gd32vw55x/boards/gd32vw553k-start/index.rst 
b/Documentation/platforms/risc-v/gd32vw55x/boards/gd32vw553k-start/index.rst
index 16d134d8c10..8abdaf9bc0e 100644
--- a/Documentation/platforms/risc-v/gd32vw55x/boards/gd32vw553k-start/index.rst
+++ b/Documentation/platforms/risc-v/gd32vw55x/boards/gd32vw553k-start/index.rst
@@ -23,7 +23,7 @@ Features
   over the single USB Type-C connector
 - Two test pin headers (J1, J2) breaking out the GPIOs
 - BOOT0/BOOT1 jumpers, a power jumper and a reset button (NRST)
-- Three user LEDs on GPIOC
+- Three user LEDs (red, green, blue)
 
 Serial Console
 ==============
@@ -34,16 +34,21 @@ It shows up on the host as ``/dev/ttyACM0`` at 115200 8N1.
 LEDs
 ====
 
-Three LEDs sit on GPIOC and are driven push-pull, active HIGH.  In the vendor
-SDK they are named LED_RUN, LED_SLEEP and LED_RX.
+The three LEDs are driven push-pull, active HIGH:
 
-====== ==== =========================================
-LED    Pin  Meaning in the vendor SDK
-====== ==== =========================================
-LED1   PC0  CPU running
-LED2   PC1  CPU sleeping
-LED3   PC2  Reception
-====== ==== =========================================
+====== ===== ======
+LED    Pin   Color
+====== ===== ======
+LED1   PB0   red
+LED2   PA12  green
+LED3   PB4   blue
+====== ===== ======
+
+The three pins are also broken out on the J1 and J2 headers.  PB4 comes out of
+reset as JNTRST with its pull-up enabled, so the blue LED is lit until the pin
+is configured as an output.  PB0 is also ADC_IN8: the ADC channel is only
+routed there when the LEDs are not in use, and the red LED still loads an
+analog signal applied to it.
 
 With ``CONFIG_USERLED`` they belong to the application and are exposed as
 ``/dev/userleds``.  With ``CONFIG_ARCH_LEDS`` the OS takes them over instead
@@ -71,9 +76,9 @@ is a plain GPIO.  The silkscreen abbreviates the port letter 
(``A0`` is PA0,
    PA2      GPIO                PA3      GPIO
    PA4      GPIO                PA5      GPIO
    PA6      UART2_TX (console)  PA7      UART2_RX (console)
-   PB0      GPIO                NC       --
+   PB0      LED1 / ADC_IN8      NC       --
    NC       --                  NC       --
-   NC       --                  PB15     GPIO
+   NC       --                  PB15     I2C0_SCL (SPI on)
    GND      ground              +5V      power in/out
    ======== =================== ======== ===================
 
@@ -85,10 +90,10 @@ is a plain GPIO.  The silkscreen abbreviates the port 
letter (``A0`` is PA0,
    PC15     GPIO                PC14     GPIO
    NC       --                  PA15     JTDI
    PA14     JTCK                PA13     JTMS
-   PB4      JNTRST              PB3      JTDO
-   PA12     GPIO                NC       --
+   PB4      JNTRST / LED3       PB3      JTDO
+   PA12     LED2                NC       --
    NC       --                  NC       --
-   PA8      GPIO                GND      ground
+   PA8      I2C0_SDA (SPI on)   GND      ground
    +3V3     3.3V power test     GND      ground
    ======== =================== ======== ===================
 
@@ -203,8 +208,8 @@ NSH plus I2C0, the i2ctool and the Sensirion SHT3x 
temperature/humidity
 driver -- a small example to validate the I2C master port against a real
 device. Because SPI is *off* here, I2C0 is routed to the J1 header on
 **PA2 (SCL)** and **PA3 (SDA)** (adjacent pins on the second row of J1, both
-AF4); with SPI on (the ``periph`` case) it falls back to PB0/PB1, whose SDA
-pin is not broken out. See the pin-header tables above.
+AF4); with SPI on (the ``periph`` case) it falls back to PB15 (SCL, J1) and
+PA8 (SDA, J2). See the pin-header tables above.
 
 Wire the sensor to J1: SCL -> PA2, SDA -> PA3, VCC -> +3V3 (J2) or the module
 3.3 V, GND -> GND. A breakout with its own pull-ups is assumed; the pins are
@@ -307,7 +312,9 @@ adc
 
 NSH plus the ADC driver, registered as ``/dev/adc0`` and read by the ``adc``
 example. Channel 8 (ADC_IN8) is routed to **PB0** on the J1 header, so an
-analog voltage applied there is sampled.
+analog voltage applied there is sampled.  PB0 also drives the red LED, which
+loads the input; with ``CONFIG_USERLED`` or ``CONFIG_ARCH_LEDS`` the pin stays
+an LED output and the ADC is registered without an analog pin.
 
 The ADC converts on demand rather than continuously, so the example is built
 with ``CONFIG_EXAMPLES_ADC_SWTRIG``: it issues a software trigger and then
@@ -478,7 +485,8 @@ All seven configurations were validated on hardware:
 - ``periph``: every driver registers (``/dev/i2c0``, ``/dev/spi0``,
   ``/dev/adc0``, ``/dev/pwm0``, ``/dev/capture0``, ``/dev/watchdog0``,
   ``/dev/watchdog1``, ``/dev/userleds``, ``/dev/random``).  The TRNG returns
-  fresh entropy on each read, and the three LEDs work.
+  fresh entropy on each read, and the three LEDs (PB0, PA12, PB4) light in
+  sequence under the ``leds`` example.
 - ``wapi``: full station path over a live AP -- ``wapi scan`` lists the nearby
   networks, WPA2 associates through the four-way handshake, DHCP obtains an
   address, and ``ping`` reaches the internet.
diff --git a/boards/risc-v/gd32vw55x/gd32vw553k-start/include/board.h 
b/boards/risc-v/gd32vw55x/gd32vw553k-start/include/board.h
index 6ae5fc8545c..aa792d795b9 100644
--- a/boards/risc-v/gd32vw55x/gd32vw553k-start/include/board.h
+++ b/boards/risc-v/gd32vw55x/gd32vw553k-start/include/board.h
@@ -85,14 +85,14 @@
 /* I2C0 uses PA2 (SCL) / PA3 (SDA) on AF4, the pins broken out on the J1
  * header (datasheet Table 2-5), so a sensor such as the SHT3x can be wired
  * there directly.  When SPI is enabled it claims PA2 (SPI SCK), so I2C0
- * falls back to PB0/PB1 (AF6); PB1 (SDA) is not broken out on J1/J2, so that
- * pairing only registers the bus (the periph case).
+ * falls back to PB15 (SCL, AF4, J1) / PA8 (SDA, AF5, J2).  PB0/PB1 are not
+ * used for that: PB0 drives LED1.
  */
 
 #ifdef CONFIG_GD32VW55X_I2C0
 #  ifdef CONFIG_GD32VW55X_SPI
-#    define GPIO_I2C0_SCL  GPIO_I2C0_SCL_3   /* PB0, AF6 */
-#    define GPIO_I2C0_SDA  GPIO_I2C0_SDA_3   /* PB1, AF6 (not on a header) */
+#    define GPIO_I2C0_SCL  GPIO_I2C0_SCL_4   /* PB15, AF4 (J1) */
+#    define GPIO_I2C0_SDA  GPIO_I2C0_SDA_2   /* PA8, AF5 (J2) */
 #  else
 #    define GPIO_I2C0_SCL  GPIO_I2C0_SCL_1   /* PA2, AF4 (J1) */
 #    define GPIO_I2C0_SDA  GPIO_I2C0_SDA_1   /* PA3, AF4 (J1) */
@@ -116,38 +116,41 @@
 #endif
 
 /* ADC.  Route ADC channel 8 (ADC_IN8) to PB0 on the J1 header (datasheet
- * Table 2-5) so an analog signal can be applied there.  When SPI is enabled
- * PB0 is instead claimed by the I2C0 fallback (see above), so the analog pin
- * is only routed when SPI is off.  The board bringup samples this channel
- * when the macro is defined.
+ * Table 2-5) so an analog signal can be applied there.  PB0 also drives
+ * LED1 (see below), so the analog pin is only routed when the LEDs are not
+ * in use; the red LED still loads the signal.  The board bringup samples
+ * this channel when the macro is defined.
  */
 
-#if defined(CONFIG_GD32VW55X_ADC) && !defined(CONFIG_GD32VW55X_SPI)
+#if defined(CONFIG_GD32VW55X_ADC) && !defined(CONFIG_ARCH_LEDS) && \
+    !defined(CONFIG_USERLED)
 #  define GPIO_ADC_IN8 (GPIO_CFG_MODE_ANALOG | GPIO_CFG_PUPD_NONE | \
                         GPIO_CFG_PORT_B | GPIO_CFG_PIN_0)
 #endif
 
 /* LEDs *********************************************************************/
 
-/* The GD32VW553K-START has three LEDs on GPIOC, driven push-pull and
- * active HIGH (the vendor demo turns them on with gpio_bit_set(); see
- * MSDK/plf/src/gd32vw55x_platform.h, where they are named LED_RUN,
- * LED_SLEEP and LED_RX).
+/* The GD32VW553K-START has three LEDs, driven push-pull and active HIGH.
+ * The pins are also broken out on the J1 (PB0) and J2 (PA12, PB4) headers.
  *
- *   LED1  PC0
- *   LED2  PC1
- *   LED3  PC2
+ *   LED1  PB0   red
+ *   LED2  PA12  green
+ *   LED3  PB4   blue
+ *
+ * PB4 comes out of reset as JNTRST with its pull-up enabled, so the blue LED
+ * is lit until the pin is configured as an output.  PB0 is shared with
+ * ADC_IN8, which is only routed when the LEDs are not in use (see above).
  */
 
 #define GPIO_LED1 (GPIO_CFG_MODE_OUTPUT | GPIO_CFG_PUPD_NONE | GPIO_CFG_PP | \
                    GPIO_CFG_SPEED_MAX | GPIO_CFG_OUTPUT_RESET | \
-                   GPIO_CFG_PORT_C | GPIO_CFG_PIN_0)
+                   GPIO_CFG_PORT_B | GPIO_CFG_PIN_0)
 #define GPIO_LED2 (GPIO_CFG_MODE_OUTPUT | GPIO_CFG_PUPD_NONE | GPIO_CFG_PP | \
                    GPIO_CFG_SPEED_MAX | GPIO_CFG_OUTPUT_RESET | \
-                   GPIO_CFG_PORT_C | GPIO_CFG_PIN_1)
+                   GPIO_CFG_PORT_A | GPIO_CFG_PIN_12)
 #define GPIO_LED3 (GPIO_CFG_MODE_OUTPUT | GPIO_CFG_PUPD_NONE | GPIO_CFG_PP | \
                    GPIO_CFG_SPEED_MAX | GPIO_CFG_OUTPUT_RESET | \
-                   GPIO_CFG_PORT_C | GPIO_CFG_PIN_2)
+                   GPIO_CFG_PORT_B | GPIO_CFG_PIN_4)
 
 /* LED index values for use with board_userled() */
 
diff --git a/boards/risc-v/gd32vw55x/gd32vw553k-start/src/gd32_autoleds.c 
b/boards/risc-v/gd32vw55x/gd32vw553k-start/src/gd32_autoleds.c
index 7819cd205e6..a56aa0df565 100644
--- a/boards/risc-v/gd32vw55x/gd32vw553k-start/src/gd32_autoleds.c
+++ b/boards/risc-v/gd32vw55x/gd32vw553k-start/src/gd32_autoleds.c
@@ -41,7 +41,7 @@
  * Private Data
  ****************************************************************************/
 
-/* The three LEDs are on GPIOC and are active HIGH.  When CONFIG_ARCH_LEDS is
+/* The three LEDs (PB0, PA12, PB4) are active HIGH.  When CONFIG_ARCH_LEDS is
  * selected they show the OS state and are not available to the application;
  * the meaning of each state is tabulated in board.h.
  */
diff --git a/boards/risc-v/gd32vw55x/gd32vw553k-start/src/gd32_userleds.c 
b/boards/risc-v/gd32vw55x/gd32vw553k-start/src/gd32_userleds.c
index 2d4b7254559..4430b8bdf28 100644
--- a/boards/risc-v/gd32vw55x/gd32vw553k-start/src/gd32_userleds.c
+++ b/boards/risc-v/gd32vw55x/gd32vw553k-start/src/gd32_userleds.c
@@ -41,7 +41,7 @@
  * Private Data
  ****************************************************************************/
 
-/* The three LEDs are on GPIOC and are active HIGH: driving the pin high
+/* The three LEDs (PB0, PA12, PB4) are active HIGH: driving the pin high
  * lights the LED.
  */
 

Reply via email to