Using a Raspberry Pico as a Logic Analyser
I’m new to the electronic engineering game, and only recently made my own PCB design for an i2c sensor. Logic Analysers have always been expensive, but in recent years, they have become cheaper and cheaper. There’s clones out there that are very cheap to get. Recently, people have started using the ~ 6 euro Raspberry Pi Pico’s for it. The pico is now supported in the open source sigrok software using pico-coder’s sigrok-pico ‘driver’. I had a little trouble getting this to work even though there is documentation for it.
Compiling the Pico’s firmware
There are many guides out there on how to place the pico firmware (the .uf2
file) onto the pico, but compiling the sigrok-pico firmware was not that straight forward. Here’s what I did:
|
|
Let’s break that down:
- Line 1&2 - Download the needed sourceode from github. You might need to download and install git for this to work.
- Line 5 - Initialize some of the submodules of the pico-sdk.
- Line 7&8 - move to the sigrok-pico sources and copy the pico-sdk import file to it.
- Line 9&10 - The sigrok-pico actually comes with a build already, so we clean that up and create a new build directory and enter it.
- Line 11 - this is where we run
cmake
to prepare for building. Please note that the-DPICO_BOARD=pico
might need to be adjusted for your specific pico board. - Line 12 - Run make to compile the firmware
You should be able to copy&paste the above without issues. You would likely have to change line 11!!
After this, you should have a pico_sdk_sigrok.uf2
that you can put onto your Pico.
Using Sigrok & Pico Pins
The support for the raspberry pico has only been added recently, so make sure you get the latest version of Sigrok. I’ve used the NIGHTLY build. I’ve used the AppImage as that’s easy to run on my Debian system.
Configure the device as following:
You’ll see D2
to D22
and A1
to A3
. This corresponds to the GPIO2 to GPIO22 pins and the 3 ADC pins that the Pico has.
It is advised that you read the AnalyzerDetails for all the information!
Also be aware that the Pico is 3.3volts and thus, what you’re analyzing must also be 3.3volt if you’re directly connecting the wires!
It’s a good idea to only show the channels that you’re intersted in. My configuration looks like this:
To perform i2c logic analysis, you can add a protocol decoder (icon next to sample rate). Click on the i2c channel label on the left hand side, and select the correct digital channels for SCL and SDA.
I’ve used a 10Mhz sample rate, and 100M samples to get a 10 second trace.
You might get SCL and SDA wrong the first time (i always do), so swap them around and try again if you don’t see a nice readout on the protocol decoder.
The above is a good example of some logic analysis on 3.3volts. You might want to go further than this. If so, do check out GusmanB’s logic analyzer on github.
Happy analyzing!