This is only a preview of the March 2025 issue of Silicon Chip. You can view 49 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "Power LCR Tester, Part 1":
Articles in this series:
Items relevant to "RF Remote Receiver":
Videos relevant to "RF Remote Receiver":
Articles in this series:
Articles in this series:
Items relevant to "Versatile Waveform Generator":
Articles in this series:
Items relevant to "Pico 2 Audio Analyser":
Items relevant to "Transitioning to the RPi Pico 2":
Purchase a printed copy of this issue for $13.00. |
transitioning to the
by tim blythman
Raspberry Pi Pico 2
This article explains what you need to do to convert software written for the Raspberry Pi Pico over
to the Pico 2. We also take a look at how to use some of its new features.
W
hile the Pico 2 contains two ARM
cores, like the original Pico, they
are not the same types (Cortex-M33
rather than Cortex M0), so a UF2 file
for the Pico will not work on the Pico
2. However, generally, code written
for the Pico can be recompiled to a
new UF2 file that will usually work
on the Pico 2 without needing further changes.
Still, there are a few things to look
out for that might trip you up in the
process. Generally, the software and
tools you use will need to be updated
to gain support for the Pico 2. Once
you do that, the transition is pretty
seamless.
Pico 2 challenges
Our review of the Pico 2 also highlighted one serious erratum in the
RP2350. According to the data sheet,
erratum RP2350-E9 applies to the A2
stepping of that processor. As far as we
know, this includes the vast majority
of RP2350 chips in circulation.
It is a fault with the internal pulldown on the GPIO pins, and it can
manifest as excessive current being
sourced when the pin’s voltage level
is between valid high and low levels.
The sourced current will oppose the
pull-down and can cause the pin to
get stuck in the invalid state.
The recommended workarounds
include not using the pull-downs or
to use an external pull-down resistor.
We are fortunate in this regard that we
have not used this feature in any of our
Pico projects, so the RP2350-E9 erratum does not affect our ability to port
any of our Pico projects to the Pico 2.
If you are using PicoMite BASIC, it
provides the option to set the pull-ups
and pull-downs from the BASIC interface. So MMBasic projects on the Pico
could run afoul of this error if they use
the pull-down feature.
Table 1 provides a brief overview of
our experience in porting our projects
to the Pico 2. Note that this doesn’t
include contributed projects or those
using the Pico W. At the time of writing, the Pico 2 W is not yet available,
although we expect it will be shortly.
As you can see, most projects simply need recompiling to work with
the new processor. So we’ll focus on
the changes that have occurred to the
individual platforms. Some of these
platforms are still under development
and might change; we also expect to
see more changes when the Pico 2 W
is released.
C SDK update
The C SDK (software development
kit) has been updated to version 2.0.0
to coincide with the release of the
Pico 2. We have also seen substantial changes to the various tools that
accompany the C SDK and these are
worth noting.
We’ve written about this in more
detail in a separate panel, which will
be of interest to those readers who wish
to set up and use the bare C SDK for
programming both the Pico and Pico 2.
Table 1 – notes on porting projects to the Pico 2
Besides the
silkscreened
label, there
aren’t many
obvious
differences
from the
original Pico.
88
Silicon Chip
Project Issue
Platform
Notes
PicoMite Jan 2022
BASIC
PicoMite 2 firmware available.
Pico BackPack Mar 2022
Multiple
PicoMite 2 firmware
available. Arduino, C SDK and
MicroPython code working
without any code changes.
VGA PicoMite Jul 2022
BASIC
PicoMite 2 firmware available.
Pico Analyser Nov 2023
Arduino
Minor code changes as noted.
Digital Video Mar and Apr
Terminal 2024
Arduino
MOD1: no code changes, set
processor speed to 250MHz.
MOD2: no code changes, set
processor speed to 120MHz.
MOD3: no code changes, set
processor speed to 120MHz.
Pico Gamer Apr 2024
BASIC
PicoMite 2 firmware available.
Pico Computer Dec 2024
Multiple
PicoMite 2 firmware available.
Arduino working without any
code changes, although some
libraries needed updating.
Australia's electronics magazine
siliconchip.com.au
Arduino support
Not long after the original Pico was
released, there was an ‘official’ Arduino board profile for the Pico. This also
supported the Arduino Nano RP2040
Connect, a WiFi-equipped RP2040
board, although that board profile is
now deprecated.
A separate project known as
‘arduino-pico’ was produced not long
after. The arduino-pico board profile
now appears to be the preferred option
for many people, and we have used
it for all our Arduino IDE-based Pico
projects.
The release notes (https://github.
com/earlephilhower/arduino-pico/
releases) indicate that version 4.0.0
was the first to support the RP2350 and
thus the Pico 2. At the time of writing,
version 4.1.1 is current and is what we
have been using for testing.
So porting an existing arduino-pico
project to use the Pico 2 should involve
little more than updating the board
profile to the most recent version,
which can be done from the Boards
Manager.
The profile defaults to a processor
speed of 150MHz for the Pico 2. You
might need to try 133MHz, as we have
done, in case anything in your code
depends on the CPU speed. You’ll see
from our notes in Table 1 that some of
our projects require other specific processor speeds to work. These and other
options are accessible from the Tools
menu of the Arduino IDE (see Screen 1).
That screen grab shows the option
to choose the Board (Pico 2) and the
CPU architecture (currently selected
as ARM), as well as the greater flash
memory capacity (4MB) and CPU
speed (150MHz). We have not come
across any ‘breaking changes’ so far.
We also found that some libraries
required an update to work with the
Pico 2. Like the arduino-pico board
profile, these typically note that the
version change is to align with the
Pico C SDK versions that support the
RP2350 and Pico 2.
For many of our Arduino-based projects, we have provided compiled versions (UF2 files) of the projects so you
can easily try them out yourself and
see that everything still works much
the same.
At the time of writing, we would say
that there is little benefit to switching
to the Pico 2 for our existing projects,
apart from the Pico 2 Analyser, for the
reasons we’ve mentioned. It is more
siliconchip.com.au
Screen 1: the arduino-pico
board profile provides all these
options under the Tools menu.
The latest versions add the
option to compile using the
RISC-V architecture, under the
CPU Architecture option.
expensive and, currently, less
widely available.
Pico BackPack users would
likely benefit from better performance if they use the BackPack
for their own custom projects.
We may consider updating some
projects to add more features or
to see if we can improve their
performance.
For example, MOD1 of the
Digital Video Terminal (which
produces the video signal) might
be able to support higher display
resolutions and colour depths.
This would potentially use the
RP2350’s new HSTX peripheral
and would definitely rely on
its larger RAM (almost double
the size).
MicroPython
With the Raspberry Pi Foundation
directly involved in MicroPython
development for the Pico 2, it is not
surprising that a very complete MicroPython port was available at around
the time of the Pico 2’s release.
We haven’t made much use of
MicroPython, but had no trouble getting the original Python code from
the Pico BackPack to run on a Pico
2 fitted to a BackPack instead of a
Pico. Of course, we needed the new
Pico 2 MicroPython firmware image
to do this.
For the software downloads, we
have created a firmware image (UF2
file) containing a working copy of
MicroPython and the BackPack demo.
It can be loaded onto a Pico 2 fitted to
a Pico BackPack. More information
on MicroPython for the Pico 2 can
be found at: https://micropython.org/
download/RPI_PICO2/
PicoMite BASIC
We previously noted that development of PicoMite firmware for RP2350based boards (such as the Pico 2) was
being documented on The Back Shed
Forum (https://thebackshed.com/
forum/ViewTopic.php?TID=17173).
This has seen the PicoMite firmware stepping up to version 6.0.0
and includes features like support for
Australia's electronics magazine
HDMI-compatible video and USB host
support for devices like game pads and
keyboards, as well as versions supporting VGA.
Our February 2025 issue saw the
release of the PicoMite 2 firmware
(siliconchip.au/Article/17729) and a
jump to version 6.00.01 of the Picomite firmware. All these features are
now available on the Pico 2, as well
as many other boards which use the
RP2350 chip.
There are six Picomite firmware
variants for the Pico 2 as well as four
updated variants for the Pico. There
are also two WebMite variants, one
for the Pico W and one for the Pico 2
W. The firmware can be downloaded
from https://geoffg.net/picomite.html
Other changes
Another interesting feature to note
is the update of the “flash_nuke.uf2”
file, which completely erases the flash
memory of a Pico or Pico 2. There is
now a ‘unified’ file which works on
both boards, and presumably, other
RP2040- and RP2350-based boards.
This works because the blocks in
a UF2 file format can each contain a
processor identification code and the
processor can choose to ignore blocks
that are not intended for it.
In practical terms, the new “flash_
nuke.uf2” consists of individual UF2
March 2025 89
Using the latest C SDK (software development kit)
The C SDK consists of headers, libraries
and a build (code compilation) system,
although other software is needed for
a complete development environment.
The GitHub repository for the C SDK
can be found at https://github.com/
raspberrypi/pico-sdk
In our original review of the Pico
(December 2021 issue; siliconchip.
au/Article/15125), we noted that
the instructions for the C SDK were
firmly focused on those using a Raspberry Pi computer as their development
machine. We tried it out using a Raspberry Pi and found it very easy to use.
For setting up a development environment on Windows computers, we also
tried the Pico Setup for Windows project at https://github.com/ndabas/
pico-setup-windows
Since then, this project has been
taken over by the Raspberry Pi Foundation and further development has
appeared to cease. Pico Setup for Windows, as the name suggests, was only
intended for use with Windows operating systems.
It included the cross-platform Visual
Studio Code IDE (integrated development environment), also known as VS
Code, as well as compilers and other
tools. The C SDK has now been made
available as an extension for VS Code
and now works on Windows, Linux and
macOS, so it provides broad, uniform
support.
This means that setting up the C SDK
on just about any computer now involves
installing VS Code and then installing
the extension for the Pico C SDK. Once
installed, the extension can create projects, then compile and upload them to
the Pico or Pico 2.
It is much more configurable,
although we wouldn’t be surprised if our
readers found the number of menus and
options excessive! It also seems that
the files associated with the extension
(and their dependencies) add up to several gigabytes.
Screen 2: the Pi Pico
extension can be installed
from this menu within
VS Code. The extension
requires downloading
many files, so it could
take a while.
Screen 3: the extension adds a new
Raspberry Pi Pico Project item to VS Code;
it can be found on the sidebar. The options
to build & run the project are found there.
Screen 4: creating a new project is much
the same as in previous versions of the
C SDK, except that it can be done from
within VS Code. Clicking the Example
button creates a new project based on
one of the included examples.
Setting it up
VS Code can be downloaded from
https://code.visualstudio.com
Interestingly, there are installer
options for ARM64 processors running Windows. Run the installer and
open VS Code.
Screen 2 shows how to install the
Extensions; the Ctrl-Shift-X shortcut
90
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
will also open this panel. Search for
“pico” and install the Raspberry Pi Pico
extension.
This will also install dependencies
such as C/C++, Python language support and a serial port monitor.
After this, you will see a new “Raspberry Pi Pico Project” item down the left
side of the VS Code window. Screen 3
shows this along with the options that
are now available. You’ll see that there
are options for both C/C++ and Python
projects.
Clicking the “New C/C++ Project” option opens the panel shown in
Screen 4. This interface is similar to
Project Generator, which was present
in older versions of the C SDK. There
is also the option to use one of the
Example programs as a template for
a new project.
There is an option to choose either
a Pico, Pico W or Pico 2 board and the
Pico 2 option allows the code to be
compiled to use the RISC-V processor.
If you haven’t worked with the C
SDK before, we suggest creating a
project from one of the examples,
such as blink. This simply flashes the
Pico 2’s onboard LED; you can modify
the delay (LED_DELAY_MS) to check
that the changes in the code are having an effect.
We also recommend that you use the
File → Save Workspace As… option. That
will allow you to easily reopen the project’s workspace for later use.
Screen 5 shows the workspace for
a blink-derived project. At left are the
files, including “Cmakelists.txt”. We
found that in some of our projects, we
have had to manually add references
here to hardware libraries (eg, hardware_pwm) in the “target_link_libraries” section for the project to compile
correctly.
Running the code
The Compile Project item in the Pico
Project Extension creates a binary file
if it succeeds. These files (including the
UF2 file for uploading) can be found in
the project’s “build” subfolder.
The Run Project button will compile and upload the binary file to a Pico
device in bootloader mode. The Terminal
in the lower half of the screen reports
the results of running these commands.
You will also find the likes of a Serial
Monitor here too.
Summary
Using VS Code presents a different
environment to what we have used for
previous versions of the C SDK. Nevertheless, it was easy to set up and use
once we became familiar with it.
files for the RP2040 and RP2350 that
are simply concatenated (joined)
together. Theoretically, this system
can be used to create UF2 binary files
that can be used with numerous processor and board types.
To tell them apart, the newer file is
around 96kB in size, while the older
file is around 25kB. The new file can be
downloaded from https://datasheets.
raspberrypi.com/soft/flash_nuke.uf2
Picotool
We have made good use of the
picotool utility for working with Pico
boards. It is a command-line program that can interact with a Pico (or
other RP2xxx boards) during debugging and development. Its repository
is at: https://github.com/raspberrypi/
picotool
In particular, it has the ability to
extract the flash memory contents
and write it to a UF2 file for distribution. This is handy for platforms
using PicoMite BASIC, allowing a
snapshot of the flash memory including saved BASIC programs, libraries
and options.
Like much of the other software,
these tools have been updated to allow
them to work with the RP2350 as well
as the RP2040. Extra commands have
been added to version 2.0.0 of picotool,
allowing access to the OTP (one-time
programming) and security features of
the newer part.
While there are instructions for
compiling picotool (and some other
software tools), this can require extra
tools to be installed. We have found
and used a separate project that provides compiled binaries at https://
github.com/raspberrypi/pico-sdktools/releases
Summary
Screen 5: a new project should be saved as a workspace to assist navigation. All the
important files are found in the left-hand pane.
siliconchip.com.au
Australia's electronics magazine
The Pico 2 appears to be better than
the Pico in almost every way and is
only slightly more expensive. As it
also corrects the ADC erratum in the
Pico, it is satisfying to be able to update
the Pico Analyser to make use of this
new part, although we don’t have any
plans to update any other projects
immediately.
We have found the transition to the
new board to be just about seamless,
and look forward to using it in future
projects. In recent news, the Pico 2 W
has been released and we expect that
using it should be similarly straightforward.
SC
March 2025 91
|