←back to thread

263 points chaosprint | 5 comments | | HN request time: 0.835s | source
Show context
unixfg ◴[] No.45754629[source]
Would this have been possible without PIO?
replies(2): >>45754766 #>>45755273 #
codebje ◴[] No.45755273[source]
On a Pico? No - the PIOs replace other peripherals a µC might be able to use to achieve this sort of bitrate, so you'd not really have the tools you'd need to change GPIO pin states once every 3-4 CPU clock cycles.

In a sense the PIO is a bit 'cheaty' when claiming "bit-banging", because the PIO is the ultimate peripheral, programmable to be whatever you need. It's no mean feat to make the PIO do the sorts of things happening here, by any stretch, but "bit-banging" typically means using the CPU to work around the lack of a particular peripheral.

From that perspective, there's precious few µCs out there that could bit-bang 100MBit/s Ethernet - I'm no expert, but I _think_ that's a 125MHz IO clock, so if you want 4 CPU cycles per transition to load data and push it onto pins, you're looking for a 500MHz µC, and at those speeds you definitely have to worry about the bus characteristics, stalls, caching, and all those fun bits; it's not your old 8-bit CPU bit-banging a slow serial protocol over the parallel port any more.

replies(5): >>45755402 #>>45755789 #>>45756583 #>>45757107 #>>45767713 #
kfterrg67 ◴[] No.45755402[source]
>"bit-banging" typically means using the CPU

This is significant. It's using a hardware peripheral that is designed and intended for high frequency IO manipulation without CPU intervention. This isn't bit-banging, lest we start calling it "bit-banging" any time an FPGA or ASIC or even a microcontroller peripheral handles any kind of signalling.

replies(1): >>45756116 #
1. ssl-3 ◴[] No.45756116[source]
It's a programmable hardware peripheral runs compiled software to toggle pins in a way that is entirely defined by that software.

Here, it runs software that allows it to talk 100mbps Ethernet.

Someone else might use that same hardware peripheral to drive a display, or produce a PWM output, or whatever.

The RP PIOs just run software. That software can bang bits.

replies(2): >>45756174 #>>45756544 #
2. picture ◴[] No.45756174[source]
Yeah but like FPGA fabric can also be programmed (sometimes by actual software like on Zynq or Stratix SoCs), would you call those bit banging too?
replies(2): >>45756371 #>>45757712 #
3. ssl-3 ◴[] No.45756371[source]
I don't have any hands-on experience with FPGAs. I only know about as much about FPGAs as I do about red herring.
4. Dylan16807 ◴[] No.45756544[source]
Technically it's running software on the programmable I/O, but that software is just a loop of four outputs that advances when it gets a 1 bit and doesn't advance when it gets a 0 bit. It feels like the hardware that manages the buffer and turns it into a high speed serial stream is doing the more important work here.

And the CPU that's actually deciding on the bits doesn't have to bang them with precise timing, it just has to put them into that buffer.

5. KeplerBoy ◴[] No.45757712[source]
I feel most people would unless you use some Hard IP for the interface. Like you don't bit-bang PCIe when you feed a wide AXI stream at a few MHz into the PCIe block where it get's serialized and put onto the lanes at the signalling rate (multiple Gigahertz, depending on generation).