RP2040 and RP2350 notes
RP2040 notes
PWM notes
PIO notes
PIO describes what amounts to multiple separate but extremely simple cores that are tied to GPIO.
There are only nine instructions, and this limits your options, mostly to a state machine.
Mostly usable to push data through, quickly, with well-controlled timing.
There are multiple such cores -- apparently blocks of four (two such blocks in the RP2040, three in the RP2350) which matters in that each block shares
- instruction memory,
- four read ports (which allows some parallel access without blocking)
They cannot communicate data with each other, but they can synchronize (down to the cycle?(verify)) using interrupts, so they can still coordinate to output something more complex.
As it's programmable, you could see it as hardware bit-banging, but without the usual limitation of poor timing and high use of CPU (or interrupts necessarily).
It seems the designers figured we don't need as many dedicated peripherals when we have these - it's already been seen to used to talk
- more UART
- more I2C
- more SPI
- I2S
- neopixels
- small LCD panels
- VGA,
- Arbitrary waveform generator [1]
- additional USB
---
Programmable IO [2]
Each such state machine contains:
- input FIFO, output FIFO (each four 32-bit)
- to communicate to CPU, DMA, etc.
- configurable so that if you only need one direction you can effectively double the size
- PC register
- two scratch registers (32 bit)
- conditions are based on these
- two shift registers (32 bit), in and out
- connected to the FIFOs (towards the CPU)
- can read from GPIOs - and multiple at once
- connected to the FIFOs (towards the CPU)
- clock divider
- IRQ
- alerting CPU
- syncing state machines
- eight flags, four of which are exposed to the CPU
- each instruction takes one cycle
- though each instruction can request up to 31 clocks of idle (takers 5 bits of each 16-bit instruction)
- and WAIT has the job of stalling until a condition is met
- flexible mapping to GPIO pins
- input, output, set, sideset
Docs: https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html