Category Archives: How To (Pi)

How to use the RP2040’s Flash in CircuitPython apps

Here’s a very useful technique if you’re working on a CircuitPython program that you need to store data on the host microcontroller’s Flash — and to continue to be able to mount and access the device from your computer. I’ve used it with a Raspberry Pi RP2040-based board, but it should work with other CircuitPython devices too.

A typical mounted CircuitPython device: files are accessible, but the app can’t access the Flash
A typical mounted CircuitPython device: files are accessible, but the app can’t access the Flash
Continue reading

How to copy files to a Pico on a Ventura Mac error free

macOS 13.0.0 Ventura introduced an irritating problem for all us Mac-based Raspberry Pi Pico programmers: Finder no longer allows you to copy .uf2 files to a mounted Pico. It’s not a forbidden operation, but it does trigger an error that prevents the copy from taking place. This is undoubtedly the ‘new normal’, so here are some ways to circumvent the error. I’ll save the best one until last.

The macOS Ventura copy-to-Pico-in-Finder error
The macOS Ventura copy-to-Pico-in-Finder error
Continue reading

Arm Assembly on the Pi Pico: Mnemonics #2

A number of the Cortex-M0+ Thumb ops I covered last time update the core’s Program Status Register (PSR) based on the outcome of the operation. The ops that do so have an S appended to their mnemonics and they only work with the core’s ‘low’ registers, R0-7.

Continue reading

ARM Assembly on the Pi Pico: Mnemonics #1

Last time, I covered the basics of doing ARM assembly programming on the Raspberry Pi Pico’s RP2040 microcontroller. Now it’s time to get to grips with the dozens of instructions to which the RP2040’s Cortex-M0+ cores respond.

ARM assembly instructions for the Raspberry Pi Pico's RP2040 chip
Continue reading

Get Started with ARM Assembly on the Pi Pico

When I got my first microcomputer, I already knew Basic programming. My machine had a different Basic dialect from the one I’d learned at school, and there was a stack of graphics and sound functionality to get to grips with too, but it wasn’t long before I felt I’d mastered the high-level stuff and that it was time to move on to machine code. That’s how I’ve come to feel about the Raspberry Pi Pico’s RP2040 chip. The time’s right to learn ARM assembly programming on the Pico.

The Raspberry Pi RP2040 chip
Continue reading

FreeRTOS and the Pi Pico: timers

I made use of FreeRTOS’ timer functionality in the most recent post in this series, but I didn’t go into detail because the post was focused on other features. It’s time to address that deficiency. Today I’m talking about timers.

Continue reading

How to do DNS over HTTPS on a Raspberry Pi

Last year, at the recommendation of a work colleague, I grabbed one of my spare Raspberry Pi 4s and installed the DNS proxy and content blocker Pi-Hole. It’s now handling all the DNS queries on my home network. Recently, I upgraded my Pi-Hole server to make its DNS requests over HTTPS.

Continue reading

FreeRTOS and the Pi Pico: interrupts, semaphores and notifications

One of the reasons why an embedded application developer might choose to build their code on top of a real-time operating system like FreeRTOS is to emphasise the event-driven nature of the application. For “events” read data coming in on a serial link or from an I²C peripheral, or a signal to a GPIO from a sensor that a certain threshold has been exceeded. These events are typically announced by interrupting whatever job the host microcontroller is engaged upon, so interrupts are what I’ve chosen to examine next in my exploration of FreeRTOS on the Raspberry Pi RP2040 chip.

Continue reading

How to use FreeRTOS with the Raspberry Pi Pico

While documenting Twilio’s in-development Microvisor IoT platform, I’ve been working with FreeRTOS, the Amazon-owned open source real-time operating system for embedded systems. Does FreeRTOS work with the Raspberry Pi Pico’s RP2040 chip? I wondered. It turns out that it can, and this is how you set up a very basic FreeRTOS project which also serves as a demo.

The RP2040-based project uses a Pico board and an extra LED
Running the RP2040 FreeRTOS demo app
Continue reading

Pico USB serial communications with CircuitPython

My Raspberry Pi Pico-based Motorola 6809 emulator uses the RP2040’s built-in serial-over-USB functionality to receive machine code sent from a host computer. The 6809 and its support code is written in C, but can you make use of the same process under Python? Yes, you can, and here’s an easy way to do it.

Computer to display via RP2040 serial comms
Continue reading