Firmware for the CyphalPicoBase/CAN board. You can buy one here 💸.
This firmware relies on the excellent work of Earle F. Philhower, III to create an arduino integration with the Raspberry Pi Pico SDK (as opposed to the Mbed-based integration). You'll need to install this first to build. Instructions can be found in the arduino-pico documentation but the TLDR is:
arduino-cli config add board_manager.additional_urls https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
arduino-cli core update-index
arduino-cli core install rp2040:rp2040
Next you'll need to install the libraries this firmware depends on:
arduino-cli lib update-index
arduino-cli lib install 107-Arduino-Debug 107-Arduino-MCP2515 107-Arduino-UniqueId 107-Arduino-24LCxx 107-Arduino-littlefs
arduino-cli lib install 107-Arduino-Cyphal-Support 107-Arduino-Cyphal
arduino-cli lib install "Adafruit NeoPixel"
Now you should be able to build.
arduino-cli compile -b rp2040:rp2040:rpipico -v .
arduino-cli upload -b rp2040:rp2040:rpipico -v . -p /dev/ttyACM0
or
arduino-cli compile -b rp2040:rp2040:rpipico -v . --build-property compiler.cpp.extra_flags="-DCYPHAL_NODE_INFO_GIT_VERSION=0x$(git rev-parse --short=16 HEAD)"
Adding argument --build-property compiler.cpp.extra_flags="-DCYPHAL_NODE_INFO_GIT_VERSION=0x$(git rev-parse --short=16 HEAD)"
allows to feed the Git hash of the current software version to 107-Arduino-Cyphal stack from where it can be retrieved via i.e. yakut.
This repository also allows you to build using platform.io. The platformio.ini has all the details and it should "just work™".
Install and configure yakut
:
. setup_yakut.sh
Obtain value of digital input 0 using yakut
(cyphal.pub.input0.id
= 1001
):
y sub 1001:uavcan.primitive.scalar.Bit.1.0 --with-metadata
Set cyphal.node.id
to the desired value, for example 30.
y r 0 cyphal.node.id 30
Store settings to eeprom and restart controller.
y cmd 0 store
y cmd 0 restart
How to control the built-in LED on the Raspberry Pi Pico.
Set cyphal.sub.led1.id
to a value different than 65535, for example 100.
y r 30 cyphal.sub.led1.id 100
Store settings to eeprom and restart controller.
y cmd 30 store
y cmd 30 restart
Turn LED on by publishing to Subject-ID 100
y pub -N 1 100:uavcan.primitive.scalar.Bit.1.0 true
Turn LED off by publishing to Subject-ID 100
y pub -N 1 100:uavcan.primitive.scalar.Bit.1.0 false
How to control digital output 0 and digital output1 of the CyphalPicoBase-CAN.
Set cyphal.sub.output0.id
to a value different than 65535, for example 200.
y r 30 cyphal.sub.output0.id 200
Store settings to eeprom and restart controller.
y cmd 30 store
y cmd 30 restart
Turn digital output 0 on by publishing to Subject-ID 200
y pub -N 1 200:uavcan.primitive.scalar.Bit.1.0 true
Turn digital output 0 off by publishing to Subject-ID 200
y pub -N 1 200:uavcan.primitive.scalar.Bit.1.0 false
How to control the servo PWM outputs 0 and 1 of the CyphalPicoBase-CAN.
Set cyphal.sub.servo0.id
to a value different than 65535, for example 300.
y r 30 cyphal.sub.servo0.id 300
Store settings to eeprom and restart controller.
y cmd 30 store
y cmd 30 restart
Turn servo to a dedicated position by publishing to Subject-ID 300. Possible values are between 800 and 2200. Others will be dismissed.
y pub -N 1 300:uavcan.primitive.scalar.Integer16.1.0 1500
Name | Type | Default Value | Description |
---|---|---|---|
cyphal.node.description | rw | CyphalPicoBase-CAN | Node description |
cyphal.node.id | rw | 0 | Node id (max 127) |
cyphal.pub.analoginput0.id | rw | 65535 | Subject-ID (publish) for analog input 0 |
cyphal.pub.analoginput0.type | ro | cyphal.primitive.scalar.Integer16.1.0 | |
cyphal.pub.analoginput1.id | rw | 65535 | Subject-ID (publish) for analog input 1 |
cyphal.pub.analoginput1.type | ro | cyphal.primitive.scalar.Integer16.1.0 | |
cyphal.pub.input0.id | rw | 65535 | Subject-ID (publish) for digital input 0 |
cyphal.pub.input0.type | ro | cyphal.primitive.scalar.Bit.1.0 | |
cyphal.pub.input1.id | rw | 65535 | Subject-ID (publish) for digital input 1 |
cyphal.pub.input1.type | ro | cyphal.primitive.scalar.Bit.1.0 | |
cyphal.pub.input2.id | rw | 65535 | Subject-ID (publish) for digital input 2 |
cyphal.pub.input2.type | ro | cyphal.primitive.scalar.Bit.1.0 | |
cyphal.pub.input3.id | rw | 65535 | Subject-ID (publish) for digital input 3 |
cyphal.pub.input3.type | ro | cyphal.primitive.scalar.Bit.1.0 | |
cyphal.pub.inputvoltage.id | rw | 65535 | Subject-ID (publish) for input voltage |
cyphal.pub.inputvoltage.type | ro | cyphal.primitive.scalar.Real32.1.0 | |
cyphal.pub.internaltemperature.id | rw | 65535 | Subject-ID (publish) for internal temp |
cyphal.pub.internaltemperature.type | ro | cyphal.primitive.scalar.Real32.1.0 | |
cyphal.sub.led1.id | rw | 65535 | Subject-ID (subscribe) for led1 |
cyphal.sub.led1.type | ro | cyphal.primitive.scalar.Bit.1.0 | |
cyphal.sub.lightmode.id | rw | 65535 | Subject-ID (subscribe) for light mode |
cyphal.sub.lightmode.type | ro | cyphal.primitive.scalar.Integer8.1.0 | |
cyphal.sub.output0.id | rw | 65535 | Subject-ID (subscribe) for digital output 0 |
cyphal.sub.output0.type | ro | cyphal.primitive.scalar.Bit.1.0 | |
cyphal.sub.output1.id | rw | 65535 | Subject-ID (subscribe) for digital output 1 |
cyphal.sub.output1.type | ro | cyphal.primitive.scalar.Bit.1.0 | |
cyphal.sub.servo0.id | rw | 65535 | Subject-ID (subscribe) for servo PWM output 0 |
cyphal.sub.servo0.type | ro | cyphal.primitive.scalar.Integer16.1.0 | |
cyphal.sub.servo1.id | rw | 65535 | Subject-ID (subscribe) for servo PWM output 1 |
cyphal.sub.servo1.type | ro | cyphal.primitive.scalar.Integer16.1.0 | |
pico.update_period_ms.analoginput0 | rw | 500 | Update period for analog input 0 |
pico.update_period_ms.analoginput1 | rw | 500 | Update period for analog input 1 |
pico.update_period_ms.input0 | rw | 500 | Update period for digital input 0 |
pico.update_period_ms.input1 | rw | 500 | Update period for digital input 1 |
pico.update_period_ms.input2 | rw | 500 | Update period for digital input 2 |
pico.update_period_ms.input3 | rw | 500 | Update period for digital input 3 |
pico.update_period_ms.inputvoltage | rw | 3000 | Update period for input voltage |
pico.update_period_ms.internaltemperature | rw | 10000 | Update period for internal temperature |
pico.update_period_ms.light | rw | 250 | Update period for light functions |