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

   ## Summary
   
   Add the GigaDevice GD32W51x family (GD32W515, Arm Cortex-M33 with
   TrustZone) and the GD-xD-W515-EVAL "all-in-one" evaluation board, with the
   drivers of the peripherals of the board.
   
   The GD32W51x peripherals are the ones of the GD32VW55x family (same
   register layout, same non-secure memory map), so the chip drivers are
   derived from `arch/risc-v/src/gd32vw55x`. No schematic of the board is
   public: the pin map was read back from the factory firmware and checked
   with a logic analyzer.
   
   Chip (`arch/arm/src/gd32w51x`):
   
   - Cortex-M33 glue: start, NVIC, SysTick, 180 MHz PLL from the board HXTAL,
     instruction cache.
   - TrustZone is kept enabled (TZEN=1, clearing it mass-erases the flash):
     NuttX runs in secure state with the SAU disabled, the GPIO pins are
     released at boot and the drivers use the non-secure aliases. The flash
     pages of the image must be marked secure in `FMC_SECMCFG0` (documented,
     with the OpenOCD command). The DMA channels are made secure, otherwise
     they read the secure SRAM as zero; the QSPI is a secure peripheral and
     marks its pins secure.
   - Drivers: GPIO/EXTI, USART, SPI0/SPI1 (DMA), I2C, ADC, PWM/capture, RTC,
     FWDGT/WWDGT, CRC, TRNG, DMA (both controllers), program memory, QSPI
     (indirect mode) and the touch sensing interface (TSI).
   - Pin map with every alternate function selection of the supported
     peripherals (datasheet tables 2-5 to 2-7).
   - Fixes found while porting from gd32vw55x (the gd32vw55x drivers have the
     same bugs; I can send separate PRs for them): ADC clock divider, PWM
     multi-channel path, APB2 timer clock (2x PCLK2), SPI DMA woken up by the
     half transfer interrupt, I2C NACK handling (the next transfer started on
     a busy bus).
   
   Drivers:
   
   - `drivers/mtd/gd25.c`: fix the build with `CONFIG_GD25_QSPI` (the release
     from deep power-down only had the SPI implementation).
   - `drivers/power/battery/gd30bc2416.c`: GD30BC2416 battery charger
     (`battery_charger` lower half). The I2C protocol of this chip has no
     register byte: each register answers on its own address (0x40 +
     register). The requested configuration is restored when the charger
     loses it (USB unplugged, fault), on its IRQ and before each status read.
   - `drivers/sensors/gsl6157.c`: GSL6157 fingerprint sensor (Silead /
     GigaDevice), following the SPI protocol of its datasheet: reset, chip ID
     check (0x6157xxxx) and 32-bit register access through `/dev/fp0`. The
     configuration of the scan and interrupt modes is provided by the vendor
     and is not public, so the driver does not capture images yet.
   
   Board (`boards/arm/gd32w51x/gd-xd-w515-eval`): console on USART2, LEDs,
   ST7735S LCD (framebuffer), vibration motor (PWM), ADC, I2C0, RTC,
   watchdogs, GPIOs, GD25Q128E QSPI flash with LittleFS, GD30BC2416 charger
   (`/dev/batt0`), TSI touch key (`/dev/buttons`) and GSL6157 sensor
   (`/dev/fp0`). Configurations: `nsh`, `ostest`, `periph`, `littlefs`.
   
   The Wi-Fi radio is not supported: the vendor libraries only support 26 and
   40 MHz crystals and this board has a 25 MHz one (and no antenna).
   
   ## Impact
   
   - New chip and board, nothing changes for existing ones.
   - `drivers/mtd/gd25.c`: build fix of the QSPI mode, the SPI mode is not
     changed.
   - New drivers `gd30bc2416` and `gsl6157`, disabled by default.
   - Documentation: chip and board pages (pin map, TrustZone and flashing
     notes, examples of each configuration).
   
   ## Testing
   
   Host: Ubuntu 24.04.5 LTS, Arm GNU Toolchain 13.2.rel1, CMake 3.28.3.
   Board: GD-xD-W515-EVAL, flashed through its on-board GD-Link with the
   GigaDevice OpenOCD.
   
   Build: `nsh`, `ostest`, `periph` and `littlefs` with Make
   (`EXTRAFLAGS="-Wno-cpp -Werror"`) and CMake, no warning;
   `tools/refresh.sh` clean; `tools/checkpatch.sh` clean; `make html` with
   `-W`.
   
   On the hardware:
   
   - `ostest`: passes, log attached 
[w515_ostest.log](https://github.com/user-attachments/files/33829668/w515_ostest.log)
   - `periph`: LEDs, LCD (`fb`), motor (`pwm`), `adc`, `date` (RTC kept across
     a reset), watchdogs (keep-alive and reset on expiry), CRC against a
     software CRC-32, TRNG, EXTI.
   - `littlefs`: LittleFS on the internal flash and on the 16 MB QSPI flash,
     128 KB of random data written, compared and kept across a reboot.
   - Charger: battery voltage and state with a LiPo cell, charge enabled at
     25 %, configuration restored by the driver after a USB unplug.
   - TSI: touch and release events with the `buttons` example.
   - GSL6157: chip ID `0x6157a001` read at boot, `/dev/fp0` registered.
   
   ```
   nsh> uname -a
   NuttX 13.1.0 81c42e5c7a Oct 19 2026 08:48:15 arm gd-xd-w515-eval
   nsh> ls /dev
   /dev:
    adc0
    batt0
    buttons
    console
    fb0
    fp0
    gpio0
    gpio1
    gpio2
    i2c0
    null
    pwm0
    random
    ttyS0
    userleds
    watchdog0
    watchdog1
    zero
   ```


-- 
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