boards: arm: Add sparkfun_pro_micro_rp2040 board

Add `sparkfun_pro_micro_rp2040` board with `sparkfun,pro-micro` header.

Signed-off-by: Peter Johanson <peter@peterjohanson.com>
This commit is contained in:
Peter Johanson 2022-04-19 02:36:06 -04:00 committed by Carles Cufí
commit e8aeea6d5d
10 changed files with 377 additions and 0 deletions

View file

@ -0,0 +1,6 @@
# Copyright (c) 2021 Pete Johanson
# SPDX-License-Identifier: Apache-2.0
config BOARD_SPARKFUN_PRO_MICRO_RP2040
bool "Sparkfun Pro-Micro RP2040 Board"
depends on SOC_RP2040

View file

@ -0,0 +1,12 @@
# Copyright (c) 2021 Pete Johanson
# SPDX-License-Identifier: Apache-2.0
if BOARD_SPARKFUN_PRO_MICRO_RP2040
config BOARD
default "sparkfun_pro_micro_rp2040"
config RP2_FLASH_W25Q080
default y
endif # BOARD_SPARKFUN_PRO_MICRO_RP2040

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View file

@ -0,0 +1,125 @@
.. _sparkfun_pro_micro_rp2040:
SparkFun Pro Micro RP2040
#########################
Overview
********
The SparkFun Pro Micro RP2040 is a small, low-cost, versatile board from
SparkFun. It is equipped with an RP2040 SoC, an on-board WS2812 addressable
LED, a USB connector, and a Qwiic connector. The USB bootloader allows it
to be flashed without any adapter, in a drag-and-drop manner.
Hardware
********
- Dual core Arm Cortex-M0+ processor running up to 133MHz
- 264KB on-chip SRAM
- 16MB on-board QSPI flash with XIP capabilities
- 18 GPIO pins
- 4 Analog inputs
- 1 UART peripherals
- 1 SPI controllers
- 2 I2C controllers (one via Qwiic connector)
- 16 PWM channels
- USB 1.1 controller (host/device)
- 8 Programmable I/O (PIO) for custom peripherals
- On-board RGB LED
- 1 Watchdog timer peripheral
.. figure:: img/sparkfun_pro_micro_rp2040.jpg
:align: center
:alt: SparkFun Pro Micro RP2040
SparkFun Pro Micro RP2040 (Image courtesy of SparkFun)
Supported Features
==================
The sparkfun_pro_micro_rp2040 board configuration supports the following
hardware features:
.. list-table::
:header-rows: 1
* - Peripheral
- Kconfig option
- Devicetree compatible
* - NVIC
- N/A
- :dtcompatible:`arm,v6m-nvic`
* - UART
- :kconfig:option:`CONFIG_SERIAL`
- :dtcompatible:`raspberrypi,pico-uart`
* - GPIO
- :kconfig:option:`CONFIG_GPIO`
- :dtcompatible:`raspberrypi,pico-gpio`
* - ADC
- :kconfig:option:`CONFIG_ADC`
- :dtcompatible:`raspberrypi,pico-adc`
* - I2C
- :kconfig:option:`CONFIG_I2C`
- :dtcompatible:`snps,designware-i2c`
* - SPI
- :kconfig:option:`CONFIG_SPI`
- :dtcompatible:`raspberrypi,pico-spi`
* - USB Device
- :kconfig:option:`CONFIG_USB_DEVICE_STACK`
- :dtcompatible:`raspberrypi,pico-usbd`
* - HWINFO
- :kconfig:option:`CONFIG_HWINFO`
- N/A
* - Watchdog Timer (WDT)
- :kconfig:option:`CONFIG_WATCHDOG`
- :dtcompatible:`raspberrypi,pico-watchdog`
* - PWM
- :kconfig:option:`CONFIG_PWM`
- :dtcompatible:`raspberrypi,pico-pwm`
* - Flash
- :kconfig:option:`CONFIG_FLASH`
- :dtcompatible:`raspberrypi,pico-flash`
Pin Mapping
===========
The peripherals of the RP2040 SoC 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.
Default Zephyr Peripheral Mapping:
----------------------------------
.. rst-class:: rst-columns
- UART0_TX : P0
- UART0_RX : P1
- I2C1_SDA : P2
- I2C1_SCL : P3
- SPI0_RX : P20
- SPI0_SCK : P18
- SPI0_TX : P19
Programming and Debugging
*************************
Flashing
========
Using UF2
---------
Since it doesn't expose the SWD pins, you must flash the SparkFun Pro Micro
RP2040 with a UF2 file. By default, building an app for this board will
generate a `build/zephyr/zephyr.uf2` file. If the Pro Micro RP2040 is powered
on with the `BOOTSEL` button pressed, it will appear on the host as a mass
storage device. The UF2 file should be drag-and-dropped to the device, which
will flash the Pro Micro RP2040.
.. target-notes::
.. _Getting Started with Raspberry Pi Pico:
https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf
.. _Graphical Datasheet:
https://cdn.sparkfun.com/assets/e/2/7/6/b/ProMicroRP2040_Graphical_Datasheet.pdf

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2020 Pete Johanson
*
* SPDX-License-Identifier: MIT
*/
/ {
pro_micro: connector {
compatible = "sparkfun,pro-micro";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map
= <0 0 &gpio0 0 0> /* D0 */
, <1 0 &gpio0 1 0> /* D1 */
, <2 0 &gpio0 2 0> /* D2 */
, <3 0 &gpio0 3 0> /* D3 */
, <4 0 &gpio0 4 0> /* D4/A6 */
, <5 0 &gpio0 5 0> /* D5 */
, <6 0 &gpio0 6 0> /* D6/A7 */
, <7 0 &gpio0 7 0> /* D7 */
, <8 0 &gpio0 8 0> /* D8/A8 */
, <9 0 &gpio0 9 0> /* D9/A9 */
, <10 0 &gpio0 21 0> /* D10/A10 */
, <16 0 &gpio0 23 0> /* D16 */
, <14 0 &gpio0 20 0> /* D14 */
, <15 0 &gpio0 22 0> /* D15 */
, <18 0 &gpio0 26 0> /* D18/A0 */
, <19 0 &gpio0 27 0> /* D19/A1 */
, <20 0 &gpio0 28 0> /* D20/A2 */
, <21 0 &gpio0 29 0> /* D21/A3 */
;
};
};
pro_micro_i2c: &i2c1 {};
pro_micro_spi: &spi0 {};
pro_micro_serial: &uart0 {};

View file

@ -0,0 +1,49 @@
/*
* Copyright (c) 2021, Yonatan Schachter
* SPDX-License-Identifier: Apache-2.0
*/
#include <dt-bindings/pinctrl/rpi-pico-rp2040-pinctrl.h>
&pinctrl {
uart0_default: uart0_default {
group1 {
pinmux = <UART0_TX_P0>;
};
group2 {
pinmux = <UART0_RX_P1>;
input-enable;
};
};
i2c1_default: i2c1_default {
group1 {
pinmux = <I2C1_SDA_P2>;
input-enable;
};
group2 {
pinmux = <I2C1_SCL_P3>;
input-enable;
};
};
spi0_default: spi0_default {
group1 {
pinmux = <SPI0_TX_P19>;
};
group2 {
pinmux = <SPI0_RX_P20>;
input-enable;
};
group3 {
pinmux = <SPI0_SCK_P18>;
};
};
adc_default: adc_default {
group1 {
pinmux = <ADC_CH0_P26>, <ADC_CH1_P27>, <ADC_CH2_P28>, <ADC_CH3_P29>;
input-enable;
};
};
};

View file

@ -0,0 +1,104 @@
/*
* Copyright (c) 2021 Yonatan Schachter
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <rpi_pico/rp2040.dtsi>
#include "sparkfun_pro_micro_rp2040-pinctrl.dtsi"
#include "sparkfun_pro_micro_connector.dtsi"
#include <freq.h>
/ {
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,flash-controller = &ssi;
zephyr,console = &uart0;
zephyr,code-partition = &code_partition;
};
aliases {
watchdog0 = &wdt0;
};
xtal_clk: xtal-clk {
compatible = "fixed-clock";
clock-frequency = <12000000>;
#clock-cells = <0>;
};
};
&flash0 {
/* 16MB of flash minus the 0x100 used for
* the second stage bootloader
*/
reg = <0x10000000 DT_SIZE_M(16)>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* Reserved memory for the second stage bootloader */
second_stage_bootloader: partition@0 {
label = "second_stage_bootloader";
reg = <0x00000000 0x100>;
read-only;
};
/*
* Usable flash. Starts at 0x100, after the bootloader. The partition
* size is 16MB minus the 0x100 bytes taken by the bootloader.
*/
code_partition: partition@100 {
label = "code-partition";
reg = <0x100 (DT_SIZE_M(16) - 0x100)>;
read-only;
};
};
};
&uart0 {
current-speed = <115200>;
status = "okay";
pinctrl-0 = <&uart0_default>;
pinctrl-names = "default";
};
&i2c1 {
status = "okay";
pinctrl-0 = <&i2c1_default>;
pinctrl-names = "default";
clock-frequency = <I2C_BITRATE_FAST>;
};
&spi0 {
status = "okay";
pinctrl-0 = <&spi0_default>;
pinctrl-names = "default";
clock-frequency = <DT_FREQ_M(2)>;
};
&gpio0 {
status = "okay";
};
&wdt0 {
status = "okay";
};
&adc {
status = "okay";
pinctrl-0 = <&adc_default>;
pinctrl-names = "default";
};
zephyr_udc0: &usbd {
status = "okay";
};

View file

@ -0,0 +1,20 @@
identifier: sparkfun_pro_micro_rp2040
name: Sparkfun Pro Micro RP2040
type: mcu
arch: arm
flash: 16384
ram: 264
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- uart
- gpio
- adc
- i2c
- spi
- hwinfo
- watchdog
- pwm
- flash

View file

@ -0,0 +1,22 @@
# SPDX-License-Identifier: Apache-2.0
CONFIG_SOC_SERIES_RP2XXX=y
CONFIG_SOC_RP2040=y
CONFIG_BOARD_SPARKFUN_PRO_MICRO_RP2040=y
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=125000000
CONFIG_RESET=y
# enable uart driver
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
# enable console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
# Code partition needed to target the correct flash range
CONFIG_USE_DT_CODE_PARTITION=y
# Output UF2 by default, native bootloader supports it.
CONFIG_BUILD_OUTPUT_UF2=y