The biggest news this week is that Raspberry Pi is no longer synonymous with single-board Linux computers: they’re dipping their toes into the microcontroller business with their first chip: the RP2040, and the supporting breakout board, the Pico. It’s an affordable, capable microcontroller being made by a firm that’s never made microcontrollers before, so that’s newsy.
The Hackaday comments lit on fire about this chip, with some fraction of the commenters lamenting the lack of wireless radios onboard. It’s a glass-half-full thing, I guess, but the RP2040 isn’t an ESP32, folks. It’s something else. And it’s got a hardware trick up its sleeve that really tickles my fancy — the programmable input/output (PIO) units.
The other half of the commenters were, like me, salivating about getting to try out some of the new features. The PIO, of course, was high on that list, but this chip also caters to folks who are doing high-speed DSP, with fast multiplication routines burnt into ROM and a nice accumulator. (You know you’re a microcontroller nerd when you’re reading through a 663-page datasheet and thinking about all the funny ways you can use and/or abuse the hardware peripherals.)
All chip designs are compromises. Nothing can do everything. The new peripherals, novel combinations of old elements, and just pleasant design decisions, open up new opportunities if you’re willing to seek them out. When the ESP32 was new, I was looking at their oddball parallel-I2S hardware and thinking what kind of crazy hacks that would enable, and clever hackers have proven me right. I’d put my money on the PIO being similar.
New chips open up new possibilities for hacks. What are you going to do with them?
84 thoughts on “New Parts, New Hacks”
I remain curious what their MEGA version upgrade of the RP2040 or RP2740 or whatever current or likely modified cores it winds up using will do and support. Keep the price reasonable, make sure the code base exists and flesh out the pretty conceptually amazing PIO features and that’s an entirely new class of product with a huge amount of potential. Integrate it into a regular newer Raspberry Pi?
This feels like something that Arduino should have done 5+ years ago. Arduino is still selling their MEGA for over $40. Not $4. It’s 2021. A 16 MHz oscillator with super limited memory isn’t competitive and has not been for a while now.
Need to flesh out some of the driver and software and IDE support here but I am sure people are working on that now. Someone has already put together basically a NES emulator. Arduino has stated they are going to integrate this chip into their IDE. Feel a bit bad for Paul Stoffregen and the Teensy at this point as he just heard about this when it released and they currently serve slightly different areas but that might change quickly and the price points are not comparative.
The documentation is fantastic which goes a long way although there are still some pretty deep levels that you can reach (like writing assembly directly to it). Most users will want the easy drag and drop though and hopefully that becomes fairly common. Please provide ample software support for functionality (the PIO goes a long way here already) plus please try to keep the code base from splintering like Arduino has and this thing could really be extremely impactful on the maker community and a fair bit beyond.
That $4 price tag is directly competing with cheap-clone 32u4 atmega boards (pro micro) , with a lot more power. I don’t recall atm if usb hid was mentioned in the prior article but if it is available, we have a potentially market-upsetting contender
you might have to write your own descriptors. people who build sim pits and custom controllers love their teensies, but i always found them overkill for that job. a leonardo or pro micro does the job just as well. arduino has a feature where you can implement custom device descriptors in your own libraries and it adds them to a composite device with the other stock peripherals. its not that hard to use. the descriptors are in the form of hex codes stuffed into progmem, but i think there are some tools from the usb implementers forum that one can use to write those. i hope the pi pico has something like that.
i think its going to displace some of the lower end teensies, the stm32 boards, and most arduinos (except possibly large profile boards like the due). its the $4 price point that’s especially disruptive. especially if its hid support is good.
even a DigiSpark (based on attiny85) does USB HID and you can choose between the model which slots directly into your PC (savin even the price of the USB cable) or the micro USB version.
Bit banging HID is quite limiting as it can use only interrupt packets of 8 bytes and at most 100/sec and no way of sending more. It is only for very low bandwidth. The spec don’t want a low speed device o hog the bus.
I had been done a lot more with Vendor Custom in Low Speed as much larger packets in a burst allowed and not have to craft usage tables. I think I hit about 20 kBytes/s transfer rates.
Once you get above low speed(with hardware peripheral), then largr packets and higher polling rates.
Really wish they had raise the limits as the old Low Speed device no longer chocks the bus as every ports on the bac of the PC are root hubs which aren’t shared.
From the C/C++ SDK document:
“The tinyusb_dev or tinyusb_host libraries within the Pico SDK allow you to add TinyUSB device or host support to your application by simply adding a dependency in your executable in CMakeLists.txt”
I would guess this pretty much says at least HID, and probably all of the standard device types.
“A 16 MHz oscillator with super limited memory isn’t competitive and has not been for a while now.”
Well yah, since Intel released the 20Mhz 80386. Like a Hyundai Accent isn’t competitive in GT or Sportscar championships but is fine for getting the groceries.
Hyundai Accents also don’t cost $150,000 each either and neither do 386 processors was more of the point there?
What they’re going for here, is something even easier than arduino (with programming support for both C/C++ and MicroPython/CircuitPython, and soon, (according to the Arduino folks) the Arduino IDE), way more powerful than Arduino, without costing any more. That’s hard to argue with. I’ll probably still use AVR micros for things like keyboard controllers, where I don’t WANT anything more, but it’s nice to have an option where I really COULD do much more with a cheap dev board. The Pico is pretty limited, since it’s only there as a “my first RP2040”, so we’ll have to see how much Adafruit is going to charge for their Feather version, or if anybody is going to make a dev board that includes WiFi and/or Bluetooth. A PicoW, maybe?
Arduino says they’re building a Nano based off this chip incorporating the ublox module or whatever it is they use on their Nano BLE and WiFi boards, so that should be just around the corner.
I got stuck in a Hyundai once as a rental, I’d say its not fit to get groceries either.
> … isn’t competitive and has not been for a while now.
Use what fits the job.
Sometimes (e.g.) a Tiny85 is not the right answer for a task, sometimes it is a perfect match.
And I still love these small critters!
This feels like the meme or argument about people who want to do everything with a 555 because it technically can, just with vast limitations and huge workarounds being needed most of the time.
Would like hardware that is small, cheap, robust and able too idle or turn off the things you don’t need so you have a reliable toolchain to work with and a robust amount of features and support software at the ready if needed.
Will this turn into a LEGO like microcontroller ecosystem? Too early to tell but it feels like it certainly could.
Sometimes a 555 timer is the right thing for a job.
To believe that more power, RAM, Flash and MHz is always better is a philosophical fallacy, not an engineering principle.
In reality, the trade-off is more than about raw power. Cortex based MCUs are an order of magnitude more complex than an AVR and are geared up for computationally heavy tasks rather than bit-bashing, so getting some things up and going with an AT TINY 85 might well be the right choice.
I am not disagreeing that sometimes all you need is a 555 and that’s it. There are always pros and cons to just about everything. I personally generally like the sheer versatility that is becoming increasingly available in both the hardware and software world that allows a larger group of people to be able to implement, understand and use microcontrollers and if you are able to keep it modular, low cost and easy to work with then it makes sense a fair bit of the time. But that doesn’t mean that you never want to have 555 chips available either. Just because you now have electric vehicles does not mean that nobody wants to work with Model T’s. You just see a lot less of them driving around in common use.
At 250nm nodes, the ATMega chips can’t compete with more modern microcontroller at price, memory, peripherals or speed. That’s even before the Arduino taxes on top. As long as there are noobs willing to pay overly inflated prices, they can continue sell the them at inflated prices. Who cares.
I have been using the $0.20 STM8 parts for a while and even replace most if not all of my old AVR projects with that. Just being able to do hardware debug with source is the minimum requirement I have set for any platforms I would invest my time into. For things that needs more horse powers, I use STM32F parts.
Also just going to leave this here.
The CPU here is a 2 MHz MOS Technology 6502/6512.
In very slight contrast, the NES uses two main cores, the CPU, running at 1.79 MHz for the NTSC NES and 1.66 MHz for the PAL version as well as a separate PPU. The RP2040 has two cores as well. I wonder where this is going?
Neither your comment or nickname make any sense here. The PPU in the NES isn’t a core, it’s a peripheral; it’s not Turing-complete and cannot run arbitrary code. The NES only has a single Turing-complete core.
As for the PIO: it’s not a Turing-complete thing, either, and can not run an emulator on its own. It has a very limited number of instructions and those are geared specifically for driving the IO-pins.
You need more than the PIO to make that whole thing work, sure and it seems like the available instruction set for the PIO is more limited than the MOS 6502 (https://www.masswerk.at/6502/6502_instruction_set.html) but the point remains that you most certainly will be seeing low level emulated NES units on this fairly soon since it has enough hardware to be able to handle it.
I’ll point you to section 3.6.9 of the RP2040 datasheet:
“Although not designed for computation, PIO is quite likely Turing-complete, and it is conjectured that it could run DOOM,given a sufficiently high clock speed”
It doesn’t take much for turing complete, but painful and at the expense of code size and speed. Lots of TTL CPU with minimalistic set are complete.
Where do you store the paper tapes in a chip?
You mean, I assume, the INFINITE paper tape. “Turing complete” is a poorly defined thing, but all it really requires in addition to basic arithmetic is the ability to test results and alter program flow.
Yissss, first thought in my head was that it would be a beut for emulation.
For more videos from the same person showing off the RP2040 PIO a bit more.
60Hz 1080p from the $4 Raspberry Pi Pico microcontroller!
Gee, I wonder why it’s only one bit per pixel :-D
Pretty dang smooth though, even if it can’t do double buffering.
That demo is 2bpp (you will see the grey levels sometimes, plus it gives you some antialiasing), and there is no framebuffer whatsoever
That’s pretty sick. The VGA + audio hardware is straight out of the demo, and it looks like he overclocked the chip and used some custom PIO/other code to get that working.
It’s not the most elegant thing ever but the VGA and audio hardware is off the shelf. He did overclock it and there’s a few drawbacks but it technically works.
“Stream data off the SD card using PIO… output RLE compressed video via PIO, and then do audio by PIO. PIO for the win! Overclocked to get a 1080p pixel clock!”
Was their (Graham’s) description of how they did it. Says they will be open sourcing it soon.
https://www.youtube.com/watch?v=cm5Mx3-QRKE for a newer video regarding how to pause with no frame buffer. Interesting workaround.
60Hz 1080p?? Impressive in a hipster-tech sorta way, given this has been done on just slightly lesser hardware.
8088 CGA version:
ZX spectrum version:
It’s a console mod chip.
A logic analyzer with the PIO doing what is done on the PRU, *but* at $4 and hooked up to a PC host would be nice.
You aren’t going to get the data off the chip fast enough with just USB FS, and the RAM isn’t that big either.
You do realize that not so long ago logic analyzers for lab use don’t have a whole lot of memory either. You can make better use of memory if you learn how to use triggers.
My scope only have 32kB of samples. :P MY other logic analyzer have 32MB of memory and a limited 16 channels. So anything that get me more channels at a decent speed would be more than welcome here. I mean at $4, what do you expect!?
Need an updated version that is a 64/32 bit architecture, quad core, runs at 600+ MHz with an actual USB 3.0 bus built in. $10 or less retail. That would be amazing. Something akin to the technical specifications of the Cortex-A1 with an ARMv8.2-A base although really not quite this target market would be pretty absurd.
Still would be nice to be able to get cheap microcontrollers that actually ran at GHz frequencies and more importantly were modular enough to support a huge host of realtime PIO type modules that were able to be hooked up easily to hardware pins.
As stated before, hook all this up as a module inside the main OS Raspberry Pi 5+ units and sell it for under $50 and see what the market says about that.
For what exactly? It really sounds like a mish mash. Most RT aoos doesn’t need that sort of power, Even in avionics found on fighter jets and the latest bombers, let alone vehicles.
I think most USB-connected disk drives use an ARM micro to adapt them to USB 3.0. So something like this must exist. Most likely an “M” core, though.
In fact, I was just looking at an ARM dev board yesterday, 600MHz. What was it?… Oh – Teensy 4 from PJRC:
600 MHz M7 core, Float point math unit, 64 & 32 bits
1984K Flash, 1024K RAM (512K tightly coupled), 1K EEPROM (emulated)
USB device 480 Mbit/sec & USB host 480 Mbit/sec
So no USB 3.0 there, but that’s just off the top of my head.
Yes, USB 3.0 controllers are available for the Cortex M0, BUT ARM charge money for each piece of licensed IP, newer and faster components being more expensive. Also the newer IP tends to need more silicon real estate, so the choice of USB 1.1 was probably a compromise between cost and functionality.
USB 1.x only dealling with logic levels and you can deal with them with just digital gates and much lower speeds within reach of low end nodes and weaker microcontroller cores.
USB 2.0 would need a faster node as well as faster microcontroller to deal with the data rates.
3.0 deals with very high speeds (faster, newer nodes too) and need specialized SERDES and adds a lot of complexiy. Would you still want a M0?
Well, if I’m looking for a cheap, cheap, cheap microcontroller, I would stick with USB 1, and I think this was a good decision. I was just pointing out that clearly there must be an ARM M* with USB 3. I don’t have enough experience with the Cortex cores nor with USB 3 design to know what level of core would be appropriate.
I would totally buy a Pi with a dedicated microcontroller integrated into the build. I’m not sure what I would do with it, but I would totally get it.
FYI some of the hacker DIY level logic analyzer.
Logic Pirate $30: 8 channels,256 kSamples recording size,60 MHz (overclocked) sampling rate (20 MHz and lower non-overclocked)
Propeller 1 logic analyzer: 32kB
Build one out of an old Popular Electronics, 1 latch per signal line = 1 byte typically, or 2 bytes one machine word. :-D
Not fast, not enough memory… maybe. You can do run-length-encoding on the fly on the PIOs. So if you have a signal with infrequent but fast data, it might be just the trick.
Wait, fast but limited amount of data, like how you read a floppy, it’s got a one track mind? :-D
But seriously, it’s kinda sounding capable of that, reading a floppy.
Have to define fast and how often you need to debug that. I already own a reasonable logic analyzer that I can fall back to.
At $4, you are looking a price point cheaper than a DMM that your average hacker can easily afford. Most of them aren’t going to be doing more than toggling pins or debugging simple thing like SPI, I2C. It’s silly to expect something like that to be probing modern day memory bus.
There are a lot of things that can be covered if you realistically be able to look at signals up to 16MHz, so 2x at 32 or 4x 64Ms/s would do. Most of the time, you aren’t going for the full width or full speed.
The only time I really want to use more than 16 signals is to try to trace the bus of a processor – something so old that doesn’t have a hardware debugger. It is old enough that 32M samples/s would do. I probably need something more like a combo ROM emulator and a hardware tracer.
A multi-tool that I already hooked up to multiple test points would save a lot of setting things up. At $4, I can leave a few of them in place.
You might be able to bitbang 1Gbit ethernet with additional RGMII PHY
Just a note: if you need a huge amount of computational power then you can write code for the regular pi boards on bare metal: https://github.com/rsta2/circle
This seems ideal for Pi Zero.
Easier to use a Teensy 4.0 running a Cortex A7 at up to 1GHz fcpu.
1MB ram and 2MB flash using the Arduino IDE.
Sorry, Cortex M7.
I like where this is going. I think in a couple of days we will be.ready for the third article.
Well, the comments were starting to drop off.
Add a flexible 2.4 GHz transceiver on chip with support in ROM for Wi-Fi, BLE, Zigbee and roll-your-own and winner winner meet chicken dinner. I think that’s the raison d’etre for two cores … forward thinking design.
There already plenty of ARM boards with connectivity out there and the Pico doesn’t need to replicate the ESP32.
It doesn’t need to, but it’ll nice to have an alternative. I give them six months for the PicoW.
That second core is there for as reason. That’s the reason.
Yet another person wanting this to be a ESP32 replacement. If you want an ESP32, get an ESP32!
Sounds like there’s a story behind the whole thing. Involving $.$$ most likely.
That’s the thing…I don’t want an ESP32. I want something better. This will be better in all ways. If I need advice on what I want I’ll look you up.
I would LOVE for someone to bring some REAL competition to the land of WiFi microcontrollers!
can I test it on qemu?
I was wondering about the DMIPS performance of the 133MHz dual ARMv6-M m0+ cores in the RP2040.
All I could find was on wikipedia (ARMv6-M Cortex-M0+ 0.93 DMIPS/MHz) I did not trust that so I checked the source which pointed to the Arm website* which says with optimal coding practices you could be looking at 1.36 DMIPS/MHz.
So the overall peak performance could be as high as about 361.76 DMIPS for the full chip, which would be similar to a 200MHz Pentium Pro (Dhry2 Opt VAX MIPS 312) from 1995 in terms of integer maths operations only (since the m0+ has no floating point unit). Which is impressive.
And since the pdf datasheet for the rp2040, shows it being clocked up to 150MHz (section 5.4.1. “Power Consumption versus frequency”) that would mean that 408 DMIPS may be possible. Which brings it closer to the level of a Celeron 300A (Dhry2 Opt VAX MIPS 484) from 1998 in terms of integer maths operations only (since the m0+ has no floating point unit).
*plug “site:developer.arm.com cortex-m0-plus” into your search engine of choice.
I thought that this may be of interest to others, but the above is an estimated DMIPS for the chip, you would need real hardware and run the same “v2.1 of Dhrystone” used by arm holdings. (e.g. https://github.com/Keith-S-Thompson/dhrystone )
Actually this one might be better: https://github.com/martin-zs/ARM_BenchMark
It is prety much the same Dhrystone source code as in the other link, but it also provides the whetstone benchmark used by ARM holdings, which would be nice for when the Raspberry Pi foundation gets its commissioned optimised floating-point functions from Mark Owen added.
… but nobody who was anybody was running their Celeron 300s at normal clock speed back in 1998.
Broadcom isn’t a player in the mcu world. But maybe it want to start ?
But development is expensive. Building all those peripherals, and support is expensive.
On the other hand, silicon in this case is cheap. 2mm2 at 40nm cost ~7cents. Packaging it in wlcsp is probably cheap too, probably costs a few more cents. So a very profitable chip at less than 50 cents – if sold at volume.
So maybe they are developing a cheap, versatile mcu , with a focus on low r&d costs and letting the community create all the support and peripherals(via the PIU) they need ?
You don’t want them as a vendor as they are into the whole NDA only datasheet thing.
Right. The Raspberry Pi Foundation made a deal with the devil in accepting their terms, so I for one am happy that in this case they’ve maintained their independence. By designing their own chip, they can always switch to another fab if the one they’re using tries to put the squeeze on them.
Why not mRuby?
You’re quite welcome to write your own if you want, but they can’t support everything out of the gate. They’ve started with the two most popular microcontroller languages, and sure as eggs is eggs the community will build on that.
Python since beginning was a language of choice for Raspberry Pi.
The “Pi” in the name is even short for “Python”.
Everything by brand “Raspberry Pi” always marketed as “X $” which is really really low and sexy price, but always sells as “X + scalp + shipping” $ which is turns out not even low anymore compared to other solutions. This always killed any interest in this brand in my case.
Exactly. I can actually find an in-stock RP 400 kit on Amazon for $160 versus its $100 retail price.
Since on Amazon you are mostly buying from “entreprenescalpers”, prices there do not reflect the real situation. But I agree, even on PiMoroni or other official places, prices are not that.
But not only for the fruity variety : The nanopi Neo whatever was $10 but you *had * to buy some other things along with it, even in their official site/store. And prices on AliExpress where well over that fabled $10 also.
Maybe the pi fundation should add that the things cost the low price “only when bought in our physical stores” …
The manufacturer can suggest a retail price, and the retail outlets can do whatever they think the market will bear.
But you don’t want to be mad at RPi here — they’re trying to trim the retail margins by wholesaling the Pi Zero for $4 (totally made-up number) and advertising the MSRP at $5. Retailers that want more than $1 per unit will charge more.
You want to be mad at the retailers. Or just vote with your wallet.
Thats what I´m doing. Pestering some friends in UK to stock on those PI´s, and bring me the lot when they come visit. :)
Not where you want to be looking for Raspberry Pi kit. In the UK for example Pi Hut sell the 400 etc for the RRP.
I’ve always bought everything Pi from one of the verndors recommended by the foundation. Never had to pay extra. Those guys will make their extra money on the power supplies, cables and such, but if you know where to get those, you won’t be paying anything extra either.
I have never paid more than MSRP for anything Raspberry Pi has made, and for most stuff I’ve picked up I’ve even paid below MSRP.
If you buy from someone that isn’t one of their partners (such as an Amazon seller), the seller has bought that from somewhere else and is reselling it with a markup so they make a profit. So just don’t do that.
As for shipping costs, do you really expect something like a $5 SBC or a $4 microcontroller to have so much profit built in that it would be reasonable for the seller the absorb the cost of shipping it? Do you also complain about every other product you buy that doesn’t have free shipping?
I bought from a reseller and got charged more than MSRP?
Well well well, if it isn’t the consequences of my own actions.
I’ve always paid the listed price. Though when I went to Micro Center to get one this time they sold out in three hours.
I’d live for something like this to integrated into the next “big” Pi silicon, but with M4Fs instead of M0+.
Please be kind and respectful to help make the comments section excellent. (Comment Policy)