Raspberry Pico: Difference between revisions

From bibbleWiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
=Introduction=
=Introduction=
==Install the micro ros agent==
<syntaxhighlight lang="bash">
sudo snap install micro-ros-agent
sudo snap set micro-ros-agent daemon=true
sudo systemctl restart snapd
</syntaxhighlight>
==Set up Environment Variables==
==Set up Environment Variables==
Here are ones I use. I believe the build system rely on PICO_SDK_PATH and PICO_TOOLCHAIN_PATH
Here are ones I use. I believe the build system rely on PICO_SDK_PATH and PICO_TOOLCHAIN_PATH
Line 36: Line 42:
cp pico_micro_ros_example.uf2 /media/$USER/RPI-RP2
cp pico_micro_ros_example.uf2 /media/$USER/RPI-RP2
</syntaxhighlight>
</syntaxhighlight>
==Install the micro ros agent==
==Next==
We can now look and see if the snap:pico slot is present with
<syntaxhighlight lang="bash">
snap interface serial-port
</syntaxhighlight>
This did not work the first time and the slots: section was missing. I ended up rebooting the PICO, copying the file.
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo snap install micro-ros-agent
name:    serial-port
sudo snap set micro-ros-agent daemon=true
summary: allows accessing a specific serial port
sudo systemctl restart snapd
plugs:
 
  - micro-ros-agent
slots:
  - snapd:pico (allows accessing a specific serial port)
</syntaxhighlight>
</syntaxhighlight>

Revision as of 02:47, 2 July 2021

Introduction

Install the micro ros agent

sudo snap install micro-ros-agent
sudo snap set micro-ros-agent daemon=true
sudo systemctl restart snapd

Set up Environment Variables

Here are ones I use. I believe the build system rely on PICO_SDK_PATH and PICO_TOOLCHAIN_PATH

# Set up base directory
export PICO_ROOT=/home/$USER/dev/pico
export PICO_SDK_PATH=$PICO_ROOT/pico-sdk
export PICO_TOOLCHAIN_PATH=$PICO_ROOT/gcc-arm-none-eabi-10-2020-q4-major/bin

Get the compiler

This is how I got started.
Unzip and get the latest compiler from https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads

I then extract it to $PICO_ROOT

Clone the SDK

Get the SDK

cd $PICO_ROOT
git clone --recurse-submodules https://github.com/raspberrypi/pico-sdk.git
git clone https://github.com/micro-ROS/micro_ros_raspberrypi_pico_sdk.git

Make the sample

It using CMake so we goto the source make a build directory and make. This should produce a file pico_micro_ros_example.uf2

cd $PICO_ROOT
cd micro_ros_raspberrypi_pico_sdk

mkdir build
cd build
cmake ..
make

Copy to device

So plug in the PICO holding down the boot button

cp pico_micro_ros_example.uf2 /media/$USER/RPI-RP2

Next

We can now look and see if the snap:pico slot is present with

snap interface serial-port

This did not work the first time and the slots: section was missing. I ended up rebooting the PICO, copying the file.

name:    serial-port
summary: allows accessing a specific serial port
plugs:
  - micro-ros-agent
slots:
  - snapd:pico (allows accessing a specific serial port)