![]() |
Pico Core
|
An RP2040 Harp Core that implements the Harp Protocol to serve as the basis of a custom Harp device.
See the examples folder to get a feel for incorporating the harp core into your own project.
Additionally, here are a few examples that use the RP2040 Harp Core as a submodule in the wild:
The easiest way to use this library is to include it as submodule in your project. To see how to structure your project to incorporate the RP2040 Harp Core as a library, see the examples above–or read on.
Download (or clone) the Pico SDK to a known folder on your PC. (This folder does not need to be a sub-folder of your project.) From the Pico SDK project root folder, install the Pico SDK's dependencies with:
Next, in a sub-folder of your project, add core.pico as a submodule with:
At the top of your project's CMakeLists.txt, you will need to include and initialize the Pico SDK. You can do so with:
You must also point to the folder of the core.pico's CMakeLists.txt with
(Note that you must change path/to/cmakelist_dir
above to the actual path of this project's CMakeLists.txt.)
At the linking step, you can link against the Harp core libraries with:
Recommended, but optional: define the PICO_SDK_PATH
environment variable to point to the location where the pico-sdk was downloaded. i.e:
On Linux, it may be preferrable to put this in your .bashrc
file.
From this directory, create a directory called build, enter it, and invoke cmake with:
If you did not define the PICO_SDK_PATH
as an environment variable, you must pass it in here like so:
After this point, you can invoke the auto-generated Makefile with make
Press-and-hold the Pico's BOOTSEL button and power it up (i.e: plug it into usb). At this point you do one of the following:
Native packages exist in Bonsai for communicating with devices that speak Harp protocol. For more information on reading data or writing commands to your custom new harp device, see the Harp Tech Bonsai notes.
HarpSynchronizer
or just use the HarpCApp
as standalone entities.The Harp Core consumes the USB serial port, so printf
messages must be rerouted to an available UART port. The Pico SDK makes this step fairly straightforward. Before calling printf
you must first setup a UART port with:
To read these messages, you must connect a 3.3V FTDI Cable to the corresponding pin and connect to it with the matching baud rate.
Additionally, in your CMakeLists.txt, you must add
for each library and executable using printf
and you must link it with pico_stdlib
.
printf
messages are sprinkled throughout the Harp Core code, and they can be conditionally compiled by adding flags to your CMakeLists.txt.
To print out details of every outgoing (Device to PC) messages, add:
To print out details of every received (PC to Device) messages, add: