Sign in Join
Wiki copytemporary

ARM Embedded Tutorial - FPC and the Raspberry Pi Pico

The Raspberry Pi Foundation has released the Raspberry Pi Pico, a very cheap Microcontroller board with quite interesting specs.

Introduction

Raspberry Pi Pico Specifications

To best use this tutorial you will need to buy (at least) two Raspberry Pi Pico, we will use one as a target and the second one as a debug probe. Do yourself a favour, invest $4 for a second device, being able to debug is worth so much more.

As the Pico is brand new and support for the board is a work in progress I'd recommend that you set up a dedicated installation of Lazarus and Free Pascal as you will need to use both trunk version of Lazarus and a specially patched version of FPC that includes the necessary adjustments so that FPC knows about the Pico. Also expect changes as we all learn along the way.

Setup

To install the required versions of Lazarus and Free Pascal please see here:

ARM Embedded Tutorial - Installing Lazarus and Free Pascal

PicoProbe

To prepare a PicoProbe and to setup Lazarus please follow this guide:

ARM Embedded Tutorial - Raspberry Pi Pico Setting up for Development

The Examples from Github

To access the examples together with all needed dependencies clone this repository:

https://github.com/michael-ring/pico-fpcexamples

when you find errors in the code or would like to request another demo please enter an issue on github:

https://github.com/michael-ring/pico-fpcexamples/issues

Example Programs

Now we are ready for our first Program, as practice in the embedded programming world we start with blinking the on-board LED:

Blinky

ARM Embedded Tutorial - Raspberry Pi Pico Blinking the onboard LED Not suitable for the Raspberry Pi W

Debugging

The next step in this tutorial is to set up Debugging from within Lazarus

ARM Embedded Tutorial - Raspberry Pi Pico Debugging the onboard LED

The next peripheral to join the party is the UART:

ARM Embedded Tutorial - Raspberry Pi Pico saying Hello via UART

ADC

Time to go Analog:

ARM Embedded Tutorial - Raspberry Pi Pico using the ADC

I2C

Scanning the I2C Bus for Devices:

ARM Embedded Tutorial - Raspberry Pi Pico Scanning for I2C Devices

Talking to a Display via I2C:

ARM Embedded Tutorial - Raspberry Pi Pico using Displays and I2C

SPI

Talking to a Display via SPI:

ARM Embedded Tutorial - Raspberry Pi Pico using Displays and SPI

Building a Pico Compiler

As indicated about, the most common way to get a working Pico compiler is to use fpcupdeluxe but you can, of course, build it yourself Building a Pico Compiler.

Finally

This page is WIP, I received my Boards on 29.01.2021, upgrading it as I go....


From the Free Pascal wiki, page "ARM Embedded Tutorial - FPC and the Raspberry Pi Pico", as it stood on 2024-03-08 after a change by Dbannon, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Edited on wiki.freepascal.org by 4 people, 2021–2024

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
MiRInitial Version of Raspi pico Page
MiRMiR moved page ARM Embedded Tutorial - FPC and the Raspberry Pico to ARM Embedded Tutorial - FPC and the Raspberry Pi Pico: Changed title to use official product name (minor)
MiR
MiR (minor)
TrevFix typos, page link (minor)
TrevFix my typo (minor)
MiR
MiR (minor)
MiR (minor)
FTurtleAdded template
MiR
MiR (minor)
MiR
MiR
MiR
MiR (minor)
TrevFix typo (minor)
MiR
MiR
MiR
MiR
MiR
DbannonA bit of formatting
Dbannonadded link to building page

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.