Cytron MOTION 2350 Pro
The RP2350 SoC [50] by Raspberry Pi Ltd. is a small sized and low-cost 32-bit dual ARM Cortex-M33 and dual 32-bit Hazard3 RISC-V (RV32IMAC+) microcontroller and predestined for versatile board designs. The Cytron MOTION 2350 board series based on this microcontroller offers a wide range build an advanced robot, minimize efforts on electronics, and focus on mechanics.
Board Overview
Hardware
The MOTION 2350 Pro [20] is a special sized RP2350 development board designed for robot applications. This board comes with two dual channel DC motor (H-bridge) driver, 8 servo motor (PWM) ports and 3 maker ports compatible with Sparkfun’s Qwiic and Adafruit’s STEMMA QT modules. By using the included conversion cables, maker ports are compatible with Seeed Studio’s Grove System [23] modules too, ready for robot or motion control projects. The DC motor driver on-board is able to control 4 brushed DC motors or 2 bipolar/unipolar stepper motor rated from 3.6V to 16V, providing up to 5A current per channel in Rev. 2.0 (3A in Rev. 1.0). The built-in quick test buttons and motor output LEDs allow functional test of the motor drivers in a quick and convenient way, without the need of writing any code. Vmotor for both DC and servo motors depends on the input voltage supplied to the board. It also has lots of LEDs useful for troubleshooting, two WS2812 Neopixel RGB LEDs, is able to make quite some noise with the on-board piezo buzzer and comes with push buttons ready to detect your touch. There are two ways to supply power to the board: via USB (5V) socket or through the VIN (3.6-16V) terminals which can also connected to a precharged multi-cell LiPo/Li-Ion battery. Power supply from all these power sources can all be controlled with the power on/off switch on-board (with MOSFET shock-proof circuit).
Features and Resources |
Printed Circuit Board |
5V/500㎃ 3.3V/300㎃ 3.6-16V/3-5A(Vmotor/Vbat) Vmotor/3.3V(OUT) 150㎒ 4㎆ 520㎅ USB-C LiPo/Fe UF2 SWD RST BOOT USER BLUE RGB PIEZO DC Motor Servo Motor 16 8 4 2 1 1
Design Data Revision 2.0
Rev. 2.0 supports overcurrent protection (5A continuous, 10A peak). On the bottom side, Rev. 2.0 has a cleaner look with fewer MOSFET driver chips, and the product name label is moved slightly upward with a clear “REV 2.0” marking. |
|
Positions
Data Sheets
Flash partitions
QSPI NOR-Flash |
code_partition |
storage_partition |
|---|---|---|
primary 2㎆ |
1㎆ |
1㎆ |
secondary N/A |
– |
– |
Pinouts
The peripherals of the RP2350 SoC [50] 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 MOTION 2350 Pro is not identical to any other standard edge connector, except the 3 Qwiic / STEMMA QT connectors (compatiple with the Grove System [23]). Note that analog channel A0 - A3 are connected to the outside, but GPIO line 29 can be used on-board as analog channel A3 for VIN/6.1 voltage monitoring.
Supported Features
Similar to the Raspberry Pi Pico 2 the 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) |
|||
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:
boards/cytron/motion_rp2350_pro/cytron_motion_2350_pro_rp2350a_hazard3_0_defconfig
boards/cytron/motion_rp2350_pro/cytron_motion_2350_pro_rp2350a_m33_0_defconfig
Board Configurations
The board can be configured for the following different use cases.
west build -b cytron_motion_2350_pro/rp2350a/hazard3_0
Use the serial port UART0 on edge header as Zephyr console and for the shell. Running on Hazard3/RISC-V core. EXPERIMENTAL
west build -b cytron_motion_2350_pro/rp2350a/hazard3_0 -S usb-console
Use the native USB device port with CDC-ACM as Zephyr console and for the shell. Running on Hazard3/RISC-V core. EXPERIMENTAL
west build -b cytron_motion_2350_pro/rp2350a/m33_0
Use the serial port UART0 on edge header as Zephyr console and for the shell. Running on Cortex-M33 core.
west build -b cytron_motion_2350_pro/rp2350a/m33_0 -S usb-console
Use the native USB device port with CDC-ACM as Zephyr console and for the shell. Running on Cortex-M33 core.
Connections and IOs
The Cytron Marktplace [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.
Laced Grove Signal Interface
The board offers the option of connecting hardware modules via a variety of
Grove connectors. These are 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
In addition to the on-board header for DC and servo motors,
there are also 3 Grove connectors (Qwiic/STEMMA QT).
This is the GPIO signal line mapping from the RP2350 SOC [50]
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: SM1 (PWM0CHA/LED) |
not wired (Servo Motor 1) |
|
GP1: SM2 (PWM0CHB/LED) |
not wired (Servo Motor 2) |
|
GP2: SM3 (PWM1CHA/LED) |
not wired (Servo Motor 3) |
|
GP3: SM4 (PWM1CHB/LED) |
not wired (Servo Motor 4) |
|
GP4: SM5 (PWM2CHA/LED) |
not wired (Servo Motor 5) |
|
GP5: SM6 (PWM2CHB/LED) |
not wired (Servo Motor 6) |
|
GP6: SM7 (PWM3CHA/LED) |
not wired (Servo Motor 7) |
|
GP7: SM8 (PWM3CHB/LED) |
not wired (Servo Motor 8) |
|
GP8: M1A (PWM4CHA/LED) |
not wired (DC Motor 1A) |
|
GP9: M1B (PWM4CHB/LED) |
not wired (DC Motor 1B) |
|
GP10: M2A (PWM5CHA/LED) |
not wired (DC Motor 2A) |
|
GP11: M2B (PWM5CHB/LED) |
not wired (DC Motor 2B) |
|
GP12: M3A (PWM6CHA/LED) |
not wired (DC Motor 3A) |
|
GP13: M3B (PWM6CHB/LED) |
not wired (DC Motor 3B) |
|
GP14: M4A (PWM7CHA/LED) |
not wired (DC Motor 4A) |
|
GP15: M4B (PWM7CHB/LED) |
not wired (DC Motor 4B) |
|
GP16: I2C-SDA (I2C0/PWM0CHA/LED) |
<&grove_d17_header 1 …>↳
<&gpio0 16 …> |
|
GP17: I2C-SCL (I2C0/PWM0CHB/LED) |
<&grove_d17_header 0 …>↳
<&gpio0 17 …> |
|
GP18: GPIO (LED) (PWM1CHA/LED) |
not wired (User LED 1) |
|
GP19: GPIO (PWM1CHB/LED) |
not wired |
|
GP20: BTN1 |
not wired (Button 1) |
|
GP21: BTN2 |
not wired (Button 2) |
|
GP22: BUZZER (PWM3CHA) |
not wired (Buzzer) |
|
GP23: WS2812 |
not wired (RGB LED) |
|
GP24 (PIO_TUHC_DP) |
not wired (PIO/Tiny USB Host D+) |
|
GP25 (PIO_TUHC_DM) |
not wired (PIO/Tiny USB Host D-) |
|
GP26: ADC0/DIO26 (ADC/PWM5CHA/LED) |
<&grove_d27_header 1 …>↳
<&gpio0 26 …> |
|
GP27: ADC1/DIO27 (ADC/PWM5CHB/LED) |
<&grove_d27_header 0 …>↳
<&gpio0 27 …> |
|
GP28: UART-TX (UART0/PWM6CHA/LED) |
<&grove_d29_header 1 …>↳
<&gpio0 28 …> |
|
GP29: UART-RX (UART0/PWM6CHB/LED) |
<&grove_d29_header 0 …>↳
<&gpio0 29 …>
(ADC3 @ VIN/6.1) |
|
||
|
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 cytron_motion_2350_pro/rp2350a/hazard3_0
and cytron_motion_2350_pro/rp2350a/m33_0, 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: SM1 |
not wired (PWM0CHA) |
|
|
GP1: SM2 |
not wired (PWM0CHB) |
|
|
GP2: SM3 |
not wired (PWM1CHA) |
|
|
GP3: SM4 |
not wired (PWM1CHB) |
|
|
GP4: SM5 |
not wired (PWM2CHA) |
|
|
GP5: SM6 |
not wired (PWM2CHB) |
|
|
GP6: SM7 |
not wired (PWM3CHA) |
|
|
GP7: SM8 |
not wired (PWM3CHB) |
|
|
GP8: M1A |
not wired (PWM4CHA) |
|
|
GP9: M1B |
not wired (PWM4CHB) |
|
|
GP10: M2A |
not wired (PWM5CHA) |
|
|
GP11: M2B |
not wired (PWM5CHB) |
|
|
GP12: M3A |
not wired (PWM6CHA) |
|
|
GP13: M3B |
not wired (PWM6CHB) |
|
|
GP14: M4A |
not wired (PWM7CHA) |
|
|
GP15: M4B |
not wired (PWM7CHB) |
|
|
|
GP16: I2C-SDA |
|
|
|
GP17: I2C-SCL |
|
|
GP18: GPIO (LED) |
not wired (PWM1CHA) |
|
|
GP19: GPIO |
not wired (PWM1CHB) |
|
|
GP20: BTN1 |
not wired (PWM2CHA) |
|
|
GP21: BTN2 |
not wired (PWM2CHB) |
|
|
GP22: BUZZER |
not wired (PWM3CHA) |
|
|
GP23: WS2812 |
not wired (PWM3CHB) |
|
|
GP24 (PIO_TUHC_DP) |
not wired (PWM4CHA) |
|
|
GP25 (PIO_TUHC_DM) |
not wired (PWM4CHB) |
|
|
|
GP26: ADC0 |
|
|
|
GP27: ADC1 |
|
|
|
GP28: UART-TX |
|
|
|
GP29: UART-RX |
|
|
|||
|
System Clock
The RP2350A [50] MCU is configured to use the 12㎒ external crystal with the on-chip PLL generating the 150㎒ system clock. The internal AHB and APB units are set up in the same way as the upstream Raspberry Pi Pico C/C++ SDK [14] libraries.
GPIO (PWM) Ports
The RP2350A [50] 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 channels PWM0 A to PWM3 B are reserved for driving eight servo motors and also PWM4 A to PWM5 B for the two on-board DC motor H-bridge drivers. In parallel the cannel PWM3 A will be used for the on-board Piezo buzzer.
ADC/TS Ports
The RP2350A [50] 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 GPIO breakout header and on two of the Qwiic / STEMMA QT compatiple connectors. But this is not the default pin operation. Only the ADC channel 0-2 are available, ADC channel 3 can be used optional for internal on-board voltage monitoring.
The external voltage reference ADC_VREF is directly connected to the 3.3V power supply.
SPI Port
The RP2350A [50] MCU has 2 SPIs. The serial bus SPI1 is connect to external devices over GP27 (MOSI), GP28 (MISO), GP26 (SCK), and GP29 (CSn) on one of the Qwiic / STEMMA QT compatiple connectors or over the GPIO breakout header. SPI0 is not available in any default setup.
I2C Port
The RP2350A [50] MCU has 2 I2Cs. The serial bus I2C0 and I2C1 are connect to external devices over GP16 (I2C0_SDA), GP17 (I2C0_SCL), GP26 (I2C1_SDA), and GP27 (I2C1_SCL) on two of the Qwiic / STEMMA QT compatiple connectors or over the GPIO breakout header.
Serial Port
The RP2350A [50] MCU has 2 UARTs. One of the UARTs (UART0) is connected to external devices over GP28 (TX) and GP29 (RX) on one of the Qwiic / STEMMA QT compatiple connectors or over the GPIO breakout header and is the Zephyr console.
USB Device Port
The RP2350A [50] 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: MOTION 2350 Pro (CDC ACM) Manufacturer: Cytron (Raspberry Pi) SerialNumber: BFBD7FBB52DD7E1B
To integrate specific USB device functions that do not follow a USB standard class, the following alternate identifier numbers are available for the various Cytron RP2040 and RP2350 boards according to the Raspberry Pi USB product ID list [12]:
RP2040
0x1000:0x100F:0x1071:Maker UNO RP2040
0x1074:EDU PICO
0x107E:EDU PICO
0x1093:IRIV IO Controller
0x109C:SUMO:BIT Expansion Board
RP2350
0x1096:
Programmable I/O (PIO)
The RP2350 SoC [50] comes with three 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 [14] 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
Using UF2
If you don’t have an SWD adapter, you can flash the board with a UF2 file.
By default, building an application for this 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=000f, bcdDevice= 1.00 USB device strings: Mfr=1, Product=2, SerialNumber=0 Product: RP2350 Boot Manufacturer: Raspberry Pi SerialNumber: 7FBB52DD7E1B
The UF2 file should be drag-and-dropped or copied on command line to the device, which will then flash the board.
RP2350 Boot-ROM
Each RP2350 SoC [50] ships the UF2 compatible [6] bootloader pico-bootrom-rp2350 [15], a native support in silicon. The full source for the RP2040 bootrom at pico-bootrom-rp2350 [15] includes versions A2, A3 and A4 of the bootrom, which correspond to the same silicon revisions, respectively.
Note that every time you build a program for the RP2350, the Pico SDK selects and creates an appropriate image definition and/or partition table block with attributes and precedes it in the firmware. Further information can be found in the RP2350 Datasheet [51], sections with title “Bootrom” and “Processor Controlled Boot Sequence”.
Using SEGGER JLink
You can flash the board with a SEGGER JLink debug probe as described in Building, Flashing and Debugging.
Here is an example of building and flashing the Blinky application:
west build -b cytron_motion_2350_pro/rp2350a/m33_0 -p -d build/cytron_motion_2350_pro zephyr/samples/basic/blinky west flash -r jlink -d build/cytron_motion_2350_pro
Using OpenOCD
To use PicoProbe [16] or Raspberry Pi Debug Probe [17], you must configure
udev. Create a file in /etc/udev.rules.d with any name,
and write the line below:
ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="0004", MODE="660", GROUP="plugdev", TAG+="uaccess" ATTRS{idVendor}=="2e8a", ATTRS{idProduct}=="000c", MODE="660", GROUP="plugdev", TAG+="uaccess"
This example is valid for the case that the user joins to plugdev
groups.
The board has an SWD interface that can be used to program and debug the on-board RP2350. This interface can be utilized by OpenOCD. To use it with the RP2350, OpenOCD version 0.12.0 or later is needed. If you are using a Debian based system (including RaspberryPi OS, Ubuntu, and more), using the pico_setup.sh [18] script is a convenient way to set up the forked version of OpenOCD. Depending on the interface used (such as JLink), you might need to checkout to a branch that supports this interface, before proceeding. Build and install OpenOCD as described in the README.
Here is an example of building and flashing the Blinky application:
west build -b cytron_motion_2350_pro/rp2350a/m33_0 -p -d build/cytron_motion_2350_pro zephyr/samples/basic/blinky -- \ -DOPENOCD=/usr/local/bin/openocd \ -DOPENOCD_DEFAULT_PATH=/usr/local/share/openocd/scripts \ -DCYTRON_RP2350_DEBUG_ADAPTER=picoprobe west flash -r openocd -d build/cytron_motion_2350_pro
Set the environment variables OPENOCD to
/usr/local/bin/openocd and OPENOCD_DEFAULT_PATH to
/usr/local/share/openocd/scripts. This should work with the OpenOCD
that was installed with the default configuration. This configuration also
works with an environment that is set up by the pico_setup.sh [18] script.
CYTRON_RP2350_DEBUG_ADAPTER specifies what debug adapter is
used for debugging. If CYTRON_RP2350_DEBUG_ADAPTER was not
assigned, cmsis-dap is used by default. The other supported adapters
are picoprobe, raspberrypi-swd, jlink and
blackmagicprobe. How to connect picoprobe and
raspberrypi-swd is described in Getting Started Guide with Raspberry
Pi Pico [13]. Any other SWD debug adapter maybe also work with this configuration.
The value of CYTRON_RP2350_DEBUG_ADAPTER is cached, so it can
be omitted from west flash and west debug if it was
previously set while running west build.
CYTRON_RP2350_DEBUG_ADAPTER is used in an argument to OpenOCD as
"source [find interface/${CYTRON_RP2350_DEBUG_ADAPTER}.cfg]". Thus,
CYTRON_RP2350_DEBUG_ADAPTER needs to be assigned the file name of
the debug adapter.
You can also flash the board with the following command that directly calls OpenOCD (assuming a SEGGER JLink adapter is used):
$ openocd -f interface/jlink.cfg \
-c 'transport select swd' \
-f target/rp2350.cfg \
-c "adapter speed 2000" \
-c 'targets rp2350.core0' \
-c 'program path/to/zephyr.elf verify reset exit'
Debugging
The SWD interface can also be used to debug the board. To achieve this, you can either use SEGGER JLink or OpenOCD.
Using SEGGER JLink
Use a SEGGER JLink debug probe and follow the instruction in Building, Flashing and Debugging.
Using OpenOCD
Install OpenOCD as described for flashing the board.
Here is an example for debugging the Blinky application:
west build -b cytron_motion_2350_pro/rp2350a/m33_0 -p -d build/cytron_motion_2350_pro zephyr/samples/basic/blinky -- \ -DOPENOCD=/usr/local/bin/openocd \ -DOPENOCD_DEFAULT_PATH=/usr/local/share/openocd/scripts \ -DCYTRON_RP2350_DEBUG_ADAPTER=raspberrypi-swd west debug -d build/cytron_motion_2350_pro
As with flashing, you can specify the debug adapter by specifying CYTRON_RP2350_DEBUG_ADAPTER at west build time. No needs to specify it at west debug time.
You can also debug with OpenOCD and gdb launching from command-line. Run the following command:
$ openocd -f interface/jlink.cfg \
-c 'transport select swd' \
-f target/rp2350.cfg \
-c "adapter speed 2000" \
-c 'targets rp2350.core0'
On another terminal, run:
$ gdb-multiarch
Inside gdb, run:
(gdb) tar ext :3333
(gdb) file path/to/zephyr.elf
You can then start debugging the board.
Basic Samples
LED Blinky and Fade
Blue User LED Blinky by GPIO
See also Zephyr sample: Blinky.
On Hazard3 RISC-V (RV32IMAC+)
west build -b cytron_motion_2350_pro/rp2350a/hazard3_0 -p -d build/cytron_motion_2350_pro zephyr/samples/basic/blinky west flash -d build/cytron_motion_2350_proOn ARM Cortex-M33
west build -b cytron_motion_2350_pro/rp2350a/m33_0 -p -d build/cytron_motion_2350_pro zephyr/samples/basic/blinky west flash -d build/cytron_motion_2350_pro
Blue User LED Blinky by PWM
See also Zephyr sample: PWM Blinky.
On Hazard3 RISC-V (RV32IMAC+)
west build -b cytron_motion_2350_pro/rp2350a/hazard3_0 -p -d build/cytron_motion_2350_pro zephyr/samples/basic/blinky_pwm west flash -d build/cytron_motion_2350_proOn ARM Cortex-M33
west build -b cytron_motion_2350_pro/rp2350a/m33_0 -p -d build/cytron_motion_2350_pro zephyr/samples/basic/blinky_pwm west flash -d build/cytron_motion_2350_pro
Blue User LED Fade by PWM
See also Zephyr sample: Fade LED.
On Hazard3 RISC-V (RV32IMAC+)
west build -b cytron_motion_2350_pro/rp2350a/hazard3_0 -p -d build/cytron_motion_2350_pro zephyr/samples/basic/fade_led west flash -d build/cytron_motion_2350_proOn ARM Cortex-M33
west build -b cytron_motion_2350_pro/rp2350a/m33_0 -p -d build/cytron_motion_2350_pro zephyr/samples/basic/fade_led west flash -d build/cytron_motion_2350_pro
Blue User LED On/Off by GPIO Button
See also Zephyr sample: Button.
On Hazard3 RISC-V (RV32IMAC+)
west build -b cytron_motion_2350_pro/rp2350a/hazard3_0 -p -d build/cytron_motion_2350_pro zephyr/samples/basic/button west flash -d build/cytron_motion_2350_proOn ARM Cortex-M33
west build -b cytron_motion_2350_pro/rp2350a/m33_0 -p -d build/cytron_motion_2350_pro zephyr/samples/basic/button west flash -d build/cytron_motion_2350_pro
WS2812 LED Test Pattern by SPI
See also Zephyr sample: LED strip.
On Hazard3 RISC-V (RV32IMAC+)
west build -b cytron_motion_2350_pro/rp2350a/hazard3_0 -p -d build/cytron_motion_2350_pro zephyr/samples/drivers/led/led_strip -- -DCONFIG_SAMPLE_LED_UPDATE_DELAY=500 west flash -d build/cytron_motion_2350_proOn ARM Cortex-M33
west build -b cytron_motion_2350_pro/rp2350a/m33_0 -p -d build/cytron_motion_2350_pro zephyr/samples/drivers/led/led_strip -- -DCONFIG_SAMPLE_LED_UPDATE_DELAY=500 west flash -d build/cytron_motion_2350_pro
Hello Shell with USB-CDC/ACM Console
Hello Shell
See also Bridle sample: Hello Shell.
On Hazard3 RISC-V (RV32IMAC+)
west build -b cytron_motion_2350_pro/rp2350a/hazard3_0 -p -S "usb-console" -d build/cytron_motion_2350_pro bridle/samples/helloshell west flash -d build/cytron_motion_2350_proOn ARM Cortex-M33
west build -b cytron_motion_2350_pro/rp2350a/m33_0 -p -S "usb-console" -d build/cytron_motion_2350_pro bridle/samples/helloshell west flash -d build/cytron_motion_2350_pro
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: 0xbfbd7fbb52dd7e1b
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
On Hazard3 RISC-V (RV32IMAC+)
uart:~$ device list
devices:
- clock-controller@40010000 (READY)
DT node labels: clocks
- reset-controller@40020000 (READY)
DT node labels: reset
- interrupt-controller (READY)
DT node labels: intc
- snippet_cdc_acm_console_uart (READY)
DT node labels: snippet_cdc_acm_console_uart
- timer@400b8000 (READY)
DT node labels: timer1
- timer@400b0000 (READY)
DT node labels: timer0
- uart@40070000 (READY)
DT node labels: uart0 grove_serial
- watchdog@400d8000 (READY)
DT node labels: wdt0
- dma@50000000 (READY)
DT node labels: dma
- gpio-port@0 (READY)
DT node labels: gpio0 gpio0_lo
- usbd@50110000 (READY)
DT node labels: usbd zephyr_udc0
- adc@400a0000 (READY)
DT node labels: adc
- flash-controller@400d0000 (READY)
DT node labels: qmi
- i2c@40090000 (READY)
DT node labels: i2c0 zephyr_i2c stemma_i2c qwiic_i2c grove_i2c
- pwm@400a8000 (READY)
DT node labels: pwm grove_pwm_d16 grove_pwm_d17 grove_pwm_d26 grove_pwm_d27 grove_pwm_d28 grove_pwm_d29
- vreg@40100000 (READY)
DT node labels: vreg
- spi@40080000 (READY)
DT node labels: spi0
- pwm-leds (READY)
DT node labels: pwm_leds
- ws2812@0 (READY)
DT node labels: ws2812 led_strip
- dietemp (READY)
DT node labels: die_temp
On ARM Cortex-M33
uart:~$ device list
devices:
- clock-controller@40010000 (READY)
DT node labels: clocks
- reset-controller@40020000 (READY)
DT node labels: reset
- snippet_cdc_acm_console_uart (READY)
DT node labels: snippet_cdc_acm_console_uart
- timer@400b8000 (READY)
DT node labels: timer1
- timer@400b0000 (READY)
DT node labels: timer0
- uart@40070000 (READY)
DT node labels: uart0 grove_serial
- watchdog@400d8000 (READY)
DT node labels: wdt0
- dma@50000000 (READY)
DT node labels: dma
- gpio-port@0 (READY)
DT node labels: gpio0 gpio0_lo
- usbd@50110000 (READY)
DT node labels: usbd zephyr_udc0
- adc@400a0000 (READY)
DT node labels: adc
- flash-controller@400d0000 (READY)
DT node labels: qmi
- i2c@40090000 (READY)
DT node labels: i2c0 zephyr_i2c stemma_i2c qwiic_i2c grove_i2c
- pwm@400a8000 (READY)
DT node labels: pwm grove_pwm_d16 grove_pwm_d17 grove_pwm_d26 grove_pwm_d27 grove_pwm_d28 grove_pwm_d29
- vreg@40100000 (READY)
DT node labels: vreg
- spi@40080000 (READY)
DT node labels: spi0
- pwm-leds (READY)
DT node labels: pwm_leds
- ws2812@0 (READY)
DT node labels: ws2812 led_strip
- 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
Operate with the on-chip voltage regulator unit:
uart:~$ regulator vlist vreg
0.550000 V
0.600000 V
0.650000 V
0.700000 V
0.750000 V
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 V
1.350000 V
1.400000 V
1.500000 V
1.600000 V
1.650000 V
1.700000 V
1.800000 V
1.900000 V
2.000000 V
2.350000 V
2.500000 V
2.650000 V
2.800000 V
3.000000 V
3.150000 V
3.300000 V
uart:~$ regulator vget vreg
1.100000 V
Operate with the RGB digital LED strip 2 RGB at SPI0_TX:
uart:~$ led_strip get_length led_strip
ws2812@0 has 2 pixel(s)
Sett all LEDs to RED:
uart:~$ led_strip fill led_strip 070000 2
Sett all LEDs to YELLOW:
uart:~$ led_strip fill led_strip 070700 2
Sett all LEDs to GREEN:
uart:~$ led_strip fill led_strip 000700 2
Sett all LEDs to CYAN:
uart:~$ led_strip fill led_strip 000707 2
Sett all LEDs to BLUE:
uart:~$ led_strip fill led_strip 000007 2
Sett all LEDs to MAGENTA:
uart:~$ led_strip fill led_strip 070007 2
Sett all LEDs to WHITE (all on):
uart:~$ led_strip fill led_strip 070707 2
Sett all LEDs to BLACK (all off):
uart:~$ led_strip fill led_strip 000000 2
Note
PWM LED conflicts with GPIO!
Operations with the blue user LED in PWM mode will fail when ever the corresponding GPIO line 18 was configured as digital output. This condition is irreversible at runtime within the shell and requires a system reset.
Operate with the blue user LED PWM_LED at GP18 / PWM2 (PWM2CHA):
uart:~$ led on pwm-leds 0
pwm-leds: turning on LED 0
uart:~$ led set_brightness pwm-leds 0 10
pwm-leds: setting LED 0 brightness to 10
uart:~$ led set_brightness pwm-leds 0 50
pwm-leds: setting LED 0 brightness to 50
uart:~$ led set_brightness pwm-leds 0 100
pwm-leds: setting LED 0 brightness to 100
uart:~$ led off pwm-leds 0
pwm-leds: turning off LED 0
uart:~$ led blink pwm-leds 0 50 50
pwm-leds: blinking LED 0 with 50 ms on and 50 ms off
uart:~$ led off pwm-leds 0
pwm-leds: turning off LED 0
Note
PWM conflicts with GPIO!
Operations with the blue user LED in PWM mode will fail when ever the corresponding GPIO line 18 was configured as digital output. This condition is irreversible at runtime within the shell and requires a system reset.
Operate with the blue user LED PWM_LED at GP18 / PWM2 (PWM2CHA):
uart:~$ pwm usec pwm 2 20000 20000
uart:~$ pwm usec pwm 2 20000 19000
uart:~$ pwm usec pwm 2 20000 18000
uart:~$ pwm usec pwm 2 20000 17000
uart:~$ pwm usec pwm 2 20000 16000
uart:~$ pwm usec pwm 2 20000 15000
uart:~$ pwm usec pwm 2 20000 10000
uart:~$ pwm usec pwm 2 20000 5000
uart:~$ pwm usec pwm 2 20000 2500
uart:~$ pwm usec pwm 2 20000 500
uart:~$ pwm usec pwm 2 20000 0
Operate with the PIEZO buzzer at GP22 / PWM6 (PWM3CHA):
concert pitch: 440 ㎐
Piezo middle frequency: 1,000 ㎑
Piezo resonance: 2,730 ㎑
Piezo high frequency: 10,000 ㎑
higher frequencies: 11 ㎑, 12 ㎑, 13 ㎑, 14 ㎑, 15 ㎑
uart:~$ pwm usec pwm 6 2273 1136
uart:~$ pwm usec pwm 6 2000 1000
uart:~$ pwm usec pwm 6 366 183
uart:~$ pwm usec pwm 6 100 50
uart:~$ pwm usec pwm 6 90 45
uart:~$ pwm usec pwm 6 83 41
uart:~$ pwm usec pwm 6 77 39
uart:~$ pwm usec pwm 6 71 36
uart:~$ pwm usec pwm 6 66 33
Operate with the SERVO motor (≈11 ㎳/° duty cycle, 50 ㎐ period) at GP0 / PWM0 (PWM0CHA):
on 0.500 ㎳ ≲ -90°
on 1.500 ㎳ ≅ 0°
on 2.500 ㎳ ≳ +90°
uart:~$ pwm usec pwm 0 20000 500
uart:~$ pwm usec pwm 0 20000 1500
uart:~$ pwm usec pwm 0 20000 2500
Operate with the blue user LED LED at GP18:
uart:~$ gpio get gpio0 GBH3_ULED0
0
uart:~$ gpio conf gpio0 GBH3_ULED0 oh0
uart:~$ gpio set gpio0 GBH3_ULED0 1
uart:~$ gpio set gpio0 GBH3_ULED0 0
uart:~$ gpio blink gpio0 GBH3_ULED0
Hit any key to exit
Operate with the user button BTN1 at GP20:
uart:~$ gpio get gpio0 UBTN0
0
uart:~$ gpio conf gpio0 UBTN0 il
uart:~$ gpio get gpio0 UBTN0
0
uart:~$ gpio get gpio0 UBTN0
1
uart:~$ gpio get gpio0 UBTN0
0
Get an overview of aviliable signale names:
uart:~$ gpio info gpio0
ngpios: 30
Reserved pin mask: 0xC3800000
Reserved Pin Line Name
0 SRVM1_PWM0
1 SRVM2_PWM1
2 SRVM3_PWM2
3 SRVM4_PWM3
4 SRVM5_PWM4
5 SRVM6_PWM5
6 SRVM7_PWM6
7 SRVM8_PWM7
8 DCM1A_PWM8
9 DCM1B_PWM9
10 DCM2A_PWM10
11 DCM2B_PWM11
12 DCM3A_PWM12
13 DCM3B_PWM13
14 DCM4A_PWM14
15 DCM4B_PWM15
16 GBH1Q02_SDA0
17 GBH2Q01_SCL0
18 GBH3_ULED0
19 GBH4
20 UBTN0
21 UBTN1
22 BUZZER
* 23
* 24
* 25
26 GBH5Q12_ADC0
27 GBH6Q11_ADC1
28 GBH7Q22_TX0
29 GBH8Q21_RX0
Operate with the channels:
ADC_CH0, pulled up to 3V3
ADC_CH1, pulled down to GND
ADC_CH3, on-board VIN/6.1 voltage monitoring (optional, when solder bridge was closed)
on-chip temperature sensor on channel ADC_CH4
uart:~$ adc adc@400a0000 resolution 12
uart:~$ adc adc@400a0000 print
adc@400a0000:
Gain: 1
Reference: INTERNAL
Acquisition Time: 0
Channel ID: 0
Differential: 0
Resolution: 12
uart:~$ adc adc@400a0000 read 0
read: 4095
uart:~$ adc adc@400a0000 read 1
read: 4
uart:~$ adc adc@400a0000 read 3
read: 2984
uart:~$ adc adc@400a0000 read 4
read: 864
Operate with the tow on-chip timer units:
uart:~$ timer oneshot timer0 0 1000000
timer0: Alarm triggered
uart:~$ timer oneshot timer1 0 1000000
timer1: Alarm triggered
Erase, Write and Verify
uart:~$ flash read qmi 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 qmi 0xe0000 0x1000 2
Erase OK.
Write OK.
Verified OK.
Erase OK.
Write OK.
Verified OK.
Erase-Write-Verify test done.
uart:~$ flash read qmi 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 e0000
Page for address 0xe0000:
start offset: 0xe0000
size: 4096
index: 224
uart:~$ flash erase qmi 0xe0000 0x1000
Erase success.
uart:~$ flash read qmi 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 |........ ........|
The MOTION 2350 Pro has no on-board I2C devices. For this example the Grove Temperature and Barometer Sensor – BMP280 [28] was connected to I2C0.
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_i2c
The I2C address 0x77 is a Bosch BMP280 Air Pressure Sensor and their
Chip-ID can read from register 0xd0. The Chip-ID must be 0x58:
uart:~$ i2c read_byte zephyr_i2c 77 d0
Output: 0x58
uart:~$ sensor info
device name: dietemp, vendor: Raspberry Pi Foundation, model: pico-temp, friendly name: RP2350 chip temperature
on-chip temperature sensor
uart:~$ sensor get dietemp
channel type=12(die_temp) index=0 shift=5 num_samples=1 value=14655375226ns (29.324229)
More Samples
Input dump with USB-CDC/ACM Console
Prints all input events as defined by the shields Devicetree. See also Zephyr sample: Input dump.
Print the input events related to the two on-board user button using the Input subsystem API. That are:
zephyr,code = <INPUT_KEY_0>;zephyr,code = <INPUT_KEY_1>;Devicetree compatible
zephyr,lvgl-keypad-inputwith devicetree relationlvgl_keypad: lvgl-keypad { input = <&gpio_keys>; };BTN1 :input-codes = <INPUT_KEY_0>;:lvgl-codes = <LV_KEY_ENTER>;BTN2 :input-codes = <INPUT_KEY_1>;:lvgl-codes = <LV_KEY_NEXT>;
Button Input Dump
See also Zephyr sample: Input dump.
On Hazard3 RISC-V (RV32IMAC+)
west build -b cytron_motion_2350_pro/rp2350a/hazard3_0 -p -S "usb-console" -d build/cytron_motion_2350_pro zephyr/samples/subsys/input/input_dump west flash -d build/cytron_motion_2350_proOn ARM Cortex-M33
west build -b cytron_motion_2350_pro/rp2350a/m33_0 -p -S "usb-console" -d build/cytron_motion_2350_pro zephyr/samples/subsys/input/input_dump west flash -d build/cytron_motion_2350_pro
Simple logging output on target
Sounds from the speaker with USB-CDC/ACM Console
Piezo Buzzer Test
The sample is prepared for the on-board PWM_BUZZER connected to the PWM channel at GP22 / PWM6 (PWM3CHA).
The PWM period is 880 ㎐, twice the concert pitch frequency of 440 ㎐.
Invoke west build and west flash:
On Hazard3 RISC-V (RV32IMAC+)
west build -b cytron_motion_2350_pro/rp2350a/hazard3_0 -p -S "usb-console" -d build/cytron_motion_2350_pro bridle/samples/buzzer west flash -d build/cytron_motion_2350_proOn ARM Cortex-M33
west build -b cytron_motion_2350_pro/rp2350a/m33_0 -p -S "usb-console" -d build/cytron_motion_2350_pro bridle/samples/buzzer west flash -d build/cytron_motion_2350_pro
Simple test execution on target
play a beep
play a folk song
play a chrismas song
uart:~$ buzzer beep
uart:~$ buzzer play folksong
uart:~$ buzzer play xmastime
Drive a motor with USB-CDC/ACM Console
Servomotor Test
The sample is prepared for servomotor PWM_SERVO_0 at first on-board channel at GP0 / PWM0 (PWM0CHA).
Connect a servomotor MG996R to the first on-board PWM channel for servomotors, the 8×3 pin header block at position 17. See the board positions diagram for details.
The corresponding PWM pulse widths for a range of -90° to +90° (180°) are 500 ㎲ to 2,500 ㎲ with a period of 50 ㎐. All these servomotor specific parameters are preset by the snippet PWM Servomotor Preset Snippet (pwm-servo) that have to use to get access to this dedicated PWM channel together with the original Zephyr Servomotor sample. Invoke west build and west flash with this snipped and optional mixed with others, for example:
On Hazard3 RISC-V (RV32IMAC+)
west build -b cytron_motion_2350_pro/rp2350a/hazard3_0 -p always -S "usb-console pwm-servo" -d build/cytron_motion_rp2350_pro zephyr/samples/basic/servo_motor west flash -d build/cytron_motion_rp2350_proOn ARM Cortex-M33
west build -b cytron_motion_2350_pro/rp2350a/m33_0 -p always -S "usb-console pwm-servo" -d build/cytron_motion_rp2350_pro zephyr/samples/basic/servo_motor west flash -d build/cytron_motion_rp2350_pro