Repository navigation
power/npzero: Add support to nanopower nPZero and NPZ_G1S_DK board - #21736
Merged
Merged
Conversation
acassis
requested review from
Donny9,
jerpelea,
raiden00pl and
xiaoxiang781216
as code owners
November 11, 2026 22:18
|
xiaoxiang781216
approved these changes
Nov 12, 2026
🔗 Cross-repo PR dependenciesThe read-only Build run reported the following dependent PR(s) and fetched head SHA(s): CI run: https://github.com/apache/nuttx/actions/runs/43110909801 |
acassis
force-pushed
the
npzero
branch
3 times, most recently
from
November 12, 2026 20:13
1bf0a52 to
cfcd11e
Compare
xiaoxiang781216
approved these changes
Nov 13, 2026
🔗 Cross-repo PR dependenciesThe read-only Build run reported the following dependent PR(s) and fetched head SHA(s): CI run: https://github.com/apache/nuttx/actions/runs/43298213908 |
🔗 Cross-repo PR dependenciesThe read-only Build run reported the following dependent PR(s) and fetched head SHA(s):
CI run: https://github.com/apache/nuttx/actions/runs/43515015297 |
Contributor
|
fixed by #21771. |
The nPZero G1S (NPZG1SQ32) from Nanopower Semiconductor switches the host MCU off and polls up to four I2C or SPI peripherals by itself, waking the host up on a peripheral, ADC or time-out event. Add a character driver controlled with ioctl() commands to read the ID, the status (wake-up reason), the last peripheral and ADC values, to send the configuration and the SRAM commands, to enter Idle state, to reset it and to access its registers. A new ioctl base, _NPZEROIOCBASE, is added to include/nuttx/fs/ioctl.h. The driver follows the datasheet NPZ-G1S-DS-V1.0 and applies the workarounds of the errata NPZ-G1S-ERRATA-V3.0: * #2: the SRAM is written one byte at a time in the workaround order, and NPZEROIOC_WRITEREG refuses the SRAM addresses. * apache#11: the IREF trim values are corrected at registration, after a reset of the nPZero. The peripheral power switch mode 0, which can lock up the polling, is refused. Tested on the nPZero G1S DevKit (STM32L053C8 host, npzero-g1s-dk:nsh): the ID and status are read, and the example configures the nPZero, enters Idle state and the host is woken up again. Signed-off-by: Alan C. Assis <acassis@gmail.com> Assisted-by: Claude:claude-opus-5-5
Describe the nPZero G1S driver: the configuration options, the board interface, the ioctl commands and the configuration structures, the errata handled by the driver and the ones left to the application, and the differences with the Nanopower driver API. Document the shared I2C bus: after a reset of the nPZero the peripheral power switches are off, and an unpowered sensor (the AS6212 board of the DevKit) slows down SDA so much that the host I2C controller reports an arbitration loss and npzero_register() fails with -EAGAIN. Signed-off-by: Alan C. Assis <acassis@gmail.com> Assisted-by: Claude:claude-opus-5-5
Add support for the STM32L053C8U6 MCU host of the Nanopower nPZero G1S Development Kit (NPZ-G1S-DK): * SYSCLK is the 16 MHz HSI (no crystal on the MCU host, and the STM32 I2C driver expects a 16 MHz I2C clock). * USART2 (PA2/PA3) is the console, on the MCU UART connector J19. * I2C1 (PB6/PB7) is the nPZero bus, the nPZero driver is registered as /dev/npzero0 at boot. * PA12 is the LED. The host I2C bus is shared with the sensor boards. After a reset of the nPZero their power switches are off and the unpowered AS6212 board on PMOD 4 slows down SDA (about 10 us, 100 us when SCL is low): the STM32 reports an arbitration loss. The new CONFIG_NPZERO_G1S_DK_PMOD_POWER option (default y) enables the power switches of PMOD 3 and 4 (PSWCTL, read-modify-write) with a bit-banged I2C transfer at about 2 kHz before the I2C driver is initialized. Configurations: * nsh: NSH with the npzero example. The 8 KB of SRAM is the limit: it uses CONFIG_DEFAULT_SMALL with ls, cat and echo, a 1792-byte NSH stack (ls peaks at about 1.3 KB) and smaller idle and init thread stacks. * npzero: the npzero example is the entry point, without NSH. Tested on the DevKit with npzero-g1s-dk:nsh, with the AS6212 board on PMOD 4, after a reset of the nPZero (S5): nsh> npzero -s nPZero G1S ID: 0x60 STA1: 0x01 STA2: 0x00 nsh> npzero nPZero G1S ID: 0x60 STA1: 0x01 STA2: 0x00 Configured, Idle state in 1000 ms The host is then switched off and woken up again by the nPZero. The npzero configuration builds but was not run on the board. Signed-off-by: Alan C. Assis <acassis@gmail.com> Assisted-by: Claude:claude-opus-5-5
Describe the STM32L053C8 MCU host of the nPZero G1S Development Kit: the pins, the hardware setup, the flashing (the host must be kept powered, and OpenOCD loses the core after a reset) and the npzero and nsh configurations. Document the I2C issue of the AS6212 board: an unpowered AS6212 on PMOD 4 blocks the shared I2C bus after a reset of the nPZero (also with the vendor firmware), the CONFIG_NPZERO_G1S_DK_PMOD_POWER workaround, and that a sensor board must not be plugged while the host is running. Signed-off-by: Alan C. Assis <acassis@gmail.com> Assisted-by: Claude:claude-opus-5-5
Describe the npzero example of the nPZero G1S driver: the sensors of the DevKit it configures, the wake-up conditions, what it does at each boot of the host, its usage and its configuration options. Document that the AS6212 board blocks the shared I2C bus when it is not powered: the example keeps the sensors powered while the host is on (pswint) and the npzero-g1s-dk board powers them after a reset of the nPZero, otherwise /dev/npzero0 is not registered. Signed-off-by: Alan C. Assis <acassis@gmail.com> Assisted-by: Claude:claude-opus-5-5
🔗 Cross-repo PR dependenciesThe read-only Build run reported the following dependent PR(s) and fetched head SHA(s):
CI run: https://github.com/apache/nuttx/actions/runs/43588870773 |
casaroli
approved these changes
Nov 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
These patches add support to nPZero chip and its board.
Depends-on: apache/nuttx-apps#4031
Impact
Users will be able to use nPZero chip with NuttX
Testing