A Pi Pico soldered onto a custom breakout PCB, with an SD card connected to it using prototyping wires

RP2040 Runs Linux Through RISC-V Emulation

We’re used to running Linux on CPUs where it belongs, and the consensus is that RP2040 just isn’t up for the task – no memory controller, and nowhere near enough RAM, to boot. At least, that’s what you might believe until you see [tvlad1234]’s Linux-on-RP2040 project, reminding us there’s more than one way to boot Linux on a CPU like this! Just like with the “Linux on AVR” project in 2012 that emulated an ARM processor, the pico-rv32ima project emulates a RISC-V core – keeping up with the times.

Initially, the aforementioned “Linux on AVR through ARM” project was picked as a base – then, a newer development, [cnlohr]’s RISC-V emulator, presented itself and was too good to pass up on. Lack of RAM was fully negated by adding an SD card into the equation – coupled with a small caching layer, this is a crucial part for the project’s not-so-secret sauce. A fair amount of debugging and optimization later, [tvlad1234] got Linux to run, achieving boot times in 10-15 minutes’ ballpark – considering the emulation layer’s presence, this is no mean feat.

At this point, the boot process stalls as you enter a login shell. If Linux on RP2040 is within your area of interest, feel free to pick up the effort from here, as the project is fully open-source – you only need a Pi Pico board and a throwaway SD card! Now, if pairing a RP2040 with some classic software is your definition of an evening well-spent, you can’t go wrong with DOOM! However, if you’d rather play with something else *nix-like, we’ve seen someone port Fuzix onto the RP2040 before.

DOOM Ported To A Single LEGO Brick

By now you’ve all seen the tiny LEGO brick with a working screen in it. The work of one [James “Ancient” Brown], it was truly a masterpiece of miniaturization and creativity. Since then, [James] hasn’t stopped innovating. Now, he’s demoing a playable version of DOOM running on a single plastic brick.

We’ve covered the construction of these astounding screen bricks before. Long story short, [James] designed a tiny PCB that hosts an RP2040 microcontroller which is then hooked up to a tiny OLED screen. The components are placed in a silicone mold, which is then filled with transparent resin to form the brick. The screen is then powered via contacts in the bottom, much like older-style LEGO motors.

Early experiments involved running various graphics to emulate a spaceship dashboard, but [James] has now gone much further. He’s implemented RP2040-doom to run the game. It uses tilt controls thanks to an accelerometer, combined with capacitive touch controls for shooting. The monochrome OLED is driven very fast with a special library of [James’] own creation to create three levels of grayscale to make the game actually visible and (just barely) playable.

It’s a hack, of course, and the controls are far from perfect. Nobody’s speed-running E1M1 on [James’s] LEGO brick, to be sure. Perchance. With that said, it’s still a glorious piece of work nonetheless. Just imagine, sitting with friends, and announcing you’re going to play some DOOM — only to pluck a piece of LEGO out of your pocket and start blasting away at demons.

Just because [James] doesn’t know when to quit, we’re going to lay down the gauntlet. Let’s get network play happening on these things, yeah?
Continue reading DOOM Ported To A Single LEGO Brick”

Cornell Updates Their MCU Course For The RP2040

The School of Electrical and Computer Engineering at Cornell University has made [Bruce Land]’s lectures and materials for the Designing with Microcontrollers (ECE 4760) course available for many years. But recently [Bruce], who semi-retired in 2020, and the new lecturer [Hunter Adams] have reworked the course and labs to use the Raspberry Pi Pico. You can see the introductory lecture of the reworked class below.

Not only are the videos available online, but the class’s GitHub repository hosts extensive and well-documented examples, lecture notes, and helpful links. If you want to get started with RP2040 programming, or just want to dig deeper into a particular technique, this is a great place to start.

From what we can tell, this is the third overhaul of the class this century. Back in 2012 the course was using the ATmega1284 AVR microcontroller, and in 2015 it switched to the Microstick II using a Microchip PIC32MX. Not only were these lecture series also available free online, but each has been maintained as reference after being replaced. One common thread with all of these platforms is their low cost of entry. Assuming you already have a computer, setting up the hardware and software development environment for these modules costs less than the price of a pizza dinner, a fact no doubt appreciated by the ECE department’s budget director.

We’ve covered this course before back in 2015 when it first changed. Another free online course on embedded system design is from [Prof James Conrad] at UNC Charlotte, based on the Renasas RX63N microcontroller — the UNC Charlotte team drove development of the autonomous vehicle project we covered back in 2009. If you know of other online embedded systems classes, let us know in the comments below.

Continue reading “Cornell Updates Their MCU Course For The RP2040”

A Pi Pico plugged into a breadboard, with jumpre wires going away from its pins to an SPI flashing clip, that's in turn clipped onto an SPI flash chip on a BeagleBone board

Programming SPI Flash Chips? Use Your Pico!

At this point, a Pi Pico is equivalent to a bag full of programmers and debugging accessories. For instance, when you want to program an SPI flash chip, do you use one of those wonky CH341 dongles, or perhaps, even a full-on Raspberry Pi with a Linux OS? If so, it might be time to set those two aside – any RP2040 board can do this now. This is thanks to work of [stacksmashing] who implemented serprog protocol for the RP2040, letting us use a Pi Pico with stock flashrom for all our SPI flash chip needs.

After flashing the code to your RP2040 board, all you need to do is to wire your flash chip to the right pins, and then use the serprog programmer type in your flashrom commandline – instructions are available on GitHub along with the code, as you’d expect. Don’t feel like installing flashrom, or perhaps you happen to run Windows and need a flasher in a pinch? [stacksmashing] has a WebSerial-based SPI flasher tool for you, too, and shows it off with a fancy all-the-pinouts board of his own making.

This kind of tool is indispensable – you don’t need to mod one of these CH341 programmers to fix the bonkers 5 V default IO, or keep an entire Linux computer handy when you likely already have one at your fingertips. All in all, yay for one more RP2040 trick up our sleeve – this SPI flashing helper joins an assortment of applets for SWD, JTAG, UART, I2C and CAN, and in a pinch, your Pi Pico will also work as a digital and analog logic analyzer or an FPGA playground.

 

Showing balloon rising up, not too far from the ground, with one of the FOSDEM buildings and sky in the background

FOSDEM Sees Surprise Pico Balloon Event

At any vaguely-related conferences, groups of hackers sometimes come together to create an impact, and sometimes that impact is swinging something into an airspace of a neighboring country. [deadprogram] tells us that such a thing happened at FOSDEM, where a small group of hackers came together (Nitter) to assemble, program and launch a pico balloon they named TinyGlobo 1, which then flew all the way to France!

This balloon is built around a RP2040, and the firmware is written in TinyGo, a version of Go language for microcontroller use. As is fitting for a hacker group, both the hardware and software are open source. Don’t expect custom PCBs though, as it’s a thoroughly protoboarded build. But a few off-the-shelf modules will get you the same hardware that just flew a 400km route! For build experiences, there’s also a few tweets from the people involved, and a launch video, also embedded below.

This reminds us of the Supercon 2022 balloon story — darn copycats! If you’re interested in the more Earthly details of this year’s FOSDEM open source development conference, check out our recent coverage.

Screenshot of the code decompiled after these patches are applied, showing that all the register writes are nicely decompiled and appropriate register names are shown in the code

Making Ghidra Play Nice With RP2040

Developing firmware for RP2040 is undeniably fun, what’s with all these PIOs. However, sometimes you will want to switch it around and reverse-engineer some RP2040 firmware instead. If you’ve ever tried using Ghidra for that, your experience might have been seriously lackluster due to the decompiled output not making sense when it comes to addresses – thankfully, [Wejn] has now released patches for Ghidra’s companion, SVD-Loader, that turn it all around, and there’s a blog post to go with these.

SVD-Loader, while an indispensable tool for ARM work, didn’t work at all with the RP2040 due to a bug – fixed foremost. Then, [Wejn] turned to a pecularity of the RP2040 – Atomic Register Access, that changes addressing in a way where the usual decompile flow will result in nonsense addresses. Having brought a ton of memory map data into the equation, [Wejn] rewrote the decoding and got it to a point where peripheral accesses now map to nicely readable register writes in decompiled code – an entirely different picture!

You can already apply the patches yourself if you desire. As usual, there’s still things left in TODO for proper quality of life during your Ghidra dive, but the decompiled code makes way more sense now than it did before. Now, if you ever encounter a RP2040-powered water cooler or an air quality meter, you are ready to take a stab at its flash contents. Not yet familiar with the Ghidra life? Well, our own HackadayU has just the learning course for you!

A Thoroughly Modern Serial Terminal

The humble desktop serial terminal may have long disappeared from the world of corporate IT, but there are still plenty of moments when professionals and enthusiasts alike need to hook up to a serial port. Many of us use a serial port on our laptops or other mobile devices, but [Neil Crawforth] has gone one better than that with the VT2040. It’s an old-style serial terminal in a super-handy portable format, and as one might guess from the name, it has an RP2040 microcontroller at its heart.

Attached to the chip is a rather nice keyboard, and an ILI9488 480×320 LCD display. The software is modular, providing a handy set of re-usable libraries for the different functions including a PIO-based serial port. His main application seems to be talking to an ESP8266, but we’re guessing with a MAX232 or other level shifter chip it could drive a more traditional port. Everything can be found in the project’s GitHub repository, allowing anyone to join the fun.

As long-time readers will know, we’ve been partial to a few serial terminals in the past. Particularly beloved is this extremely retro model with vintage dot matrix LEDs.