Friday, 22 January 2021

The Raspberry Pi Pico Microcontroller

Yesterday they launched a new product, the Pi Pico Microcontroller.

I thought "meh" what's so special? We already have plenty of microcontrollers, and several popular platforms with Makers:

* Arduino (AVR-based)

* ESP32 (dual core, weird xtensa architecture, hardware floating point, built-in wifi and bt radio) - a highly capable, very complex and poorly documented chip

* Micro Bit and the NRF52* chips - built in radio, ARM cores

* Loads of 8-bit options and 32-bit options for uc

So, what is good about the Pi Pico?

Proper USB

Many of the other popular microcontrollers don't have a "real" USB interface. The Arduino Nano and ESP32 boards have a USB connector, but it's hard-wired into a usb-serial thing. This means it can only ever be a serial port.

With the Pi Pico, it can be a USB serial if you want, but it can also be other things, possibly at the same time:
* HID emulation (become a keyboard / mouse)
* Storage emulation - that's what the bootloader does

Also, the "USB Serial" on the Pi Pico is only emulated, it doesn't have the limitations of a real serial interface, it doesn't electrically exist - it's much faster and can't get its baud rates mixed up.
NB: Yes, I know that a lot of other microcontrollers DO have USB, and the latest ESP* chips have proper USB too.


I don't like to use the term "unbrickable" as I successfullly bricked a "unbrickable" esp8266 :)
But the bootloader is in ROM -so it can't be trashed - and both the SWD interface and USB bootloader will allow you to reflash a Pi Pico.

The Arduinos - are brickable in principle - as the chips have various "fuses" which can be set in a way which prohibits further programming. This is by design, but it's bad if accidetnally activated.

Also the Arduino bootloader, if overwritten, makes it more difficult (although not impossible) to reuse the device.

PIO Interface

I think it's fair to say that the hackers who have played with the PIO are only starting to appreciate its capability. I've not played with it yet, but it is:
  • Flexible interface for reading / writing serial or modestly parallel protocols at (fairly) high speeds
  • Can be reprogrammed to do UART, SPI, and all sorts of other things which don't have dedicated hardware
  • Writing data to the "infamous" WS2812 "neopixel" self-clocking serial protocol - which needs to be bit-banged on nearly every device.
  • Uses yet unimagined
Some other microconrollers have similar things, but as far as I can see, the Pi Pico's PIO is more flexible, easier, better documented, and possibly more powerful than most of them.
 To be fair, the ESP32 also has a peripheral called "RMT" which can do some of these things.

Enough memory

A lot of the other chips in the same kind of price range have a smaller amount of SRAM - which makes even simple things awkward. Also low-SRAM chips have little or no capability of using high level languages or text-based diagnostics (think REPL) - because there simply isn't enough RAM to store the strings.
I tried programming the esp8266 using Micropython - it works, but there is a crippling lack of RAM which makes complex programs impossible (even though there is execute-in-place).
The Pi Pico also has execute-in-place which makes more ram available for applications.

ARM cores?

To be honest, it would have been "interesting" to see RiscV cores, but I know that Cambridge-based Raspberry Pi is very ARM-centric. I suppose nobody got fired for using ARM. I'm far less excited about the cores than the rest of the chip.

The PCB / dev board

I've been talking so far about the microcontroller - but the Pi Foundation actually released a dev board (the microcontroller isn't generally available yet - but it will be - and some other integrators have already got samples).

The dev board isn't anything magical or special, but it is quite tidy and looks to have good power regulation.

Personally I'd have quite liked to see the header pins 0.1 inch closer together - but that would probably make breaking out all the GPIOs more difficult or compromise other things - so it's ok.

 "Raspberry Pi Silicon"

As far as I can tell this is a marketing gimmick mocking another fruity company.
Weren't the Raspberry Pi 2, 3, 3B+, 4  all Raspberry Pi silicon? They were all chips made by Broadcom but totally to the spec of the RPF and not generally available.  Only the first Pi used an "off the shelf" chip.

It seems the major difference is labelling. And the guts of the Pi Pico presumbly contains lots of IP from different companies. They could have easily outsourced much of the design and/or validation.

So I think it's just marketing words.