[HN Gopher] The RP2040 Stamp
       ___________________________________________________________________
        
       The RP2040 Stamp
        
       Author : _Microft
       Score  : 48 points
       Date   : 2022-03-24 11:34 UTC (2 days ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | vbezhenar wrote:
       | I'm very newbie to microcontrollers and I bought 10 pico boards,
       | 5 with pins, 5 bare. What I've found not very nice is that
       | there's no official programmer for RP2040. I can use one board,
       | upload firmware and connect it to the other board with wires,
       | actually that's what I'm doing right now with breadboard, but
       | that's not very nice to use, I have lots of wires laying around.
       | 
       | I'm thinking about creating a programmer with 3D printer and some
       | spring contacts, but I really would love some tiny device with
       | RP2040 inside where I can put another RP2040 and have all pins
       | available for further connecting if necessary. Right now it's a
       | mess of wires.
       | 
       | Another RP2040 aspect which I didn't like is a complexity of boot
       | process. Now I have no idea whether it's common to
       | microprocessors or not. What I wanted to do is to write my
       | software with pure assembly without any SDKs. So far my research
       | is as follows:
       | 
       | RP2040 contains unmodifiable boot1 code. You can't modify it at
       | all. It contains some preliminary initialization code and some
       | procedures like float point operations, etc. That looks very
       | weird to me: why put that code in unmodifiable ROM. There're few
       | revisions of this ROM with different procedures (I guess they
       | optimize them in later revisions).
       | 
       | Boot1 connects to flash and loads 256 bytes of boot2 loader which
       | contains 252 bytes of code and CRC32.
       | 
       | Boot2 is compiled from SDK. It configures flash for some kind of
       | faster access mode and calls sdk initializtion procedures. I
       | didn't investigate further yet.
       | 
       | I managed to learn ARM Cortex M0 assembly, at least most of it,
       | and it's interesting to try to program with it. But now I'm stuck
       | with reading about flash, those QSPI protocols and their commands
       | to make sense of their boot2 bootloader (I could just re-use one
       | from SDK but I don't like this way). And then I still need to
       | understand how to configure the whole stack to run code from
       | flash.
       | 
       | Basically to re-implement writing hello world to UART, I have to
       | learn a lot of things. Which is fine, I guess, but I didn't
       | imagine this being that hard. I thought that I would need to
       | learn about UART hardware and how to interact with it and that's
       | about it.
       | 
       | And I really don't like their SDK. I managed to get it up and
       | running, but they're using cmake which is cryptic for me, it
       | takes seconds to compile my software, I have enough of that in my
       | Java work. I guess that's fine for professionals who need to get
       | things done.
       | 
       | That's not to say that I don't like this project, I still think
       | that's the most friendly ARM, at least when I tried to use STM32
       | it was much worse. RP2040 datasheets are very readable for
       | beginner. I just wish their setup was not so convoluted.
       | 
       | At this stage I'm considering to drop flash usage at all. I have
       | 256 KB of RAM anyway, ought to be enough for anybody, right? Just
       | copy my program from flash to RAM and run it from RAM. On the
       | plus side is predictable performance. I still don't understand
       | how can one write timing-sensitive code with flash where jump to
       | non-cached address could stall CPU for some unspecified number of
       | tacts.
        
       | a9h74j wrote:
       | I like the principle of doing all of the highest-density routing
       | on the smallest possible board, with minimum peripherals.
        
       | tapland wrote:
       | Oh! Solderparty is based in Malmo, Sweden.
       | 
       | The southern region seems to have so much exciting tech going on,
       | it really feels like it's starting to do laps around the
       | Stockholm region.
       | 
       | The city embraced digital culture decades ago with a crazy amount
       | of game dev jobs per capita and even a brief precense in Second
       | Life. Now it seems full of startups and it's nice to see smaller
       | projects pop up as well!
        
         | dijit wrote:
         | Wait what? I live here and it seems pretty dead
         | technologically, aside from the small number of game studios.
        
       | noipv4 wrote:
       | Am a noob wrt RP2040. I use rPI model B boards to run piHole,
       | media server, apc daemon etc. What can I use this RP2040 stamp
       | for? Which OS runs on it? Is stamp a standard form factor?
        
         | varajelle wrote:
         | The RP2040 is a CortexM0 microcontroller. This is a completely
         | different segment than the previous mini-computers from
         | raspberry pi.
         | 
         | It just has a few hundreds KB of Ram.
         | 
         | It usually runs bare metal or some RT OS.
        
       | RicoElectrico wrote:
       | RP2040 is pretty underwhelming as a microcontroller. Its sleep
       | mode draws 0.8 mA. And the ADC has DNL issues [1] Capabilities-
       | wise it feels like "NIH syndrome" ESP32-alike with USB in lieu of
       | wireless.
       | 
       | At least it's much cheaper than Arduino (like 2-3x compared to
       | Uno). The price of Arduino Uno is not justified by anything when
       | its NRE cost must have been recouped long ago.
       | 
       | [1] https://pico-adc.markomo.me/
        
         | Zenst wrote:
         | Yes, having played with the pico, ESP32 and predessor I kinda
         | agree, thouogh ADC's in microcontrollers are limited depending
         | upon what you want to do and will often lean towards an
         | external.
         | 
         | The ESP also has hardware floating point, which if you need to
         | use that sure does blast past the pico's core's.
         | 
         | What the pico does shine well at is the PIO controllers and a
         | good documentation user base. The fact that within a year it
         | had early on full support in the ecosystem of microcontrollers
         | is pretty darn amazing, more so given Espressif not exactly
         | known for their doumentation and the whole intergration with
         | IDE's like the ardiuno was dedicated users off their own steam
         | driving it.
         | 
         | Another plus for the PICO is that you can get for a dollar the
         | chip itself and with the advent and ease of doing your own
         | circuits, afforded the ability to roll your own controller
         | board how you want them. Sure can do that with the ESP's but
         | not sure so easily accesable price wise as the PICO chip is and
         | not as cheap.
         | 
         | Yes the whole lack of wifi and BT upon the PICO in todays times
         | with IOT this and other projects, does leave shortfalls, though
         | there are boards that do that, sadly many get WIFI by adding
         | something like an ESP01 chip and the whole ironic aspect of a
         | microcontroller needing another microcontroller for it's wifi
         | when maybe what you wanted to do could be done upon the ESP01
         | alone, well. Bit of a chuckle.
         | 
         | So for me, were the PICO stands out is the PIO controllers and
         | how they with the USB host option allow many device avenues.
         | Want your own joystick - doable, want to emulate some odd
         | protocol - may well find the PIO can take a lot of strain from
         | that.
        
           | a9h74j wrote:
           | > the whole ironic aspect of a microcontroller needing
           | another microcontroller
           | 
           | But it is a _microservices_ architecture!
        
         | jonp888 wrote:
         | As I understand it the chip was partly intended as a starter
         | project for RPi's newly founded in House silicon design team,
         | so not using an existing design could be partly deliberate.
         | 
         | However the PIO state machines set it apart.
        
           | [deleted]
        
         | mikewarot wrote:
         | The onboard RAM is a bit light, I agree. But the chip is quite
         | powerful, they can usually be overclocked to about 250 Mhz, and
         | have dual cores. The real star of the show is the PIO system.
         | 
         | You've got 2 sets of 4 state machines, that can do a whole lot
         | of stuff at really impressive I/O rates. People have used them
         | to generate VGA or DVI (HDMI) with just some resistors and
         | connectors.
         | 
         | It's almost as good as having an FPGA. I suspect people will be
         | wringing more and more performance out of this chip over the
         | next year or two.
        
         | gchadwick wrote:
         | > Its sleep mode draws 0.8 mA.
         | 
         | What's your source for this? The RP2040 datasheet claims 0.18
         | mA for Dormant state and 0.39 mA for Sleep. As you've got
         | detailed control over what gets clock gated in sleep state
         | suspect you can bring that 0.39 mA down if you've only got one
         | or two wake events to care about.
        
         | grinchygrinch wrote:
         | Given that RP2040 needs external flash, I'm quite worried about
         | the performance when pulling uncached code from it (on top of
         | using M0 core - I'm used to M4 by now). I know the MCU has 16kB
         | of cache, but my firmware for which I'm still deciding on
         | whether to port it to RP2040 or not is about 80k. Does anyone
         | here has some real-life data on this?
        
         | PragmaticPulp wrote:
         | The Raspberry Pi foundation focuses on accessibility and
         | education. In that regard, the RP2040 excels. The price is
         | especially advantageous and the beginner-focused documentation
         | are great for introducing people to microcontrollers.
         | 
         | But I do agree that this feels like the Arduino situation all
         | over again, where many people mistake the sudden popularity and
         | influx of Tweets, YouTube videos, and headlines as an indicator
         | that it's the premier microcontroller on the market or the only
         | logical choice for new projects.
         | 
         | It has a few unique and cool features, but we should
         | periodically remind everyone that every microcontroller is a
         | set of tradeoffs and compromises that the user should evaluate.
         | 
         | On the other hand, if you're going for maximum clicks or views,
         | putting "Raspberry Pi" in your headlines is a guaranteed way to
         | bring in more eyeballs. It's constantly a hot topic.
        
         | auxym wrote:
         | You've raised real downsides (for some applications), but the
         | rp2040 also many features that are unheard of at its price
         | point (1$): dual core, PIO, lots of ram. In fact the RAM + dual
         | core means you're almost getting _two_ Cortex-M0+ MCUs for the
         | price of one (with shared peripherals).
         | 
         | For comparison, Microchip (formerly atmel) SAMD21 (also
         | Cortex-M0+, of Arduino Zero fame) is about 3-4 $, single core,
         | less RAM.
        
         | liamwestray wrote:
         | I've seen "claims" the ESP32 can do 0.1 mA in sleep, but
         | haven't seen anyone actually implement that in a functional
         | application.
         | 
         | My use case is different though, I will be adding an NRF9160
         | for connectivity so ESP32-based stuff just didn't make sense.
         | It's also for academic customers who want to be able to work
         | using MicroPython should I get hit by a bus.
        
       | puzzlingcaptcha wrote:
       | It looks very neat, too bad it costs three times as much as a
       | regular Pico. I'm not sure it was essential to include the
       | NeoPixel and LiPo charging.
        
         | kube-system wrote:
         | It's priced about the same as the other tiny rp2040 boards. I
         | wish this would have existed around the time I was building my
         | last project, because I wanted something without a usb
         | connector.
        
       | throwaway81523 wrote:
       | This is 2x the size of a xiao/qtpy, has less stuff(?), and is
       | more expensive. What are the advantages?
       | 
       | https://www.seeedstudio.com/XIAO-RP2040-v1-0-p-5026.html
       | 
       | https://www.adafruit.com/product/4900
        
         | codebje wrote:
         | Exposed pins, for one. There's 30 GPIOs on an RP2040, only
         | having 12 or so of them available is a weakness of rhe tiny
         | boards.
        
         | colejohnson66 wrote:
         | That's like asking why someone would choose a bigger FPGA when
         | a smaller one does the same thing for less cost. The answer is:
         | the bigger one has a different feature set. In this case, it's
         | access to all 30 of the GPIO.
        
           | throwaway81523 wrote:
           | Ah I see. I hadn't thought about using all the pins. This
           | brings out 23 of them and is about the same size as the
           | stamp: https://www.adafruit.com/product/4888
           | 
           | This brings out 20 and has castellated pads:
           | https://www.adafruit.com/product/5302
           | 
           | This is bigger but fancier, has a lipo charger and other
           | stuff. I think it brings out all available pins, though the #
           | mentioned is 21. More of an SBC than a solder-down, I guess.
           | I have one (old version) but am trying to figure out where I
           | left it: https://www.adafruit.com/product/5302
        
       ___________________________________________________________________
       (page generated 2022-03-26 23:00 UTC)