-
Notifications
You must be signed in to change notification settings - Fork 263
03 LogicAnalyzer Firmware
The firmware has been built using the standard Pico SDK and Visual Studio Code. If you want to build yourself the project and don't have the SDK installed I recommend to use the pico setup for Windows, it makes the installation a breeze and leaves everything ready to build your projects. For other OS'es there are different ways to set-up the SDK, refer to the Pico "Getting started" document.
The firmware can be built for different boards, right now you can use the Pico, Pico W (with and without WiFi) and the RP2040 Zero.
To change which one is built you need to modify two files: the build settings file and the CMakeLists file.
This file contains the defines required to choose which board will be the target of the firmware:
#define FIRMWARE_VERSION "4_5"
//Select the board type to build the firmware for
#define BUILD_PICO
//#define BUILD_PICO_W
//#define BUILD_PICO_W_WIFI
//#define BUILD_ZERO
Uncomment the define for your target board as you need.
If you wonder why anyone would like to use the W without WiFi support, it's simple, to reduce the device power usage, you may want to use it with a laptop not connected to the mains per example and in that case enabling the WiFi support will be a waste of power which will reduce the battery duration.
This file contains a definition of the project build process and indicates which libraries are included. As the W functionality is based in an external module its usage requires the inclusion of a library.
Depending if you want to use it with or without WiFi the library is a different one (even if you don't want to enable the WiFi you need to include a library as the LED of the Pico is connected through this module) and it's configured in this file.
# Configure the correct cyw library based on what this is built for
# Regular pico: empty
# Pico W without WiFi support: pico_cyw43_arch_none
# Pico W with WiFi support: pico_cyw43_arch_lwip_poll
# set (CYW_LIB pico_cyw43_arch_lwip_poll)
# set (CYW_LIB pico_cyw43_arch_none)
Uncomment the one that you need if you're using the W, if not then leave these commented.
Right now the only board with the CYW module is the Pico-W but if in the future another board adds this module you will need to enable it as explained.
The RP2040 has become a very popular microcontroller, so another manufacturers have started creating their own boards, each one with different characteristics.
To support any board the firmware has been modified with a define system that eases the task of configuring it for any of these.
The first step to define a new board is to create the define set. For that you will need to edit the board definitions file.
In there add a new #elif
with the #define
name that your board will use, and inside it add all the defines for the board:
This defines the name sent to the software
#define BOARD_NAME "PICO"
If defined the device supports complex, fast and external triggers. To support these kind of triggers two channels need to be
reserved and the first 16 channels need to be sequential.
#define SUPPORTS_COMPLEX_TRIGGER
Stablishes the channel base GPIO, this is the first GPIO that will be used as a channel.
This is not the GPIO mapped to channel 1 but the first GPIO used as an input channel.
#define INPUT_PIN_BASE 2
Complex/fast/ext trigger output pin (if enabled)
#define COMPLEX_TRIGGER_OUT_PIN 0
Complex/fast/ext trigger input pin (if enabled)
#define COMPLEX_TRIGGER_IN_PIN 1
If defined, the onboard led is a led connected to a GPIO
#define GPIO_LED
If defined, the onboard led is a led connected to a CYGW module (for the Pico W)
#define CYGW_LED
If defined, the onboard led is a RGB led connected to a GPIO
#define WS2812_LED
Defines the used GPIO used for the GPIO and WS2812 led types
#define LED_IO 25
If defined enables the Pico W WiFi module
#define USE_CYGW_WIFI
Remember that at least one LED type needs to be defined.
Once the board definition has been created you will need to add the channel mapping. Search for this:
//Pin mapping, used to map the channels to the PIO program
#if defined (BUILD_PICO)
const uint8_t pinMap[] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,26,27,28,COMPLEX_TRIGGER_IN_PIN};
#elif defined (BUILD_PICO_W)
const uint8_t pinMap[] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,26,27,28,COMPLEX_TRIGGER_IN_PIN};
#elif defined (BUILD_PICO_W_WIFI)
const uint8_t pinMap[] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,26,27,28,COMPLEX_TRIGGER_IN_PIN};
#elif defined (BUILD_ZERO)
const uint8_t pinMap[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,26,27,28,29,22,23,24,25,COMPLEX_TRIGGER_IN_PIN};
#endif
To add the mapping create a new #elif
entry with the define name you have used in the board definition. You must map all the channels, if your board does not expose enough pins just repeat one of the channels that you are already using, this prevents problems with the software, the data for the channel will be repeated without any other consequence.
Once your board has been defined you can compile the firmware enabling it like any other board.