6 ms·
Raspberry Pi Pico Bit-Bangs 100 Mbit/S Ethernet
- ChuckMcM 1y agoFun stuff. You kids don't know how lucky you are to have really capable MCU's for just a few bucks. :-) It is kind of the ultimate "not a TOE[1]" example yet. [1] TOE or TCP Offload Engine was a dedicated peripheral card that implements both the layer 1 (MAC), layer 2 (Ethernet), and layer 3 (IP) functions as a co-processing element to relieve the 'main' CPU the burden of doing all that.
- nine_k 1y agoDon't modern NICs do a lot of the same, too?
- tyingq 1y agoSometimes it goes the other direction. PCI SSL accelerator cards were a thing for a long time before CPUs got faster, got various crypto acceleration opcodes, web servers rewrote SSL logic in ASM, etc.
- lillecarl 1y agoThe fancy Mellanox NVIDIA Connect-X cards have kTLS support which offloads encryption to the NIC, Netflix has blogged about how they use it to send 100 Gbps encrypted traffic of a single box (Their OpenConnect infrastructure is really cool). Old is new again :)
- kragen 1y agoOr just a few cents! Possibly that will only last until war in Taiwan, though, or until it becomes impossible to find anything but counterfeits.
- 4gotunameagain 1y agoUncertain. The cheap, mass produced commodity ICs are built with "ancient" nodes with high yields.
- kragen 1y agoI think that's probably true for Padauk's PFS150 and similar, but I think the 14¢ https://www.lcsc.com/product-detail/Microcontrollers-MCU-MPU-SOC_WCH-Jiangsu-Qin-Heng-CH32V003A4M6_C5346357.html https://www.lcsc.com/product-detail/Microcontrollers-MCU-MPU... and the 9¢ https://www.lcsc.com/product-detail/Microcontrollers-MCU-MPU-SOC_PUYA-PY32F002BD15S6TU_C7469097.html https://www.lcsc.com/product-detail/Microcontrollers-MCU-MPU... are probably fabbed in more recent nodes. And of course the counterfeit problem has very little to do with what node is used to produce the chips; it's a question of how effective your society's institutions are at keeping fraud under control.
- Dylan16807 1y agohttps://zeptobars.com/en/read/wch-ch32v003-risc-v-riscv-microcontroller-10-cent https://zeptobars.com/en/read/wch-ch32v003-risc-v-riscv-micr... This page estimates 90nm for the CH32V003, and I found another post very roughly estimating 130nm. And a pi pico isn't all that fancy either at 40nm. And should I be very worried about counterfeit microcontrollers? It seems like a lot of effort, and like it would probably still work.
- kragen 1y agoThere are different levels of "counterfeit". There's the clearly labeled and advertised GD32F103 style clone which is pin-compatible, supports higher clock speeds than the original STM32F103, but takes much longer to power on and has different analog characteristics, maybe some worse; not a problem. There's the potential case where somebody sells you a GD32 telling you it's an STM32, either with the proper markings, with the markings sanded off, or with actually fake markings. This still might cause no problems, or might result in a problem that takes you a long time to track down. (Maybe you're unknowingly relying on, say, the hypothetical lower power consumption of a clone, so when you fab a batch with real STM32s, the product's battery life goes to shit.) You can detect this in firmware and may be able to come up with workarounds. Or, if your vendor is FTDI, they may sneak malware into their Microsoft Windows driver and brick your products months or years after you've sold them. They've done it twice. There's the case where the clone is designed to act as much like the original as possible, so maybe you can't detect the substitution in firmware and can't work around whatever problems the counterfeit is causing. Then there's the case where you ordered 10,000 STM32s in a QFN-32 and got 10,000 QFN-32s that say "STM32" on them but are actually PICs with a totally different pinout, or SRAM, or something else. These will not probably still work.
- hunta2097 1y agoI can't get my head around it sometimes. I know most end up doing duties that a PIC-chip could do but the fact you can get a WiFi enabled microcontroller few a few bucks blows my mind. The IO co-processing on the Pico is so powerful, I hope they expand on this.
- nerdsniper 1y agoIt's also not really clear that using some of the more powerful chips for simple things is really a "waste" in any reasonable sense of the word. The packaging of a PIC/CH32 is probably the majority of its cost and environmental "footprint". An RP2040 is not much more physical material. An ESP8266/ESP32 is rather bit more material, but still not egregious.
- projektfu 1y agoThe big waste is battery power, which for many hobby things is not that important. For comparison, RP2040 quiescent current is like 400μA, FRAM MSP430 is approximately 0.1μA in interruptible sleep.
- HeyLaughingBoy 1y agoRight? Especially when I remember paying $20 each for an 8-bit microcontroller with less than 1k EPROM.
- torben-friis 1y ago>Fun stuff. You kids don't know how lucky you are to have really capable MCU's for just a few bucks. :-) Any suggestions for people not used to tinkering with hardware? I would like to play I think, but I have a lack of imagination regarding potential projects/goals.
- bux93 1y agoI have plenty of ideas, I'm just super lazy! I'd like to hook up a rain sensor to a skylight to close it when it rains (needs a little motor, too), and then also hook it up to weather forecasts. I currently have to switch on my TV, surround set and a laptop, and then push multiple buttons to switch to/from a firestick. I'd like to automate that, so I can just switch it on/off and switch the source easily. Also if the system is in an unknown state (tv on, but using the incorrect HDMI input and the surround set if switched off, etc.), which is what the naive solution using a "fingerbot" and a IR blaster hooked up to godawful tuya stuff doesn't do. Build a GPS-synchronized flip clock. Add remote control door opening without destroying my flat's intercom system. Mostly kinda boring home automation stuff, but would be worth it for tinkering.
- ficklepickle 1y ago> Add remote control door opening without destroying my flat's intercom system. Oh hey, I made that[0] at a previous apartment! It sat on my LAN and I'd VPN in if I was out of wifi range. I struggle to find time/motivation for stuff like that these days. I was contracting back then and had downtime between jobs. [0] https://github.com/jeremy21212121/doorman-building-arduino https://github.com/jeremy21212121/doorman-building-arduino
- samarthr1 1y agoAs someone who is only mildly bullish about AI, my hope is that such ultra custom HA will be more common, and no longer limited fo the 0.1% and software engineers.
- ChuckMcM 1y agoI can recommend a 'Hacker Boxes'[1] subscription. It's $44/month currently, every month you'll get all the parts to build some gizmo or project and a full list of instructions. The prerequisites are that you know how to solder and have a soldering iron, and have a computer you can run the Arduino IDE on (even a Raspberry Pi can do that these days). If you don't know how to solder the Hacker Boxes folks have a soldering workshop kit that includes an iron[2], but many maker spaces will do soldering clinics. Soldering irons are available as cheap[3] and more expensive[4] (and ludicrous[5]). The Arduino IDE runs on pretty much anything (Linux, MacOS, Windows). [1] https://hackerboxes.com/ https://hackerboxes.com/ [2] Soldering Workshop --- https://hackerboxes.com/collections/subscriptions/products/soldering-workshop https://hackerboxes.com/collections/subscriptions/products/s... [3] $13 iron from Amazon --- https://www.amazon.com/dp/B09DY7CCW5 https://www.amazon.com/dp/B09DY7CCW5 [4] ~$150 soldering station --- https://www.amazon.com/dp/B077JDGY1J?th=1 https://www.amazon.com/dp/B077JDGY1J?th=1 [5] $1000+ Metcal station --- https://www.qsource.com/itemdetail/?itemCode=MX-5210-M020 https://www.qsource.com/itemdetail/?itemCode=MX-5210-M020
- unixfg 1y agoWould this have been possible without PIO?
- tylerflick 1y agoNot at that transfer rate. SPI which is the next fastest (common) protocol you find on micros typically operates around 10 Mhz, but this isn’t an apples to apples comparison.
- codebje 1y agoOn 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.
- kfterrg67 1y ago>"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.
- ssl-3 1y agoIt'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.
- hackingonempty 1y agoPIO is great but the competition has working silicon and SDK for all of the common peripherals while RP gives you crappy example code. Want to connect to an audio codec with I2S? Almost every MCU has this built in but for RP2040/RP2350 you'll have to roll your own production quality version from a demo that only shows how to send. Years after release.
- bschwindHN 1y agoHere you go, I2S output: https://github.com/bschwind/rp2040-i2s/blob/e1d5647704b03ad1dd7200db9ba9ab4759bf38ca/src/lib.rs#L90-L100 https://github.com/bschwind/rp2040-i2s/blob/e1d5647704b03ad1... And I2S input: https://github.com/bschwind/rp2040-i2s/blob/e1d5647704b03ad1dd7200db9ba9ab4759bf38ca/src/lib.rs#L173-L183 https://github.com/bschwind/rp2040-i2s/blob/e1d5647704b03ad1... The RP2040 has great documentation and the PIO is an amazing swiss army knife of a peripheral. I've had no trouble learning from their datasheet and docs and making plenty of PIO programs.
- yuserx 1y agohttps://github.com/malacalypse/rp2040_i2s_example https://github.com/malacalypse/rp2040_i2s_example
- feisty0630 1y agoIt's almost as if different equipment can serve different purposes...
- einsteinx2 1y agoMaybe totally my fault for being dumb, but the ESP32 has an I2S peripheral and after days combing through docs and web searches I never actually got it working, mostly because it seems to have been barely documented and its usage was by twiddling magic registers etc. I’d say personally some nice example PIO code that I can actually read through, understand, and modify for my needs is actually better…
- hackingonempty 1y ago> I’d say personally some nice example PIO code that I can actually read through, understand, and modify for my needs is actually better… I agree and that's why its disappointing RP still provides half-baked examples instead of real working implementations of the common peripherals other manufacturers are supporting.
- ggm 1y agothis is classic computing wheel of life stuff (Bell, Mudge, MacNamara wrote that up in the 70s) * first you do it in the cpu * then you do it in a dedicated card off the bus * then you find the FPGA or whatever too slow, so you make the card have it's own CPU * then you wind up recursing over the problem, implementing some logic in a special area of the cpu, to optimise its bus to the other bus to ... I expect to come back in 10years and find there is a chiplet which took the rpi core, and implements a shrunk version which can be reprogrammed, into the chiplet on the offload card, so we can program terabit network drivers with a general purpose CPU model.
- kragen 1y agoYeah, this is the Wheel of Reincarnation, but wasn't it Sutherland who wrote that up? And Myer? And in 01968? https://www2.cs.arizona.edu/~cscheid/reading/myer-sutherland-design-of-display-processors.pdf https://www2.cs.arizona.edu/~cscheid/reading/myer-sutherland...
- ggm 1y agoMaybe it was. Bell/mudge/macnamara was the textbook I recalled it from 1979 vintage. I can believe 68 is the original.
- TZubiri 1y agoI understood some of these words
- Twirrim 1y agoWe start out doing things in the CPU, create dedicated hardware for it externally, then slowly but surely bring it closer and closer to the CPU until we end up integrating the specialist capabilities into it. Often these capabilities enable other workloads to be done in the CPU, that we then build dedicated hardware for and the cycle continues. An easy example is the 8087 maths coprocessor, from the early 80s. They were floating point accelerators, a separate chip you could plug into your motherboard, until eventually it was integrated into the CPU (386 and 486 processors had SX and DX variants, DX had the coprocessor integrated)
- brcmthrowaway 1y agoHow does PIO compare to Cypress PSoC?
- deckar01 1y agoPIO is a set of coprocessors designed to offload signal processing. They have to be programmed. PSoC has FPGA like configuration capabilities, but rather than just logic gates it includes larger analog and digital ICs. You can route analog signal processing in and out without hitting a CPU and perform some FPGA like DSP driven by an arbitrary clock signal (also without any CPU usage).
- brcmthrowaway 1y agoThat sounds similar
- deckar01 1y agoA coprocessor sounds similar to an FPGA?
- sitzkrieg 1y agostick with psoc for anything professional
- lukeinator42 1y agoSomething related to this that is really cool is directly reading from PDM microphones using PIO: https://github.com/ArmDeveloperEcosystem/microphone-library-for-pico https://github.com/ArmDeveloperEcosystem/microphone-library-.... This shouldn't be called bit-banging though if it's using PIO.
- wvenable 1y agoI think it still counts as bit-banging -- the PIO just lets you bit-bang faster and in a more limited way.
- userbinator 1y agoand must not be connected to PoE-enabled hardware. I assume passive PoE; or does it also happen to look like a real PoE PD and trick the PSE into turning on?
- moffkalast 1y agoPico's reaction as it sees 48V signals on its 3.3V pins: perfectly cut scream that transitions into an explosion
- Dwedit 1y agoPeople have bit-banged out analog NTSC and PAL video signals before.
- rasz 1y agoGreat hack from very talented hacker. Steve Markgraf is the author of High Speed Data Acquisition over HDMI https://github.com/steve-m/hsdaoh https://github.com/steve-m/hsdaoh Capturing raw data using super cheap USB3 HDMI Video Capture dongles. Up to 175MB/s with Pico2 as the sender https://github.com/steve-m/hsdaoh-rp2350 https://github.com/steve-m/hsdaoh-rp2350 Sadly 100Mbit might be the limit for bitbanging ethernet. While 1Gbit uses easily reachable 125MHz clock it also does full duplex requiring echo cancellation and I dont see an easy way around external PHY. The next PICO challenge is implementing GRMII PHY support for that sweet $1 RTL8211 1Gbit. I havent seen that done yet.
- kragen 1y agoHey, this is fantastic! Thanks!
- kees99 1y ago> 1Gbit uses easily reachable 125MHz clock RGMII uses 4-bit bus, so that would be 250M state transitions per second. Clock signal is 125MHz, yes. But data is sent/sampled at both edges (DDR), so PIO state machine has to be clocked at 250MHz. That's still reachable with mild overclocking, I guess?
- eqvinox 1y agoThis is only talking about TX, presumably it can't receive? That'd be the hard part...
- matthiasl 1y agoRight, it's TX-only. The article says so explicitly halfway through: "As before, this is a transmit-only proof of concept" I didn't notice that on my first reading.
- moffkalast 1y agoAnd here I was thinking I could use a Pico as a USB ethernet dongle in a pinch /s
- eqvinox 1y ago> "As before, this is a transmit-only proof of concept" I didn't spot that at all. Oops/Thanks!
- karlkloss 1y agoOr you could just buy an ESP32 board at about the same price, which already has an integrated Ethernet MAC (besides WiFi). But where would be the fun in that?
- rowanG077 1y agoYou'd still need a Ethernet phy with the esp32 this does that too.
- BertoldVdb 1y agoTo make a compliant ethernet signal from this you would need at least some sort of line driver/receiver as well.
- imtringued 1y agoThat's the best part though. With an external PHY you can use single pair ethernet, which is much more suitable for use in embedded devices. Single pair ethernet directly competes against I2C and CAN, because you only need 2 wires for full duplex 100mbit/1000mbit connectivity. Single pair ethernet also has the massive advantage that it isn't restricted to the garbage RJ45 plugs, which are basically a nightmare in embedded devices.
- ACCount37 1y agoThe problem with Single Pair Ethernet is: nothing supports it. You don't see off the shelf home routers that just so happen to have SPE support in every LAN plug, or USB Ethernet adapters that support SPE alongside the normal 10/100/1000Base-T, or SoCs that integrate an entire SPE PHY. So it ends up stuck in this adoption limbo. The advantage of normal Ethernet is that everyone already has the hardware for it, and SPE doesn't have that advantage.
- amelius 1y agoBut how much juice is left to do useful stuff?
- sherinjosephroy 1y ago[flagged]
- inferiorhuman 1y agoNot quite the same but I was looking at PowerBook G4 specs last night. Apple was doing gigabit ethernet in a mid-priced laptop ($2200 in 2001 dollars) 25 years ago. Meanwhile I'm pretty sure I have some 10baseT gear kicking around.
- majke 1y agoI'm confused. Why is there gnuradio on the screen? The RPI seems to have power (micro usb), TX (two wires to the ethernet port on the laptop), and ... what is the third thing?
- tecleandor 1y agoI think it's the signal they're "converting" to ethernet. That'd be the "digitizing some WBFM IF signal with the internal ADC" part. What I don't know is what's in the signal :P
- junga 1y ago> Raspberry Pi Pico Bit-Bangs 100 Mbit/S Ethernet Per Siemens? I'd prefer Ohm!
- varispeed 1y agoI wish something like Pi Pico existed but with 1GHz clock, DDR3 memory interface and PCIe and few dozens of GPIO.
- thijson 1y agoXilinx Zync have PL for FPGA programmable logic, and PS with a few different ARM cores. They aren't as cheap as a Pi Pico though.
- jononor 1y agoA RPi 4/5 has that? The OMAP 3/4 chips in Beaglebone is another alternative. Or Rockchip/Allwinner SoCs. Those are all Cortex A series though, but that can still be programmed bare metal if one wants. There are also Cortex M microcontrollers with support for SDRAM, like STM32H7. Or one can get an FPGA with DDR support like ECP5.
- ryao 1y agoThis would be a great starting point to make a USB Ethernet NIC if someone were inclined to do it. It could even have a very practical use if it were made to impersonate a USB Ethernet device that the Nintendo Switch / Nintendo Switch 2 supports. They only support gigabit NICs, but it should be easy to just pretend that the other side failed to negotiate gigabit and only supports 100Mbps.
- Doohickey-d 1y agoUnfortunately: > this is a transmit-only proof of concept. So a not-very-useful NIC for your Nintendo switch.
- rldjbpin 1y agoThis is not exactly comparable but to put things in perspective, the original RPi (rev B) could serve at ~6 MB/s over SSH.