Waveshare RP2040-Geek

The RP2040 SoC [36] by Raspberry Pi Ltd. is a small sized and low-cost 32-bit dual ARM Cortex-M0+ microcontroller and predestined for versatile board designs. The Waveshare RP2040 board series based on this microcontroller offers a wide range with different scaling factors, in size, features and interfaces for communication, input and output.

Board Overview

Hardware

The RP2040 Geek is an RP2040 development board for geeks, housed in a special case and ready to build your own Picoprobe [14] USB-to-SWD and UART bridge. The on-board USB-A connector makes it usable on any host computer. The two dedicated on-board 3-pin SWD port and 3-pin UART port are compatible to the original Raspberry Pi Debug Probe [15]. For more details read the Raspberry Pi 3-pin Debug Connector Specification [16]. An additional 4-pin IO port with I2C or ADC pins can be used for testing target boards.

Features and Resources

Printed Circuit Board

5V/200㎃ 3.3V/300㎃ 3.3V(OUT)

133㎒ 4㎆ 264㎅ LCD TF/microSD USB-A UF2

6 6 2 2 2

  • Dual core Arm Cortex-M0+ processor running up to 133㎒

  • 264㎅ on-chip SRAM

  • 4㎆ on-board QSPI flash with XIP capabilities

  • USB 1.1 controller (host/device)

  • On-board USB-A connector

  • On-board 3.3V LDO regulator with 300㎃

  • On-board BOOT button

  • On-board 1.14-inch 240×135 pixels 65K colorful IPS LCD

  • RGB565, 16-bit color depth

  • 1 RST signal to LCD controller

  • 1 C/D signal to LCD controller

  • 2(6) GPIO pins via edge pinout

  • 1(2) UART peripherals via edge pinout

  • 1(2) I2C controllers via edge pinout

  • 2 SPI controllers for on-board functions

  • 2(6) PWM channels via edge pinout

  • (2) ADC analog inputs

  • 8 Programmable I/O (PIO) state machines for custom peripherals

  • 1 Watchdog timer peripheral

  • 1 Temperature sensor on-chip

Design Data

Waveshare RP2040-Geek

Positions

Waveshare RP2040-Geek details
  1. USB-A port

  2. RT9193-33
    300㎃ low dropout, low noise, ultra-fast LDO
  3. TF card slot
    supports SDIO and SPI interface communication
  4. On-board flash memory
    4㎆ NOR-Flash W25Q32JV
  5. RP2040

    on upside ST7789V
    1.14-inch 240×135 pixels 65K colorful IPS LCD
  1. BOOT button
    press it when resetting to enter download mode
  2. I2C/ADC port
    2 GPIO pins with GND and 3V3, optional also ADC, UART or PWM
  3. DEBUG port
    2 GPIO pins with GND, optional also I2C, UART or PWM
  4. UART port
    2 GPIO pins with GND, optional also I2C or PWM

Data Sheets

Flash partitions

QSPI NOR-Flash

bootrom

code_partition

storage_partition

primary 4㎆

256B

1㎆ - 256B

3㎆

Pinouts

The peripherals of the RP2040 SoC [36] 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 assignments for the board is defined below.

External pin mapping on the RP2040-Geek is compatible to the original Raspberry Pi Debug Probe [15], but not identical. One additional edge connector provides two special IO pins for target board testing (I2C in default or ADC). There is no SPI bus on any edge connector. These are used internally to connect the on-board LCD and TF card slots.

Pin Mapping

Pinout

on-edge:

2 2 (2) 1 1

on-board:

1 BL 1 LCD 1 TF/microSD

Default Zephyr Peripheral Mapping

 

  • nc PIO/PWM : GP0 (PWM0)
  • nc PIO/PWM : GP1 (PWM1)
  • D1 PIO/PWM : GP2 PWM2
    D1 (I2C1_SDA)
  • D2 GND
  • D3 PIO/PWM : GP3 PWM3
    D3 (I2C1_SCL)
  • U1 UART1_TX : GP4 (PWM4)
    U1 (I2C0_SDA)
  • U2 GND
  • U3 UART1_RX : GP5 (PWM5)
    U3 (I2C0_SCL)
  • nc PIO/PWM : GP6 (PWM6)
  • nc PIO/PWM : GP7 (PWM7)
  • nc GPIO8 : GP8 (PWM8)
    nc on-board LCD data/cmd LCD_DC
  • nc SPI1_CSN GPIO9 : GP9
    nc on-board LCD chip select LCD_CS
  • nc SPI1_SCK : GP10 (PWM10)
    nc on-board LCD i/f clock LCD_CLK
  • nc SPI1_TX : GP11 (PWM11)
    nc on-board LCD i/f data LCD_DIN
  • nc GPIO12 : GP12 (PWM12)
    nc on-board LCD reset LCD_RST
  • nc PIO/PWM : GP13 (PWM13)
  • nc PIO/PWM : GP14 (PWM14)
  • nc PIO/PWM : GP15 (PWM15)
  • nc PIO/PWM : GP16 (PWM0)
  • nc PIO/PWM : GP17 (PWM1)
  • nc SPI0_SCK : GP18 (PWM2)
    nc on-board SDHC clock SDIO_CLK
  • nc SPI0_TX : GP19 (PWM3)
    nc on-board SDHC cmd SDIO_CMD
  • nc SPI0_RX : GP20 (PWM4)
    nc on-board SDHC data 0 SDIO_D0
  • nc GPIO21 : GP21 (PWM5)
    nc on-board SDHC data 1 SDIO_D1
  • nc GPIO22 : GP22 (PWM6)
    nc on-board SDHC data 2 SDIO_D2
  • nc SPI1_CSN GPIO23 : GP23
    nc on-board SDHC data 3 SDIO_D3
  • nc PIO/PWM : GP24 (PWM8)
  • nc GPIO25 : GP25 (PWM9)
    nc on-board LCD backlight LCD_BL
  • nc PIO/PWM : GP26 (PWM10)
  • nc PIO/PWM : GP27 (PWM11)
  • I4 GND
  • I3 3V3(OUT)
  • I2 I2C0_SDA : GP28 (PWM12)
    I2 (ADC_CH2) (UART0_TX)
  • I1 I2C0_SCL : GP29 (PWM13)
    I1 (ADC_CH3) (UART1_TX)

Devicetree compatible

Waveshare RP2040-Geek edge pinout example as Picoprobe

Example as Picoprobe USB-to-SWD and UART bridge.

Supported Features

Similar to the Raspberry Pi Pico the board configuration supports the following hardware features:

Hardware Features Supported by Zephyr

Peripheral

Kconfig option

Devicetree compatible

Zephyr API

PINCTRL

CONFIG_PINCTRL

raspberrypi,pico-pinctrl

Pin Control API

GPIO

CONFIG_GPIO

raspberrypi,pico-gpio

General-Purpose Input/Output (GPIO)

UART

CONFIG_SERIAL

Universal Asynchronous Receiver-Transmitter (UART)

UDC (USB Device Controller)

CONFIG_USB_DEVICE_STACK_NEXT

raspberrypi,pico-usbd

USB device support APIs

I2C

CONFIG_I2C

raspberrypi,pico-i2c

Inter-Integrated Circuit (I2C) Bus

SPI

CONFIG_SPI

Serial Peripheral Interface (SPI) Bus

PWM

CONFIG_PWM

raspberrypi,pico-pwm

Pulse Width Modulation (PWM)

ADC

CONFIG_ADC

raspberrypi,pico-adc

Analog-to-Digital Converter (ADC)

Temperature (Sensor)

CONFIG_SENSOR

raspberrypi,pico-temp

Sensors

RTC

CONFIG_RTC

raspberrypi,pico-rtc

Real-Time Clock (RTC)

Timer (Counter)

CONFIG_COUNTER

raspberrypi,pico-timer

Counter

Watchdog Timer (WDT)

CONFIG_WATCHDOG

raspberrypi,pico-watchdog

Watchdog

Flash

CONFIG_FLASH

raspberrypi,pico-flash-controller

Flash and Flash map

PIO

CONFIG_PIO_RPI_PICO

raspberrypi,pico-pio

N/A

UART (PIO)

CONFIG_SERIAL

raspberrypi,pico-uart-pio

Universal Asynchronous Receiver-Transmitter (UART)

SPI (PIO)

CONFIG_SPI

raspberrypi,pico-spi-pio

Serial Peripheral Interface (SPI) Bus

DMA

CONFIG_DMA

raspberrypi,pico-dma

Direct Memory Access (DMA)

HWINFO

CONFIG_HWINFO

N/A

Hardware Information

VREG

CONFIG_REGULATOR

raspberrypi,core-supply-regulator

Regulators

RESET

CONFIG_RESET

raspberrypi,pico-reset

Reset Controller

CLOCK

CONFIG_CLOCK_CONTROL

Clock Control

NVIC

N/A

arm,v6m-nvic

Nested Vector Interrupts Controller

SYSTICK

N/A

arm,armv6m-systick

Other hardware features are not currently supported by Zephyr. The default configuration can be found in the different Kconfig files:

Board Configurations

The board can be configured for the following different use cases.

west build -b waveshare_rp2040_geek

Use the serial port UART1 on edge header as Zephyr console and for the shell.

west build -b waveshare_rp2040_geek -S usb-console

Use the native USB device port with CDC-ACM as Zephyr console and for the shell.

Connections and IOs

The Waveshare wiki [19] has detailed information about board connections. Download the different schematics or datasheets as linked above per board for more details. The pinout diagrams can also be found there.

System Clock

The RP2040 [36] 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 [11] libraries.

GPIO (PWM) Ports

The RP2040 [36] 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. The channel PWM4 B is available on the on-board backlight LED. Only the channels PWM1 A and B are available on one of the three edge connectors. Both PWM channels will share the same lines with the I2C1 signals.

ADC/TS Ports

The RP2040 [36] MCU has 1 ADC with 4 channels and an additional fifth channel for the on-chip temperature sensor (TS). The ADC channels 2-3 are available on one of the three edge connectors. Both ADC channels will share the same lines with the I2C0 signals.

The external voltage reference ADC_VREF is directly connected to the 3.3V power supply.

SPI Port

The RP2040 [36] MCU has 2 SPIs. Neither of the two SPIs is exposed externally. These are connected internally to the LCD and the TF/microSD card interfaces.

I2C Port

The RP2040 [36] MCU has 2 I2Cs. To one of the three edge connectors I2C0 is connect to external devices over GP28 (I2C0_SDA) and GP29 (I2C0_SCL). Teses two I2C0 signals will share the same lines with ADC channels 2 and 3. I2C0 is enabled by default.

Serial Port

The RP2040 [36] MCU has 2 UARTs. One of the UARTs (UART1) is connected to external devices over GP4 (TX) and GP5 (RX) on one of the three edge connectors. UART0 is not enabled by default.

USB Device Port

The RP2040 [36] 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. As an alternative to the default Zephyr console on serial port the Bridle USB Console Snippet (usb-console) can be used to enable CDC ACM and switch the console to USB:

USB device idVendor=2e8a, idProduct=000a, bcdDevice= 4.05
USB device strings: Mfr=1, Product=2, SerialNumber=3
Product: RP2040-Geek (CDC ACM)
Manufacturer: Waveshare (Raspberry Pi)
SerialNumber: B69F8448A6E91514

To integrate specific USB device functions that do not follow a USB standard class, the following alternate identifier numbers are available for the various Waveshare RP2040 and RP2350 boards according to the Raspberry Pi USB product ID list [10]:

RP2040

0x101F:

RP2040-Zero

0x1020:

RP2040-Plus

0x1021:

RP2040-LCD-0.96

0x1039:

RP2040-LCD-1.28

0x103A:

RP2040-One

0x1044:

Power Management HAT (B)

0x1055:

RP2040-ETH

0x1056:

RP2040-Geek

0x1057:

RP2040-Touch-LCD-1.28

0x1083:

RP2040-PiZero

0x1084:

RP2040-Tiny

0x1085:

RP2040-Matrix

0x1086:

RP2040-BLE

0x1087:

PICO-Cam-A

RP2350

0x10B0:

RP2350-Zero

0x10B1:

RP2350-Plus

0x10B2:

RP2350-Tiny

0x10B3:

RP2350-LCD-1.28

0x10B4:

RP2350-Touch-LCD-1.28

0x10B5:

RP2350-One

0x10B6:

RP2350-Geek

0x10B7:

RP2350-LCD-0.96

0x10C3:

RP2350-ETH

 

Programmable I/O (PIO)

The RP2040 SoC [36] 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 [11] 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.

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 [36] ships the UF2 compatible [6] bootloader pico-bootrom-rp2040 [13], a native support in silicon. The full source for the RP2040 bootrom at pico-bootrom-rp2040 [13] 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 [12] 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 [18] module. Possible selections:

CONFIG_RP2_FLASH_AT25SF128A:

boot2_at25sf128a.S [39]

CONFIG_RP2_FLASH_GENERIC_03H:

boot2_generic_03h.S [40]

CONFIG_RP2_FLASH_IS25LP080:

boot2_is25lp080.S [41]

CONFIG_RP2_FLASH_W25Q080:

boot2_w25q080.S [42]

CONFIG_RP2_FLASH_W25X10CL:

boot2_w25x10cl.S [43]

The board set this option to CONFIG_RP2_FLASH_W25Q080.

Further information can be found in the RP2040 Datasheet [37], sections with title “Bootrom” and “Processor Controlled Boot Sequence” or Brian Starkey’s Blog article Pico serial bootloader [17]

Debugging

The board does not provide any SWD connector, thus debugging software is not possible.

Basic Samples

LED Blinky and Fade

Hint

Neither LED Blinky nor LED Fade can be built and executed on the RP2040-Geek for an actual user LED, but of course the LCD backlight can be used for testing purposes.

LCD Backlight LED Blinky by GPIO

See also Zephyr sample: Blinky.

west build -b waveshare_rp2040_geek/rp2040 -p -d build/waveshare_rp2040_geek zephyr/samples/basic/blinky -- -DCONFIG_REGULATOR_GPIO=n
west flash -d build/waveshare_rp2040_geek

LCD Backlight LED Blinky by PWM

See also Zephyr sample: PWM Blinky.

west build -b waveshare_rp2040_geek/rp2040 -p -d build/waveshare_rp2040_geek zephyr/samples/basic/blinky_pwm -- -DCONFIG_REGULATOR_GPIO=n
west flash -d build/waveshare_rp2040_geek

LCD Backlight LED Fade by PWM

See also Zephyr sample: Fade LED.

west build -b waveshare_rp2040_geek/rp2040 -p -d build/waveshare_rp2040_geek zephyr/samples/basic/fade_led -- -DCONFIG_REGULATOR_GPIO=n
west flash -d build/waveshare_rp2040_geek

Hint

Even with the help of the dedicated Loopback wiring for tests shield, all necessary device tree changes are temporarily carried out to execute the standard examples. This assumes the external wiring as shown below (on the right).

Waveshare RP2040-Geek with loopback wiring for tests

External LED Blinky by GPIO

See also Zephyr sample: Blinky.

west build -b waveshare_rp2040_geek/rp2040 -p --shield "loopback_test" -d build/waveshare_rp2040_geek zephyr/samples/basic/blinky
west flash -d build/waveshare_rp2040_geek

External LED Blinky by PWM

See also Zephyr sample: PWM Blinky.

west build -b waveshare_rp2040_geek/rp2040 -p --shield "loopback_test" -d build/waveshare_rp2040_geek zephyr/samples/basic/blinky_pwm
west flash -d build/waveshare_rp2040_geek

External LED Fade by PWM

See also Zephyr sample: Fade LED.

west build -b waveshare_rp2040_geek/rp2040 -p --shield "loopback_test" -d build/waveshare_rp2040_geek zephyr/samples/basic/fade_led
west flash -d build/waveshare_rp2040_geek

External LED Switch ON/OFF by External Button

See also Zephyr sample: Button.

west build -b waveshare_rp2040_geek/rp2040 -p --shield "loopback_test" -d build/waveshare_rp2040_geek zephyr/samples/basic/button
west flash -d build/waveshare_rp2040_geek

Hello Shell with USB-CDC/ACM Console

Hello Shell

See also Bridle sample: Hello Shell.

west build -b waveshare_rp2040_geek/rp2040 -p -S "usb-console" --shield "loopback_test" -d build/waveshare_rp2040_geek bridle/samples/helloshell
west flash -d build/waveshare_rp2040_geek

Simple test execution on target

(text in bold is a command input)

uart:~$ hello -h
hello - say hello
uart:~$ hello
Hello from shell.
uart:~$ hwinfo devid
Length: 8
ID: 0x877b9fd26338399c

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.99
uart:~$ device list
devices:
- clock-controller@40008000 (READY)
  DT node labels: clocks
- reset-controller@4000c000 (READY)
  DT node labels: reset
- snippet_cdc_acm_console_uart (READY)
  DT node labels: snippet_cdc_acm_console_uart
- timer@40054000 (READY)
  DT node labels: timer
- uart@40038000 (READY)
  DT node labels: uart1 rpidbg_serial grove_serial pico_serial rpipico_serial
- 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 rpigeek_adc
- flash-controller@18000000 (READY)
  DT node labels: ssi
- i2c@40044000 (READY)
  DT node labels: i2c0 zephyr_i2c stemma_i2c qwiic_i2c grove_i2c0 grove_i2c pico_i2c0 pico_i2c rpipico_i2c0 rpipico_i2c
- pwm@40050000 (READY)
  DT node labels: pwm rpigeek_pwm
- vreg@40064000 (READY)
  DT node labels: vreg
- rtc@4005c000 (READY)
  DT node labels: rtc
- lcd-backlight-en (READY)
  DT node labels: lcd_backlight_en
- rpigeek-dbg-pwm-leds (READY)
  DT node labels: pwm_leds
- dietemp (READY)
  DT node labels: die_temp
uart:~$ history
[  0] history
[  1] device list
[  2] bridle info
[  3] bridle version long
[  4] bridle version
[  5] kernel version
[  6] hwinfo devid
[  7] hello
[  8] hello -h

More Samples

Display Test and Demonstration

The following samples work with the chosen display. That is:

LCD : chosen { zephyr,display = &lcd_panel; };
ST7789V : lcd_panel: &st7789v_240x135 {};

LCD Orientation and Bit Order Test

Draw some basic rectangles onto the display using the Display driver API. See also Zephyr sample: Display.

west build -b waveshare_rp2040_geek/rp2040 -p -S "usb-console" -d build/waveshare_rp2040_geek zephyr/samples/drivers/display
west flash -d build/waveshare_rp2040_geek
Waveshare RP2040-Geek Display Sample Animation

TOP LEFT, TOP RIGHT, BOTTOM RIGHT

LVGL Basic Sample

Displays “Hello World!” in the center of the screen and a counter at the bottom which increments every second using the LVGL module on top of the Display driver API. See also Zephyr sample: LVGL basic sample.

west build -b waveshare_rp2040_geek/rp2040 -p -S "usb-console" -d build/waveshare_rp2040_geek zephyr/samples/subsys/display/lvgl
west flash -d build/waveshare_rp2040_geek

This sample comes with a Shell command line access to the LVGL backend on the console, here configured for a USB console:

Simple test execution on target

uart:~$ lvgl
lvgl - LVGL shell commands
Subcommands:
  stats   : Show LVGL statistics
  monkey  : LVGL monkey testing

uart:~$ lvgl stats
stats - Show LVGL statistics
Subcommands:
  memory  : Show LVGL memory statistics
            Usage: memory [-c]
                   -c  dump chunk information

uart:~$ lvgl stats memory
Heap at 0x20001520 contains 2047 units in 11 buckets

  bucket#    min units        total      largest      largest
             threshold       chunks      (units)      (bytes)
  -----------------------------------------------------------
        0            1            1            1            8
        1            2            3            3           24
       10         1024            1         1138         9104

9148 free bytes, 6716 allocated bytes, overhead = 516 bytes (3.2%)
uart:~$ device list
devices:
- clock-controller@40008000 (READY)
  DT node labels: clocks
- reset-controller@4000c000 (READY)
  DT node labels: reset
- snippet_cdc_acm_console_uart (READY)
  DT node labels: snippet_cdc_acm_console_uart
- timer@40054000 (READY)
  DT node labels: timer
- uart@40038000 (READY)
  DT node labels: uart1 rpidbg_serial grove_serial pico_serial rpipico_serial
- 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
- pwm@40050000 (READY)
  DT node labels: pwm rpigeek_pwm
- vreg@40064000 (READY)
  DT node labels: vreg
- spi@40040000 (READY)
  DT node labels: spi1
- spi@4003c000 (READY)
  DT node labels: spi0
- lcd-backlight-en (READY)
  DT node labels: lcd_backlight_en
- mipi-dbi-spi1 (READY)
  DT node labels: mipi_dbi_spi1
- st7789v-240x135@0 (READY)
  DT node labels: st7789v_240x135 lcd_panel

TF/microSD Demonstration

The following samples work with the chosen SDHC interface in 1-bit mode and connected to SPI. That is:

SDHC : &spi0 { sdhc0: sdhc@0 { compatible = "zephyr,sdhc-spi-slot"; }; };
TF/microSD : &sdhc0 { mmc { compatible = "zephyr,sdmmc-disk"; }; };

File system manipulation

Using the File Systems API ontop of the Disk Access API with chosen TF/microSD. See also Zephyr sample: File system manipulation.

west build -b waveshare_rp2040_geek/rp2040 -p -S "usb-console" -d build/waveshare_rp2040_geek zephyr/samples/subsys/fs/fs_sample
west flash -d build/waveshare_rp2040_geek
Waveshare RP2040-Geek Demo Bitmap Image

The TF/microSD card should be pre-formatted with FAT FS. If there are any files or directories present in the card, the sample lists them out on the console, e.g.:

  • (optional) Boot Sector: MBR (Master Boot Record)

  • (optional) 1st Primary Partition: W95 FAT32 (LBA) (ID: 0x0C)

  • FAT File System: FAT (32-bit version)

  • Content: img/RP2040-GEEK.bmp

Simple logging output on target

*** Booting Zephyr OS build v4.5.0…***
[00:00:00.048,000] <inf> main: Block count 31211520
Sector size 512
Memory Size(MB) 15240
Disk mounted.

Listing dir /SD: ...
[FILE] RP2040~1.BMP (size = 97254)

In case when no files could be listed, because there are none (empty FS), directory some and file some.dat will be created and list will run again to show them, e.g.:

  • (optional) Boot Sector: MBR (Master Boot Record)

  • (optional) 1st Primary Partition: W95 FAT32 (LBA) (ID: 0x0C)

  • FAT File System: FAT (32-bit version)

  • Content: NONE (empty FS)

Simple logging output on target

*** Booting Zephyr OS build v4.5.0…***
[00:00:00.048,000] <inf> main: Block count 31211520
Sector size 512
Memory Size(MB) 15240
Disk mounted.

Listing dir /SD: ...
[00:00:00.366,000] <inf> main: Creating some dir entries in /SD:

Listing dir /SD: ...
[FILE] SOME.DAT (size = 0)
[DIR ] SOME

In there is no FS (or the FS is corrupted), the disk is attempted to re-format to FAT FS and list will run again to show them, e.g.:

  • Boot Sector: NONE (empty boot sector, no partition table) – (optional) MBR (Master Boot Record)

  • 1st Primary Partition: NONE (empty partition table entry) – (optional) W95 FAT32 (LBA) (ID: 0x0C)

  • FAT File System: NONE (empty partition)

  • Content: NONE (empty FS)

Simple logging output on target

*** Booting Zephyr OS build v4.5.0…***
[00:00:00.048,000] <inf> main: Block count 31211520
Sector size 512
Memory Size(MB) 15240
Disk mounted.

Listing dir /SD: ...
[00:00:07.671,000] <inf> main: Creating some dir entries in /SD:

Listing dir /SD: ...
[FILE] SOME.DAT (size = 0)
[DIR ] SOME

Warning

In case when mount fails the device may get re-formatted to FAT FS. To disable this behaviour disable CONFIG_FS_FATFS_MOUNT_MKFS .

west build -b waveshare_rp2040_geek/rp2040 -p -S "usb-console" -d build/waveshare_rp2040_geek zephyr/samples/subsys/fs/fs_sample -- -DCONFIG_FS_FATFS_MOUNT_MKFS=n
west flash -d build/waveshare_rp2040_geek

References