New Parts, New Hacks

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

  1. 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.

    1. 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

      1. 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.

        1. 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.

          1. 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.

      2. 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.

    2. “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.

      1. 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?

        1. 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.

    3. > … 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!

      Diversity rocks!

      1. 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.

        1. 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.

          1. 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.

    4. 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.

  2. 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?

    1. 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.

      1. 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”

          1. 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.

        1. 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.

 for a newer video regarding how to pause with no frame buffer. Interesting workaround.

      1. 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!?

      2. 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.

        1. 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.

        2. 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.

          1. 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.

          2. 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?

          3. 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.

        1. 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.

  3. 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.

  4. 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 “ 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. )

  5. 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 ?

      1. 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.

    1. 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.

  6. 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.

      1. 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” …

        1. 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.

    1. 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.

    2. 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?

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.