Mini USB RP2040
The Mini USB RP2040 [15] is a very small, low-cost and versatile Chinese board from different manufactures or AliExpress webshops for Mini USB RP2040 [16]. It has no SWD interface, but a USB-A plug-in connector built directly into the PCB with a direct connection to the RP2040 on-chip USB controller. The Raspberry Pi Pico on-chip USB bootloader allows the ability to flash without any adapter, in a drag-and-drop manner.
Incorrect PCB assemblies in circulation!
Feedback on AliExpress suggests that assemblies are in circulation that use a normal two- or three-color chip LED (0606) instead of the original intended digital LED WS2812 (NeoPixel). Without the required series resistor, a chip LED is operating out of specification with far too much electrical current. However, the schematic and PCB layout do not provide any place for a series resistor to the digital LED, so it can’t also be added later. This poses a long-term risk of irreversible damage to either the incorrectly fitted chip LED or the output pad in the RP2040.
This will cause damage during continuous operation and the device should never being using unattended!
In such cases, the incorrectly equipped chip LED must be throttled
as quickly as possible after a reset or restart by the firmware via the
on-chip PWM unit. Please make sure to use the special board revision
mini_usb_rp2040@chipled for this purpose and never the standard
revisions mini_usb_rp2040@4mb or mini_usb_rp2040@16mb. This
special board revision (@chipled) automatically sets the duty cycle
to 0% on the preconfigured PWM channel before the application code is
started. The user must avoid outputting 100% themselves. There is
no further protection against overload due to insufficient electrical
current. Any duty cycle above 10% should be avoided!
Please note that the special board revision (@chipled)
is only designed for boards with 4㎆ QSPI Flash memory (and even the
incorrectly equipped chip LED)!
Board Overview
Hardware
The Mini USB RP2040 [15] is a mini sized RP2040 development board. The on-board PCB USB-A connector makes it plug-and-play instantly. The castellated module allows soldering direct to carrier boards.
Features and Resources |
Printed Circuit Board |
5V/300㎃ 3.3V/500㎃ 3.3V(OUT) 133㎒ 4㎆/16㎆ 264㎅ RST RGB USB-A UF2 15+13+2 16 4 2 1 1
Design Data |
|
Positions
Data Sheets
Flash partitions on 4㎆ revision
QSPI NOR-Flash |
bootrom |
code_partition |
storage_partition |
|---|---|---|---|
primary 4㎆ |
256B |
1㎆ - 256B |
3㎆ |
Flash partitions on 16㎆ revision
QSPI NOR-Flash |
bootrom |
code_partition |
storage_partition |
|---|---|---|---|
primary 16㎆ |
256B |
1㎆ - 256B |
15㎆ |
Pinouts
The peripherals of the RP2040 SoC [40] can be routed to various pins on the board. The configuration of these routes can be modified through DTS. Please refer to the datasheet to see the possible routings for each peripheral. The default assignment is showing below.
External pin mapping on the Mini USB RP2040 is not identical to the original Raspberry Pi Pico board. Almost all pins are rearranged in a more compact order. Likewise, the voltage sense and monitoring functions are not integrated. Thus all internal R2040 GPIO lines are available for free use, insofar there is sufficient space for them on the outer edge of the board or on the bottom side by additional solder points.
GPIO line 22 is not only exclusively routed to the on-board user RGB LED. It is also accessible on the bottom side on one of the 13 solder pads. The analog voltage reference is internally hard-wired to the digital 3.3V power supply and is not decoupled by a simple resistor. There is no option to change this from outside the board.
Default Zephyr Peripheral Mapping:
UART0_TX : GP0 (edge pin)
UART0_RX : GP1 (edge pin)
UART0_CTS : GP2 (edge pin, not default)
UART0_RTS : GP3 (edge pin, not default)
SPI0_RX : GP4 (edge pin)
SPI0_CSN : GP5 (edge pin)
SPI0_SCK : GP6 (edge pin)
SPI0_TX : GP7 (edge pin)
GPIO8 : GP8 (free usable pin)
GPIO9 : GP9 (free usable pad)
GPIO10 : GP10 (free usable pad)
GPIO11 : GP11 (free usable pad)
GPIO12 : GP12 (free usable pad)
GPIO13 : GP13 (free usable pad)
I2C1_SDA : GP14 (edge pin)
I2C1_SCL : GP15 (edge pin)
I2C0_SDA : GP16 (Qwiic)
I2C0_SCL : GP17 (Qwiic)
GPIO18 : GP18 (free usable pad)
GPIO19 : GP19 (free usable pad)
GPIO20 : GP20 (free usable pad)
GPIO21 : GP21 (free usable pad)
PIO0 : GP22 (only
@4mband@16mb)PWM_3A : GP22 (only
@chipled)GPIO23 : GP23 (free usable pad)
GPIO24 : GP24 (free usable pad)
GPIO25 : GP25 (free usable pad)
ADC_CH0 : GP26 (edge pin)
ADC_CH1 : GP27 (edge pin)
ADC_CH2 : GP28 (edge pin)
ADC_CH3 : GP29 (edge pin)
Supported Features
The Mini USB RP2040 board configuration supports the following hardware features:
Peripheral |
Kconfig option |
Devicetree compatible |
Zephyr API |
|---|---|---|---|
PINCTRL |
|||
GPIO |
|||
UART |
|||
UDC (USB Device Controller) |
|||
I2C |
|||
SPI |
|||
PWM |
|||
ADC |
|||
Temperature (Sensor) |
|||
RTC |
|||
Timer (Counter) |
|||
Watchdog Timer (WDT) |
|||
Flash |
|||
PIO |
N/A |
||
UART (PIO) |
|||
SPI (PIO) |
|||
WS2812 (PIO) |
|
N/A |
|
DMA |
|||
HWINFO |
N/A |
||
VREG |
|||
RESET |
|||
CLOCK |
|||
NVIC |
N/A |
Nested Vector Interrupts Controller |
|
SYSTICK |
N/A |
Other hardware features are not currently supported by Zephyr. The default configuration can be found in the different Kconfig files:
Board Configurations
The Mini USB RP2040 board offers an assembly option with 16㎆ Flash, which is mapped as a hardware revision.
west build -b mini_usb_rp2040
Use the native USB device port with CDC-ACM as Zephyr console and for the shell. Setup QSPI Flash controller to work with 4㎆. Bind GP22 to PIO0 and drive the on-board digital RGB-LED WS2812 (NeoPixel).
west build -b mini_usb_rp2040@4mb
Use the native USB device port with CDC-ACM as Zephyr console and for the
shell. Setup QSPI Flash controller to work with 4㎆ – the same as the default
board configuration mini_usb_rp2040. Bind GP22 to PIO0 and drive the
on-board digital RGB-LED WS2812 (NeoPixel).
west build -b mini_usb_rp2040@16mb
Use the native USB device port with CDC-ACM as Zephyr console and for the shell. Setup QSPI Flash controller to work with 16㎆. Bind GP22 to PIO0 and drive the on-board digital RGB-LED WS2812 (NeoPixel).
west build -b mini_usb_rp2040@chipled
Use the native USB device port with CDC-ACM as Zephyr console and for the shell. Setup QSPI Flash controller to work with 4㎆. Bind GP22 to PWM6 (3A) and drive the incorrectly equipped on-board chip LED; 0% duty cycle on boot.
Connections and IOs
Both the Chinese website about the Mini USB RP2040 [15] and almost all AliExpress retailers provide a few information about the board connections. Some of the data they give is pretty sketchy, especially those provided by retailers, which keep things to the bare minimum and often mess it up. The content provided here is the result of extensive technical evaluation, correction, rectification, and supplementation of this publicly available information.
Laced Grove Signal Interface
The Mini USB RP2040 offers the option of connecting hardware modules via one
single Qwiic/STEMMA QT (Grove connectors). This is provided by a specific
interface for general signal mapping, the Laced Grove Signal Interface.
Following mappings are well known:
grove_gpios: GPIO mappinggrove_pwms: PWM mapping
This is the GPIO signal line mapping from the RP2040 SOC [40] to the
set of Grove connectors provided as Laced Grove Signal Interface.
This list must not be stable!
phandle index to shield –> |
Signal : Meaning |
|
|---|---|---|
|
GP0: UART-TX (UART0/PWM0CHA) |
not wired |
|
GP1: UART-RX (UART0/PWM0CHB) |
not wired |
|
GP2: (UART-CTS) (UART0/PWM1CHA) |
not wired |
|
GP3: (UART-RTS) (UART0/PWM1CHB) |
not wired |
|
GP4: SPI-MISO (SPI0/PWM2CHA) |
not wired |
|
GP5: SPI-CS (SPI0/PWM2CHB) |
not wired |
|
GP6: SPI-CLK (SPI0/PWM3CHA) |
not wired |
|
GP7: SPI-MOSI (SPI0/PWM3CHB) |
not wired |
|
GP8: GPIO/PWM (PWM4CHA) |
not wired |
|
GP9: GPIO/PWM (PWM4CHB) |
not wired |
|
GP10: GPIO/PWM (PWM5CHA) |
not wired |
|
GP11: GPIO/PWM (PWM5CHB) |
not wired |
|
GP12: GPIO/PWM (PWM6CHA) |
not wired |
|
GP13: GPIO/PWM (PWM6CHB) |
not wired |
|
GP14: I2C-SDA (I2C1/PWM7CHA) |
not wired |
|
GP15: I2C-SCL (I2C1/PWM7CHB) |
not wired |
|
GP16: I2C-SDA (I2C0/PWM0CHA) |
<&grove_d17_header 1 …>↳
<&gpio0 16 …> |
|
GP17: I2C-SCL (I2C0/PWM0CHB) |
<&grove_d17_header 0 …>↳
<&gpio0 17 …> |
|
GP18: WS2812 (PWM1CHA) |
not wired |
|
GP19: GPIO/PWM (PWM1CHB) |
not wired |
|
GP20: GPIO/PWM (PWM2CHA) |
not wired |
|
GP21: GPIO/PWM (PWM2CHB) |
not wired |
|
GP22: WS2812 (PWM3CHA) |
not wired (RGB LED) |
|
GP23: GPIO/PWM (PWM3CHB) |
not wired |
|
GP24: GPIO/PWM (PWM4CHA) |
not wired |
|
GP25: GPIO/PWM (PWM4CHB) |
not wired |
|
GP26: ADC0/DIO26 (ADC/PWM5CHA) |
not wired |
|
GP27: ADC1/DIO27 (ADC/PWM5CHB) |
not wired |
|
GP28: ADC2/DIO28 (ADC/PWM6CHA) |
not wired |
|
GP29: ADC3 (ADC/PWM6CHB) |
not wired |
|
||
|
The corresponding mapping is always board or SOC specific. In addition
to the PWM signal line mapping, the valid references to the PWM
function units in the SOC or on the board are therefore also defined
as Grove PWM Labels. The following table reflects the currently
supported mapping for mini_usb_rp2040, but this list will be
growing up with further development and maintenance.
This list must not be complete or stable!
Grove PWM Label |
phandle index to shield –> |
Signal : Meaning |
|
|---|---|---|---|
|
GP0: UART-TX |
not wired (PWM0CHA) |
|
|
GP1: UART-RX |
not wired (PWM0CHB) |
|
|
GP2: (UART-CTS) |
not wired (PWM1CHA) |
|
|
GP3: (UART-RTS) |
not wired (PWM1CHB) |
|
|
GP4: SPI-MISO |
not wired (PWM2CHA) |
|
|
GP5: SPI-CS |
not wired (PWM2CHB) |
|
|
GP6: SPI-CLK |
not wired (PWM3CHA) |
|
|
GP7: SPI-MOSI |
not wired (PWM3CHB) |
|
|
GP8: GPIO/PWM |
not wired (PWM4CHA) |
|
|
GP9: GPIO/PWM |
not wired (PWM4CHB) |
|
|
GP10: GPIO/PWM |
not wired (PWM5CHA) |
|
|
GP11: GPIO/PWM |
not wired (PWM5CHB) |
|
|
GP12: GPIO/PWM |
not wired (PWM6CHA) |
|
|
GP13: GPIO/PWM |
not wired (PWM6CHB) |
|
|
GP14: I2C-SDA |
not wired (PWM7CHA) |
|
|
GP15: I2C-SCL |
not wired (PWM7CHB) |
|
|
|
GP16: I2C-SDA |
|
|
|
GP17: I2C-SCL |
|
|
GP18: GPIO/PWM |
not wired (PWM1CHA) |
|
|
GP19: GPIO/PWM |
not wired (PWM1CHB) |
|
|
GP20: GPIO/PWM |
not wired (PWM2CHA) |
|
|
GP21: GPIO/PWM |
not wired (PWM2CHB) |
|
|
GP22: WS2812 |
not wired (PWM3CHA) |
|
|
GP23: GPIO/PWM |
not wired (PWM3CHB) |
|
|
GP24: GPIO/PWM |
not wired (PWM4CHA) |
|
|
GP25: GPIO/PWM |
not wired (PWM4CHB) |
|
|
GP26: ADC0 |
not wired (PWM5CHA) |
|
|
GP27: ADC1 |
not wired (PWM5CHB) |
|
|
GP28: ADC2 |
not wired (PWM6CHA) |
|
|
GP29: ADC3 |
not wired (PWM6CHB) |
|
|
|||
|
System Clock
The RP2040 [40] MCU is configured to use the 12㎒ external crystal with the on-chip PLL generating the 125㎒ system clock. The internal AHB and APB units are set up in the same way as the upstream Raspberry Pi Pico C/C++ SDK [10] libraries.
GPIO (PWM) Ports
The RP2040 [40] MCU has 1 GPIO cell which covers all I/O pads and 8 PWM function unit each with 2 channels beside a dedicated Timer unit. On the Mini USB RP2040, almost all 16 PWM channels are available on the edge connectors, although some channels are occupied by special signals if their function is enabled.
ADC/TS Ports
The RP2040 [40] MCU has 1 ADC with 4 channels and an additional fifth channel for the on-chip temperature sensor (TS). The ADC channels 0-3 are available on the edge connectors.
The external voltage reference ADC_VREF is directly connected to the 3.3V power supply.
SPI Port
The RP2040 [40] MCU has 2 SPIs. The serial bus SPI0 is connect to external devices over GP7 (MOSI), GP4 (MISO), GP6 (SCK), and GP5 (CSn) on the edge connectors. SPI1 is not available in any default setup.
I2C Port
The RP2040 [40] MCU has 2 I2Cs. The serial bus I2C0 and I2C1 are connect to external devices by default over GP16 (I2C0_SDA), GP17 (I2C0_SCL) on the Grove compatible Qwiic/STEMMA QT connector and GP14 (I2C1_SDA), GP15 (I2C1_SCL) on the edge connectors. I2C1 is available but disabled in any default setup.
Serial Port
The RP2040 [40] MCU has 2 UARTs. One of the UARTs (UART0) is connected to external devices over GP0 (TX) and GP1 (RX) on the edge connectors. Optional the hardware handshake signals GP2 (CTS) and GP3 (RTS) can be used for flow control.
USB Device Port
The RP2040 [40] MCU has a (native) USB device port that can be used to communicate with a host PC. See the USB sample applications for more, such as the USB CDC ACM UART sample sample which sets up a virtual serial port that echos characters back to the host PC. The Mini USB RP2040 provides the Zephyr console per default on the USB port as CDC ACM:
USB device idVendor=2e8a, idProduct=000a, bcdDevice= 4.05 USB device strings: Mfr=1, Product=2, SerialNumber=3 Product: Mini USB RP2040 (CDC ACM) Manufacturer: Nologo (Raspberry Pi) SerialNumber: B163A72F0CF0C97A
Programmable I/O (PIO)
The RP2040 SoC [40] comes with two PIO periherals. These are two simple co-processors that are designed for I/O operations. The PIOs run a custom instruction set, generated from a custom assembly language. PIO programs are assembled using pioasm, a tool provided by Raspberry Pi. Further information can be found in the Raspberry Pi Pico C/C++ SDK [10] document, section with title “Using PIOASM, the PIO Assembler”.
Zephyr does not (currently) assemble PIO programs. Rather, they should be manually assembled and embedded in source code. An example of how this is done can be found at drivers/serial/uart_rpi_pico_pio.c or drivers/spi/spi_rpi_pico_pio.c.
Sample: SPI via PIO
The samples/sensor/bme280/README.rst sample includes a demonstration of using the PIO SPI driver to communicate with an environmental sensor. The PIO SPI driver supports using any combination of GPIO pins for an SPI bus, as well as allowing up to four independent SPI buses on a single board (using the two SPI devices as well as both PIO devices).
Programming and Debugging
Flashing
The board can only be flashed with a UF2 file. There is no SWD connector.
Using UF2
By default, building an application for the board will generate a
build/zephyr/zephyr.uf2 file. If the board is powered on with
the BOOTSEL button pressed, it will appear on the host as a mass
storage device:
USB device idVendor=2e8a, idProduct=0003, bcdDevice= 1.00 USB device strings: Mfr=1, Product=2, SerialNumber=0 Product: RP2 Boot Manufacturer: Raspberry Pi SerialNumber: E0C9125B0D9B
The UF2 file should be drag-and-dropped or copied on command line to the device, which will then flash the board.
RP2040 Boot-ROM
Each RP2040 SoC [40] ships the UF2 compatible [6] bootloader pico-bootrom-rp2040 [12], a native support in silicon. The full source for the RP2040 bootrom at pico-bootrom-rp2040 [12] includes versions B0, B1 and B2 of the bootrom, which correspond to the same silicon revisions, respectively.
Note that every time you build a program for the RP2040, the Pico SDK selects
an appropriate second stage bootloader based on what kind of external QSPI
Flash type the board configuration you are building for was giving. There
are several versions of boot2 [11] for different flash chips, and each one is
exactly 256 bytes of code which is put right at the start of the eventual
program binary. On Zephyr the boot2 versions are part of the
Raspberry Pi Pico HAL [14] module. Possible selections:
CONFIG_RP2_FLASH_AT25SF128A:CONFIG_RP2_FLASH_GENERIC_03H:CONFIG_RP2_FLASH_IS25LP080:CONFIG_RP2_FLASH_W25Q080:CONFIG_RP2_FLASH_W25X10CL:
The board set this option to CONFIG_RP2_FLASH_W25Q080.
Further information can be found in the RP2040 Datasheet [41], sections with title “Bootrom” and “Processor Controlled Boot Sequence” or Brian Starkey’s Blog article Pico serial bootloader [13]
Debugging
The board does not provide any SWD connector, thus debugging software is not possible.
Basic Samples
LED Blinky and Fade
WS2812 LED Test Pattern by PIO
See also Zephyr sample: LED strip.
west build -b mini_usb_rp2040/rp2040 -p -d build/mini_usb_rp2040 zephyr/samples/drivers/led/led_strip -- -DCONFIG_SAMPLE_LED_UPDATE_DELAY=500
west flash -d build/mini_usb_rp2040
Hint
Neither LED Blinky nor LED Fade can be built and executed on this board, because this system has only one digital RGB LED. A simple GPIO or PWM control is not possible!
You should see the following message on the console:
Console Output
*** Booting Zephyr OS build v4.5.0…*** [00:00:00.003,000] <inf> main: Found LED strip device ws2812 [00:00:00.003,000] <inf> main: Displaying pattern on strip
Hello Shell on the USB Console (CDC/ACM)
Hello Shell
See also Bridle sample: Hello Shell.
On
@4mbrevision (default)west build -b mini_usb_rp2040/rp2040 -p -d build/mini_usb_rp2040 bridle/samples/helloshell west flash -d build/mini_usb_rp2040On
@16mbrevisionwest build -b mini_usb_rp2040@16mb/rp2040 -p -d build/mini_usb_rp2040 bridle/samples/helloshell west flash -d build/mini_usb_rp2040On
@chipledrevision (PWM throttling)west build -b mini_usb_rp2040@chipled/rp2040 -p -d build/mini_usb_rp2040 bridle/samples/helloshell west flash -d build/mini_usb_rp2040
Simple test execution on target
(text in bold is a command input)
Basics (Bridle)
uart:~$ hello -h hello - say hello uart:~$ hello Hello from shell.System
uart:~$ hwinfo devid Length: 8 ID: 0xbd774b2618daaa7d uart:~$ kernel version Zephyr version 4.5.0 uart:~$ bridle version Bridle version 4.4.99 uart:~$ bridle version long Bridle version 4.4.99.0 uart:~$ bridle info Zephyr: 4.5.0 Bridle: 4.4.99Devices
On board revision
@4mbor@16mb:uart:~$ device list devices: - clock-controller@40008000 (READY) DT node labels: clocks - reset-controller@4000c000 (READY) DT node labels: reset - cdc-acm-console-uart (READY) DT node labels: cdc_acm_console_uart - timer@40054000 (READY) DT node labels: timer - uart@40034000 (READY) DT node labels: uart0 - watchdog@40058000 (READY) DT node labels: wdt0 - pio@50200000 (READY) DT node labels: ((pio_hw_t *)0x50200000u) - dma@50000000 (READY) DT node labels: dma - gpio-port@0 (READY) DT node labels: gpio0 - usbd@50110000 (READY) DT node labels: usbd zephyr_udc0 - adc@4004c000 (READY) DT node labels: adc - flash-controller@18000000 (READY) DT node labels: ssi - i2c@40044000 (READY) DT node labels: i2c0 zephyr_i2c stemma_i2c qwiic_i2c grove_i2c - vreg@40064000 (READY) DT node labels: vreg - rtc@4005c000 (READY) DT node labels: rtc - pio-ws2812 (READY) - ws2812 (READY) DT node labels: ws2812 led_strip - dietemp (READY) DT node labels: die_tempOn board revision
@chipled:uart:~$ device list devices: - clock-controller@40008000 (READY) DT node labels: clocks - reset-controller@4000c000 (READY) DT node labels: reset - cdc-acm-console-uart (READY) DT node labels: cdc_acm_console_uart - timer@40054000 (READY) DT node labels: timer - uart@40034000 (READY) DT node labels: uart0 - watchdog@40058000 (READY) DT node labels: wdt0 - dma@50000000 (READY) DT node labels: dma - gpio-port@0 (READY) DT node labels: gpio0 - usbd@50110000 (READY) DT node labels: usbd zephyr_udc0 - adc@4004c000 (READY) DT node labels: adc - flash-controller@18000000 (READY) DT node labels: ssi - i2c@40044000 (READY) DT node labels: i2c0 zephyr_i2c stemma_i2c qwiic_i2c grove_i2c - pwm@40050000 (READY) DT node labels: pwm grove_pwm_d16 grove_pwm_d17 - vreg@40064000 (READY) DT node labels: vreg - rtc@4005c000 (READY) DT node labels: rtc - pwm-chipleds (READY) DT node labels: pwm_chipleds - dietemp (READY) DT node labels: die_tempOperate with the Voltage Regulator
Operate with the on-chip voltage regulator unit:
uart:~$ regulator vlist vreg 0.800000 V 0.850000 V 0.900000 V 0.950000 V 1.000000 V 1.050000 V 1.100000 V 1.150000 V 1.200000 V 1.250000 V 1.300000 Vuart:~$ regulator vget vreg 1.100000 VTrigger a power-off/on sequence on
@4mbrevision:uart:~$ hwinfo reset_cause reset caused by: - pin uart:~$ regulator disable vreg [00:00:00.001,000] <inf> board_control: mini_usb_rp2040@4mb/rp2040 [00:00:00.001,000] <inf> board_control: QSPI-Flash: 4MB *** Booting Zephyr OS build v4.5.0…*** Hello World! I'm THE SHELL from mini_usb_rp2040Trigger a power-off/on sequence on
@16mbrevision:uart:~$ hwinfo reset_cause reset caused by: - pin uart:~$ regulator disable vreg [00:00:00.001,000] <inf> board_control: mini_usb_rp2040@16mb/rp2040 [00:00:00.001,000] <inf> board_control: QSPI-Flash: 16MB *** Booting Zephyr OS build v4.5.0…*** Hello World! I'm THE SHELL from mini_usb_rp2040Trigger a power-off/on sequence on
@chipledrevision:uart:~$ hwinfo reset_cause reset caused by: - pin uart:~$ regulator disable vreg [00:00:00.001,000] <inf> board_control: mini_usb_rp2040@chipled/rp2040 [00:00:00.001,000] <inf> board_control: QSPI-Flash: 4MB [00:00:00.002,000] <inf> board_control: Chip-LED PWM configured. *** Booting Zephyr OS build v4.5.0…*** Hello World! I'm THE SHELL from mini_usb_rp2040uart:~$ hwinfo reset_cause reset caused by: - power-on resetOperate with the RGB digital LED strip
Operate with the RGB digital LED strip 1 RGB at PIO0 / GP22:
uart:~$ led_strip get_length led_strip ws2812 has 1 pixel(s)Sett all LEDs to RED:
uart:~$ led_strip fill led_strip 070000 1Sett all LEDs to YELLOW:
uart:~$ led_strip fill led_strip 070700 1Sett all LEDs to GREEN:
uart:~$ led_strip fill led_strip 000700 1Sett all LEDs to CYAN:
uart:~$ led_strip fill led_strip 000707 1Sett all LEDs to BLUE:
uart:~$ led_strip fill led_strip 000007 1Sett all LEDs to MAGENTA:
uart:~$ led_strip fill led_strip 070007 1Sett all LEDs to WHITE (all on):
uart:~$ led_strip fill led_strip 070707 1Sett all LEDs to BLACK (all off):
uart:~$ led_strip fill led_strip 000000 1Information about the on-chip GPIO
Get an overview of aviliable signale names:
uart:~$ gpio info gpio0 ngpios: 30 Reserved pin mask: 0xC0400000 Reserved Pin Line Name 0 TX0 1 RX0 2 GP2_CTS0 3 GP3_RTS0 4 SDI0 5 CSN0 6 SCK0 7 SDO0 8 GP8_PWM8 9 GP9_PWM9 10 GP10_PWM10 11 GP11_PWM11 12 GP12_PWM12 13 GP13_PWM13 14 GP14_SDA1 15 GP15_SCL1 16 SDA0 17 SCL0 18 GP18_PWM2 19 GP19_PWM3 20 GP20_PWM4 21 GP21_PWM5 * 22 23 GP23_PWM7 24 GP24_PWM8 25 GP25_PWM9 26 ADC0 27 ADC1 28 ADC2 29 ADC3Operate with the on-chip ADC
Operate with the channels:
on-chip temperature sensor on channel ADC_CH4
uart:~$ adc adc@4004c000 resolution 12 uart:~$ adc adc@4004c000 print adc@4004c000: Gain: 1 Reference: INTERNAL Acquisition Time: 0 Channel ID: 0 Differential: 0 Resolution: 12uart:~$ adc adc@4004c000 read 4 read: 860Operate with the on-chip RTC
uart:~$ rtc get rtc RTC not setuart:~$ rtc set rtc 2024-11-23T18:37:55 uart:~$ rtc get rtc 2024-11-23T18:37:59.000Operate with the on-chip Timer
uart:~$ timer oneshot timer 0 1000000 timer: Alarm triggeredOperate with the on-chip Flash Controller
Erase, Write and Verify
uart:~$ flash read ssi 0xe0000 0x40 000E0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........| 000E0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........| 000E0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........| 000E0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........| uart:~$ flash test ssi 0xe0000 0x1000 2 Erase OK. Write OK. Verified OK. Erase OK. Write OK. Verified OK. Erase-Write-Verify test done.Details
uart:~$ flash read ssi 0xe0000 0x40 000E0000: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f |........ ........| 000E0010: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f |........ ........| 000E0020: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f | !"#$%&' ()*+,-./| 000E0030: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f |01234567 89:;<=>?| uart:~$ flash page_info 0xe0000 Page for address 0xe0000: start offset: 0xe0000 size: 4096 index: 224Revert
uart:~$ flash erase ssi 0xe0000 0x1000 Erase success. uart:~$ flash read ssi 0xe0000 0x40 000E0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........| 000E0010: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........| 000E0020: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........| 000E0030: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |........ ........|Operate with the on-chip I2C on Qwiic with BMP280
The Mini USB RP2040 has no on-board I2C devices. For this example the Grove Temperature and Barometer Sensor – BMP280 [27] was plugged into the Qwiic connector.
uart:~$ i2c scan zephyr_i2c 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- 77 1 devices found on zephyr_i2cThe I2C address
0x77is a Bosch BMP280 Air Pressure Sensor and their Chip-ID can read from register0xd0. The Chip-ID must be0x58:uart:~$ i2c read_byte zephyr_i2c 77 d0 Output: 0x58Operate with the on-chip Die Temperature Sensor
Operate with the on-chip temperature sensor on ADC channel 4:
uart:~$ sensor info device name: dietemp, vendor: Raspberry Pi Foundation, model: pico-temp, friendly name: RP2040 chip temperatureuart:~$ sensor get dietemp channel type=12(die_temp) index=0 shift=6 num_samples=1 value=560319800000ns (35.134804)
More Samples
Grove Module Samples
All currently supported Grove modules can be reused on the Qwiic / STEMMA QT connector using a conversion cable. Only the corresponding shield stacks need to be specified.
Hello Shell with sensor access to Grove BMP280
Hello Shell
See also Bridle sample: Hello Shell.
west build -b mini_usb_rp2040/rp2040 -p --shield "grove_sens_bmp280" -d build/mini_usb_rp2040 bridle/samples/helloshell
west flash -d build/mini_usb_rp2040
Simple test execution on target
(text in bold is a command input)
Devices
Only an excerpt from the full list:
uart:~$ device list devices: … … … - bmp280@77 (READY) … … …Sensor access from Zephyr Shell
uart:~$ sensor info device name: dietemp, vendor: Raspberry Pi Foundation, model: pico-temp, friendly name: RP2040 chip temperature device name: bmp280@77, vendor: Bosch Sensortec GmbH, model: bme280, friendly name: Grove TP Sensor V1.0 (BME280)uart:~$ sensor get bmp280@77 channel type=13(ambient_temp) index=0 shift=16 num_samples=1 value=53909207971ns (24.739990) channel type=14(press) index=0 shift=23 num_samples=1 value=53909207971ns (99.210937) channel type=16(humidity) index=0 shift=21 num_samples=1 value=53909207971ns (0.000000)
BME280 humidity and pressure sensor with Grove BMP280
See also Grove Sensor Shields in Bridle and Zephyr sample: BME280 humidity and pressure sensor.
west build -b mini_usb_rp2040/rp2040 -p --shield "grove_sens_bmp280" -d build/mini_usb_rp2040 zephyr/samples/sensor/bme280 west flash -d build/mini_usb_rp2040
You should see the following message on the console:
Console Output
[00:00:00.004,000] <dbg> BME280.bme280_chip_init: ID OK (BMP280) [00:00:00.010,000] <dbg> BME280.bme280_chip_init: "bmp280@77" OK *** Booting Zephyr OS build v4.5.0…*** Found device "bmp280@77", getting sensor data temp: 25.89996; press: 98.949218; humidity: 0.7812 temp: 25.89996; press: 98.949218; humidity: 0.7812 temp: 25.99975; press: 98.953125; humidity: 0.7812 temp: 25.99975; press: 98.953125; humidity: 0.7812 temp: 25.99975; press: 98.953125; humidity: 0.7812 temp: 25.99975; press: 98.953125; humidity: 0.7812 temp: 25.99975; press: 98.953125; humidity: 0.7812 temp: 25.99975; press: 98.953125; humidity: 0.7812 temp: 25.99975; press: 98.953125; humidity: 0.7812 … … …