Interesting new micro-controller board and custom chip from Raspberry Pi: Raspberry Pi Pico.
It is programmable with Python and C/C++. Cross-platform toolchain for development on Windows, macOS, and Linux — including, naturally, the Raspberry Pi family itself Supports TensorFlow Lite.
Raspberry Pi is looking to do for the microcontroller market what they’ve already done for single-board computers with the launch of the Pico. The board — priced at just $4 — is based on the RP2040, a dual-core Cortex-M0+ processor designed in house. It designed to be easy to taken into use.
Announcement at Facebook says:
It’s been a big week. We launched something tiny, something new – Raspberry Pi Pico, just for you.
Read all about it, plus everything else that went down at Raspberry Pi in the last few days, in Raspberry Pi Weekly.
https://www.raspberrypi.org/weekly/raspberry-pi-pico-has-landed/
Raspberry Pi’s just-announced Pico board! Powered by RPi’s first custom silicon, the RP2040, this little board breaks out 26 GPIO pins and is designed to be embeddable. Let’s take a look!
More information:
https://www.hackster.io/news/hands-on-with-the-rp2040-and-pico-the-first-in-house-silicon-and-microcontroller-from-raspberry-pi-effc452fc25d
https://www.raspberrypi.org/blog/raspberry-pi-silicon-pico-now-on-sale/
https://www.raspberrypi.org/documentation/pico/getting-started/
https://projects.raspberrypi.org/en/projects/getting-started-with-the-pico
https://github.com/raspberrypi/pico-tflmicro
https://www.hackster.io/gatoninja236/raspberry-pi-pico-hackster-spotlight-69ccb1
https://www.hackster.io/news/hands-on-with-the-rp2040-and-pico-the-first-in-house-silicon-and-microcontroller-from-raspberry-pi-effc452fc25d
615 Comments
Tomi Engdahl says:
Adafruit Shows Off Upcoming CAN Bus, USB Host RP2040-Powered Development Boards
RP2040′s second core and PIO press-ganged into bit-banged USB duties, while a single-chip CAN bus controller extends its capabilities.
https://www.hackster.io/news/adafruit-shows-off-upcoming-can-bus-usb-host-rp2040-powered-development-boards-ac5b6760d044
Tomi Engdahl says:
Cornell Updates Their MCU Course For The RP2040
https://hackaday.com/2023/03/10/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.
https://ece4760.github.io/
Tomi Engdahl says:
Pi Pico Power Meter
https://hackaday.io/project/189359-pi-pico-power-meter
For my electronic developments I need more than one multimeter to get the power. Here it is!
Based on Raspberry RP2040 controller and the INA219 current sensor it is possible to get very precise measurements of current flowing through a shunt resistor. Additionally it is possible to measure the system voltage and get the calculated power.
Everything is shown on a 0.96″ OLED display.
I will use it as a power meter for my power electronic development. With two of them I could use it to calculate the efficiency.
Tomi Engdahl says:
https://hackaday.com/2023/03/15/a-smart-home-that-can-do-it-all/
Tomi Engdahl says:
PicoHome (WIP)
https://github.com/racerxdl/picohome
Raspberry Pi Pico Home Automation using CAN Bus
Tomi Engdahl says:
https://hackaday.com/2023/03/17/fish-tank-dosing-pump-built-using-pi-pico/
Tomi Engdahl says:
Per-Simon Saal’s PiPicoPowerMeter Turns a Raspberry Pi RP2040 Into a Power Measurement Powerhouse
https://www.hackster.io/news/per-simon-saal-s-pipicopowermeter-turns-a-raspberry-pi-rp2040-into-a-power-measurement-powerhouse-8b1c5fed521e
Offering voltage, current, and power measurements up to 26V, the PiPicoPowerMeter is a compact alternative to multimeter juggling.
Tomi Engdahl says:
https://www.raspberrypi.com/news/rp2040-smart-event-badges-for-hacker-hotel/
Tomi Engdahl says:
https://www.cnx-software.com/2022/12/28/banana-pi-bpi-pico-rp2040-raspberry-pi-pico-replica-gets-usb-c-port-i2c-connector-and-rgb-led/
Tomi Engdahl says:
Pimoroni’s Raspberry Pi Pico W-Powered Cosmic Unicorn Packs Over 1,000 RGB LEDs
Chunky but funky 32×32 RGB LED matrix gets driven by MicroPython on a Raspberry Pi Pico W — and there’s even early Bluetooth support.
https://www.hackster.io/news/pimoroni-s-raspberry-pi-pico-w-powered-cosmic-unicorn-packs-over-1-000-rgb-leds-85b53da1f56a
Tomi Engdahl says:
RP2040 Runs Linux Through RISC-V Emulation
https://hackaday.com/2023/03/19/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.
https://github.com/tvlad1234/pico-rv32ima
Tomi Engdahl says:
https://mcuoneclipse.com/2023/03/19/ble-with-wifi-and-freertos-on-raspberry-pi-pico-w/
Tomi Engdahl says:
Bitbanged DVI on the RP2040 Microcontroller
https://github.com/Wren6991/picodvi
RP2040 was designed to run at 133 MHz, but we found (without too much surprise) that typical silicon can be pushed further. In fact, there was overlap between the maximum system clock, and the TMDS bit clocks of slower DVI video modes. We had done great stuff with VGA on the FPGA platform, which ran at 48 MHz, but wouldn’t it be absurd and wonderful to connect your microcontroller straight to an HD TV with no other electronics in between? This seemed unlikely to work out, but I stayed up at night playing around with assembly loops, and I could not convince myself that DVI was out of reach. Everything seemed to fit:
With some of the core-local hardware on RP2040, and a neat encoding trick, I could do pixel-doubled TMDS encode on-the-fly using around 60% of an M0+ (running at 252 MHz, for 640x480p 60 Hz DVI)
PIO can yeet out data streams at system clock frequency, and drive a 1/10th rate clock on the side, with pretty minimal programming
Some of the DMA features are help with putting together the sync/blanking patterns on the fly, rather than having the patterns flat in memory
With the second processor utterly unencumbered, you can render some pretty graphics to put on your DVI display. There is even enough RAM for a QVGA framebuffer!
The greatest unknown was driving 252 Mbps serial through the general-purpose digital pads (especially differential serial, emulated with two single-ended pads). By this point I was utterly driven and consumed by the need to find out if DVI could work, so I laid out a board over a few evenings after work.
Although it passes the eye mask and a few other tests, this circuit is not fully compliant with the DVI spec. In particular, our logic 1 is not quite right, due to the CMOS drive on the GPIOs: any more than a ~60 mV mismatch between the Source and Sink +3V3 rails will push our high-level offset outside of the +- 10 mV allowed by the spec. This is a real nitpick, because a differential receiver is unlikely to care about a 10 mV commmon mode offset, but still — it is out of spec. A better circuit could use a fast Si diode and a smaller resistor value, e.g. 220 ohm, so that the emulated CML output floats on the sink’s +3V3 supply when we output our 3V3 CMOS high level, but still sinks the requisite 10 mA when driving low.
That said, it’s compliant enough that I can wander around the office and plug it into every monitor I see, and not even one of them explodes (if my manager is reading this — hi).
Encoding TMDS
DVI uses an encoding scheme called TMDS during the video periods. 8 data bits are represented by a 10 bit TMDS symbol, which is serialised at 10x the pixel clock. 3 lanes transfer 24 bits of data per pixel clock, which for our purposes is one pixel. TMDS is DC-balanced, although DVI as a whole is not DC-balanced on all lanes, due to the control symbol encoding. The algorithm given in the DVI spec is quite fussy, and you are supposed to match its output exactly. It tracks running disparity with a counter, and optionally inverts symbols to bound the disparity, with some tie-break rules for 0-balance symbols.
Key fact about TMDS: if the current running disparity is 0, and you encode data x followed by data x ^ 0×01, this produces a pair of TMDS symbols with 0 net parity. If you manipulate the input data in this way — duplicating the pixels, and twiddling the LSB — TMDS becomes stateless, because the running disparity is defined to be 0 at the start of each video period, and returns to 0 after each duplicated pixel pair.
If we have a half-resolution scanline buffer, and are only interested in 7 or fewer bits of significance for each colour channel, we can encode this with a lookup table, where each entry is two TMDS symbols with net balance 0. The toggling of the LSB with each output pixel is not noticeable.
We must output a pixel once per 10 system clock cycles (as the system runs at the TMDS bit clock), and since we are doubling pixels horizontally we may as well double vertically too, by using each encoded buffer twice. Taking horizontal blanking into account (1:4 ratio at VGA), we would spend 1.2 of our two cores on TMDS encode, and have 0.8 cores left to generate DVI timing and render graphics.
Tomi Engdahl says:
Raspberry Pi Pico Video Output
https://picockpit.com/raspberry-pi/raspberry-pi-pico-video-output/
The Raspberry Pi Pico is an incredible little microcontroller. While it does not have a video output interface built-in, like it’s bigger Raspberry Pi Zero / 1 / 2 / 3 / 4 / 400 brethren (HDMI / double HDMI in their case), it is possible to add a video output to the Pico! (As VGA or DVI over an HDMI connector, read on for details)
We’ll explain why a video out is a very special feature for microcontrollers, and what types of video out you can build or purchase for your Pico. We’ll also show you some sample code – already precompiled for you, so you can download it, and talk about what you need to modify to make it run.
Making VGA output work on the Pico
This means that the Pico, with it’s 3.3V digital output has high enough voltages to be able to drive these RGB pins into the VGA cable (which expects voltages of 0 – 0.7V). We actually need to reduce the voltage by using resistors.
We can buld a simple DAC (digital analog converter) by combining several resistors and GPIO pins. Depending on the combination of GPIO pins which are active at any given moment, we have different voltage levels (= brightnesses):
Since we’re working on the Pico, there are no “graphics drivers” we can simply install. We need to write the code ourselves … or not
Luckily, the people who designed the hardware board for us already supply some code we can use, so that we’re able to focus on our project.
Example code you can use can be found in the pico-playground Repository:
https://github.com/raspberrypi/pico-playground
In this repository, there is a simple movie player called popcorn (which plays movies in a custom format). A big buck bunny, 1.6 GB in size can be downloaded here. Note that these are raw disk images to be written to an SD card – this example assumes you have the VGA demo board, which has an SD slot. Instructions for converting movies are also given.
The code uses the pico_scanvideo library (pico/scanvideo.h) from the pico_extras repository. Also have a look at that repository for audio sample code!
pico_scanvideo – includes extensive documentation!
The API outputs parallel RGB data and sync signal on pins for DPI VGA (using resistor DACs, as described above).
Tomi Engdahl says:
Adafruit Launches New CAN Bus Boards and a Neat Feather RP2040 with HDMI-Compatible Video Port
https://www.hackster.io/news/adafruit-launches-new-can-bus-boards-and-a-neat-feather-rp2040-with-hdmi-compatible-video-port-c9542fb8e856
If you’re working with automotive or robotics the CAN bus boards could be for you, while the new Feather offers low-cost digital video.
Adafruit has launched a trio of new boards, including two aimed at those working on automotive or other CAN bus projects and one which gives you an easy way to hook a Raspberry Pi RP2040 microcontroller up to an HDMI display.
Adafruit’s final new board, which at the time of writing was still listed as “coming soon,” is the Adafruit Feather RP2040 with DVI Output Port. Mashing together the company’s existing Feather RP2040 and DVI Breakout Board designs, the new Feather offers a single-board solution to getting a Raspberry Pi RP2040 controller talking to HDMI displays — using the sneaky workaround of sending DVI signals over an HDMI cable to avoid having to pay a fee to license the HDMI standard.
“In Arduino, which is what we recommend, we use our fork of [Luke Wren's] PicoDVI to create an internal framebuffer of 320×240 or 400×240 16-bit pixels that is then continuously blitted out as pixel-doubled 640×480 or 800×480 digital video. Note that the DVI video generation uses one full core, both PIOs [Programmable Input/Output blocks], and 150k[B] (320×240) or 190k (400×240) of SRAM. It’s kinda maxed out so be aware of the remaining resource limitations.”
https://www.adafruit.com/product/5710