4 ms·
PIO state machines programmable in Python sound pretty neat: > You'll note there's no I2S peripheral, or SDIO, or camera, what's up with that? Well instead of
by alin23 6y ago
PIO state machines programmable in Python sound pretty neat:
> You'll note there's no I2S peripheral, or SDIO, or camera, what's up with that? Well instead of having specific hardware support for serial-data-like peripherals like these, the RP2040 comes with the PIO state machine system which is a unique and powerful way to create custom hardware logic and data processing blocks that run on their own without taking up a CPU. For example, NeoPixels - often we bitbang the timing-specific protocol for these LEDs. For the RP2040, we instead use a PIO object that reads in the data buffer and clocks out the right bitstream with perfect accuracy. Same with I2S audio in or out, LED matrix displays, 8-bit or SPI based TFTs, even VGA! In MicroPython and CircuitPython you can create PIO control commands to script the peripheral and load it in at runtime. There are 2 PIO peripherals with 4 state machines each. [1]
Two M0 cores with M4 speeds and priced lower than usual M0-based boards also sounds exciting:
> The RP2040 is a powerful chip, which has the clock speed of our M4 (SAMD51), and two cores that are equivalent to our M0 (SAMD21). [1]
And official support for MicroPython and USB host and guest for $4 is something rare and could potentially lure some tinkerers into embedded programming.
I personally plan to create an USB ambient light sensor for controlling Lunar [2] with it. It is a very affordable and widely available board which could potentially allow people to reproduce the sensor even in places where I can't ship a pre-assembled board.
[1] https://www.adafruit.com/product/4864 https://www.adafruit.com/product/4864
[2] https://lunar.fyi https://lunar.fyi
- JustSomeNobody 6y agoFor anyone who's ever had to bitbang a protocol (say, RS232), after you've done it once, the "Oh, cool" factor wears off[0], so what they've done here sounds really nice. [0] It's not hard, it's easy. But who wants to do that?
- throwaway81523 6y agoIt actually sounds sort of difficult on those PIOs. All the timing stuff, start and stop bits, parity, flow control, ideally a FIFO, etc. You only have 32 words of instruction memory in each PIO. I wish they had made the PIOs more capable. It's not like they take a lot of die area compared to 264k of ram etc. The Beaglebone PRU's are closer to the right thing.
- nicoburns 6y agoPresumably for any well-known protocol you'll be able to use a ready-made implementation. Which basically turns them into super-flexible IO modules.
- afandian 6y agoI2S was a blocker for me (ESP32 has a dedicated I2S peripheral). Then I saw this: https://shop.pimoroni.com/products/pico-audio-pack https://shop.pimoroni.com/products/pico-audio-pack So they obviously have a working I2S implementation working (it's not a hard protocol, but great to be shipping with real proofs of concept)