16 ms·
10BASE-T using Raspberry Pi Pico with 2 GPIO pins
- avodonosov 4y agoA similar thing for the Forth chips produced by Chuck More and colleagues: https://www.greenarraychips.com/home/documents/greg/AN007-141112-10BASET.pdf https://www.greenarraychips.com/home/documents/greg/AN007-14...
- francisduvivier 4y agoSooo, with this you can send ethernet packets from a RPI pico? I wonder at which speeds with this setup only using 2 GPIO's.
- Taniwha 4y ago10Mb/s - it's 10BASE-T
- dal 4y agoThe fact that it links up at 10BASE-T does not mean that it can send at wire rate.
- kragen 4y agoThat's exactly what it means. But if you didn't know that you can look at the last oscilloscope screenshot; as you can see, it's set to 200 nanoseconds per division, and it's pumping out bit transitions quite precisely every 50 nanoseconds, and 10BaseT uses Manchester encoding, so that gives you 10 megabits per second.
- OJFord 4y agoI think GP might mean what sort of data throughput would be achievable, but that's also trivially 10Mbps with suitably trivial data, and sending easier than non->/dev/null rx. Really more a question of what you try to make it do with the link, but it would be fun to see it do some very basic routing/firewalli g for example.
- kragen 4y agoHe'll have to get reception working first :)
- magicalhippo 4y agoUsing the PIO you can get some serious speed out of it. Someone made an arbitrary waveform generator[1] reaching 125Msps stock, for example. But you can overclock[2] the Pico up to 420MHz apparently so maybe you can get even more, though not sure if the GPIO drivers can handle that though. [1]: https://www.instructables.com/Arbitrary-Wave-Generator-With-the-Raspberry-Pi-Pic/ https://www.instructables.com/Arbitrary-Wave-Generator-With-... [2]: https://www.youtube.com/watch?v=G2BuoFNLoDM https://www.youtube.com/watch?v=G2BuoFNLoDM
- nousermane 4y agoIf you want to communicate with standard Ethernet gear, that would be either 10Mbit/s exactly (10BASE-T standard) and 100Mbit/s exactly (100BASE-TX standard). OP implemented 10BASE-T here. Next step up is 100BASE-TX, which nobody did in software/bit-bang as of yet, as far as I'm aware - part of the reason it's fairly large jump in complexity. Namely, you'd need 3 analog voltage levels, as well as pretty hairy digital scrambling/encoding, to output 100BASE-TX. RPi-pico might just be able to eek that out with few external resistors and enough elbow grease. Other reason nobody bothered with bit-bang 100BASE-TX - virtually all switches will happily down-negotiage to 10BASE-T, which gives you ~1.2MB/s, and that's plenty fast enough for a microcontroller with mere kilobytes of RAM.
- giomasce 4y agoIs "register" instead of "resistor" just a typo, or is that word really used in this context?
- magicalhippo 4y agoIt's a typo, you can clearly see the three resistors in the image as well.
- tecleandor 4y agoI think it's a typo from japanese. I think 'register' and 'resistor' can be written the same or very similar in katakana ( レジスター ) and it can be confusing. So it's resistor.
- protecto 4y agoLWIP [1] could be used for this. You'd just need to implement I/O. [1]: https://www.nongnu.org/lwip/ https://www.nongnu.org/lwip/
- nigrioid 4y agocnlohr did something similar with an ATTiny85: https://www.youtube.com/watch?v=mwcvElQS-hM https://www.youtube.com/watch?v=mwcvElQS-hM https://www.youtube.com/watch?v=m4f4OzEyueg&t=0s https://www.youtube.com/watch?v=m4f4OzEyueg&t=0s Pretty amazing!
- nousermane 4y agoIgor Cesko did probably the first widely-known implementation of bit-banged 10BASE-T, in 2004: https://web.archive.org/web/20110312185808/http://members.chello.cz:80/cesko/IgorPlugUDP/IgorPlug-UDP%20(AVR)_eng.htm https://web.archive.org/web/20110312185808/http://members.ch... Although, one should note that both Igor & Charles did that purely in software, while OP's project is using PIO machinery, so it's strictly speaking not the same thing.
- k1w1 4y agoBack in 1999 we built a 100% bit-banged software implementation of 10BASE-T including all of the stack up to UDP & TCP. It was a demonstration project to show off the performance of the 50MHz/50MIPS Scenix microcontroller. By the time it was commercialized in 2001 the PHY had moved into hardware, but the Ethernet MAC functionality was still software. https://www.ic72.com/pdf_file/i/428749.pdf https://www.ic72.com/pdf_file/i/428749.pdf It is funny to see now that we named the chip IP2022 ... IIRC I don't think we were thinking that it was so futuristic it represented what the year 2022 would look like.
- ajsnigrutin 4y agoDoing it on a ATTiny85 is a lot more impressing than doing it on a "larger" microcontroller :)
- bluGill 4y agoIn some ways it is less though, as the larger CPU on the pi has things like cache that mess with your timing, while with the smaller CPUs you can lookup exactly how long each instruction will take and thus get the timing right. In the end though, both are very impressive, the hardware just gives different challenges to work with. edit, reading more I realized the pi pico isn't doing this on the main cpu, but on the PIC (which isn't on a normal pi I think). I have no idea what that is able to do, but it changes the above.
- LAC-Tech 4y agoCan someone explain to me what I'm looking at it?
- formerly_proven 4y ago10BASE-T = 10 Mbit/s Ethernet. 10G/2.5G/1G/100 Ethernet are all backwards compatible so 10BASE-T is the slowest/simplest Ethernet standard that you can implement today and just plug into just about anything. This is transmit only, so it's pretty much limited to broadcasts (can't do ARP). That's good enough for e.g. sensors.
- LAC-Tech 4y agoI need more context. Is a micro-controller able to broadcast through an ethernet port something remarkable? Obviously this upvoted enough that it's causing a buzz, but I'm not an embedded guy and don't really understand why.
- baq 4y agoyes, because it's implemented 100% in software, no dedicated computing/networking hardware (resistors don't count)
- actionfromafar 4y agoIt's not through an Ethernet port, that's the interesting part. :)
- ZiiS 4y ago"Micro-controller" is a very wide term. Today it is applied to many things that would have been a good desktop computer only 20 years ago. As you surmise it is not at all impressive that they can talk on the network (may have hardware that fully supports current generation wired and wireless networking) The Pi Pico is quite a simple micro controller, similar to the 1980s hardware that would have actually used 10BASE-T. The impressive bit is it fully software except 3 resistors; rather then having dedicated hardware.
- 4y ago
- hnewsum 4y agoPretty neat. I wonder how much noise those lines can handle.
- CTDOCodebases 4y agoI read the this as 10GBASE-T and for a brief moment in time my whole world turned upside down.
- intothemild 4y agoSame. But still... 10BASE-T with 2 wires is a hell of an achievement.. Now 10GBASE-T with two wires, is the "Dark Souls on Bongo Drums" of networking.
- throwawaylinux 4y ago10BASE-T only uses 2 wires to xmit doesn't it?
- Moto7451 4y agoYes, and 100BASET as well.
- squarefoot 4y ago10BASE-T and 100BASE-T require 2 wires to transmit and 2 wires to receive, 4 wires total. Actually it is better to call them 2 pairs since it's a balanced arrangement in which each pair signals come and go in reverse phase from the interface transformers and wires of each pair are twisted together so that any picked up noise can be canceled out. 1000BASE-T (Gigabit Ethernet) uses all four pairs, that is, all eight wires of a CATx cable.
- pantalaimon 4y agoThere is also 10BASE-T1 and 100BASE-T1 which only requires a single twisted pair for transmit and receive.
- camkego 4y agoAnd, as a earlier poster explained, there is 10GBASE-T1, which is 10G over a single pair! Wow! Who knew!? "The 88Q4364 is manufactured using a standard digital CMOS process and contains all the active circuitry required to implement the physical layer functions to transmit and receive data on a single balanced twisted pair." https://www.marvell.com/content/dam/marvell/en/public-collateral/automotive-solutions/marvell-88q4364-automotive-product-brief.pdf https://www.marvell.com/content/dam/marvell/en/public-collat...
- deleted 4y ago[deleted]
- jandrese 4y agoOh wow, this is was earlier in development than I was expecting. Literally just banging out the bits on the wire for a UDP packet without any underlying protocol support. No CSMA/CA. No ARP. No autonegotiation. Can't even receive. Just enough support to calculate the checksums and do the Manchester encoding before clocking the bits out on the wire.
- deleted 4y ago[deleted]
- CodeWriter23 4y agoAhem. CSMA/CD. 10BaseT implies wired connection.
- GeorgeTirebiter 4y agoI think I'd rather have such a project report 'early' than wait till it's supporting a web server via those 2 pins... ..because, now, YOU can whip up the Receive end, eh? ;-)
- CodeWriter23 4y ago/CD requires receiving while transmitting, which is probably going to get really complicated in software when trying to precisely time GPIO pulses at .1us intervals on a 133Mhz CPU. Probably need to add an external latch + carrier sense circuit to assert a collision signal. Side note, I do love the Firesign Theater reference, Mr. Tirebiter.
- jhallenworld 4y agoShould be able to run CANbus also, here we go, someone did it: https://github.com/kentindell/canhack https://github.com/kentindell/canhack
- synergy20 4y agoRP2040 is an amazing MCU, I'm unaware of any other similar MCU has a programmable PIO module. Based on the Ethernet and previous HDMI work done to this chip, I'm to write my own I3C master/slave on it soon, should be doable.
- MobiusHorizons 4y agoYou can often do similar things with timers and dma or a serial device. It isn’t as easy as the PIO model is more familiar for people who are used to thinking in terms of code running, but timers in combination with gpio can be crazy powerful.
- rasz 4y agoSoftware peripherals were popular in the nineties when using Scenix 50MHz PIC clones https://hackaday.com/2022/08/17/chips-remembered-the-scenix-ubicom-parallax-sx/ https://hackaday.com/2022/08/17/chips-remembered-the-scenix-... In 2006 we got 8 core risc chips running at 80MHz. 0.25 IPC = 160MIPS https://en.wikipedia.org/wiki/Parallax_Propeller https://en.wikipedia.org/wiki/Parallax_Propeller in 2008 XMOS xCORE came out, instead of 8 cores in parallel you get 1-2 CPU tiles running at 400-500MHz partitioned into 4-16 virtual cores. 1 IPC = 1000MIPS. 1 cycle IO. Super popular in audio devices where it bitbangs all sort of serial audio interfaces while performing DSP. Newer models have DSP instructions, and the newest ones might even have something for NNs. "Each tile has 8 active logical cores, which issue instructions down a shared four stage pipeline. Instructions from the active cores are issued round-robin. If up to four logical cores are active, each core is allocated a quarter of the processing cycles." https://www.xmos.ai/download/XS1-L16A-128-QF124-Datasheet(1.7).pdf https://www.xmos.ai/download/XS1-L16A-128-QF124-Datasheet(1.... 2012 TI sitara AM335x (beaglebone black) has dedicated IO cores.
- synergy20 4y agoFirst time heard about Scenix/Prallax_Propeller. Maybe it's more complex for DIYers or not as well-known as Raspberry Pi? AM335X has PRUs yes, but it's not MCU anymore.
- squarefoot 4y agoA word of caution: this has been done with other uControllers in the past; nothing wrong with it from a functional point of view, but be aware that the lack of transformers means the boards i/o pins aren't insulated from whatever it's connected to them; any wrong connection by mistake or static charges in case of a long cable could damage the chip forever. The best and safest use i can imagine of a transformerless arrangement would be a cluster of Pi Picos all mounted on a backplane containing a Ethernet switch chip; in that situation they would share the same power supply and ground so a simple level translation where necessary would be enough, and probably a total of two wires could be used for transmission and receive since balanced signals wouldn't be needed anymore.
- amelius 4y agoYou could use opto-couplers too for isolation.
- nousermane 4y agoOr capacitors, as well. Keep in mind though, that even 10BASE-T works with high enough of a frequency, that you need to think about impedance matching and line termination. And 3 galvanic isolation options (transformer, optocoupler, capacitor) all have very different impedance characteristics. For optocoupler that impedance is moreover voltage-dependent - i.e. that part is non-linear. Yikes. Say hello to harmonics.
- deleted 4y ago[deleted]
- arcticbull 4y agoPeer comment explained why this is almost certainly a bad choice - not to mention you'd need some pretty specialized optocouplers to even operate at that high a frequency - so I suggest getting a receptacle with integrated magnetics. Ideally on a nice little breakout board like this SparkFun MagJack breakout board. [1] Plus this way you can hook up a couple extra GPIOs and make the lights blink when the magic is happening. [1] https://www.sparkfun.com/products/13021 https://www.sparkfun.com/products/13021
- bcrl 4y agoThis is also possible using GPIOs on an FPGA as well. Have a look over at FPGA4Fun: https://www.fpga4fun.com/10BASE-T.html https://www.fpga4fun.com/10BASE-T.html 10base-T is such a simple protocol, and implementing it is a good way to learn many of the physicaly layer fundamentals of Ethernet.
- EddySchauHai 4y agoWas hoping that said 10GB - need a couple 10GB devices for load testing a network lab if anyone has any cheap suggestions :)
- sylwester 4y agoThe other repository seems more interesting (can someone translate?) https://github.com/kingyoPiyo/RasPico_SHIBAKI_Board https://github.com/kingyoPiyo/RasPico_SHIBAKI_Board This seems to be SFP with Raspberry Pico.
- jhallenworld 4y agoThe funniest Ethernet system I've seen is that used in dataprobe's "iBoot" remote power switch. These used 8051 microcontroller (the classic 40-pin DIP) connected to an ISA-bus FIFO-based 10/100 Ethernet chip using GPIOs. The FIFO saves you since the 8051 doesn't have to keep up with the line rate (one whole packet has to fit in the FIFO). But I know these devices fail when the network is chatty- like if you have spanning-tree enabled. The iBoot has a simple web interface. Somebody wrote an entire network stack for 8051..
- nousermane 4y agoHooking up an ISA Ethernet card (or chips designed to go into one) to an 8051 (and later, AVR) was actually the go-to way to do "internet of things" back in the day. Then ENC28J60 came along, and things got much easier.
- ISL 4y agoThe transformer-coupling of Ethernet isn't a trivial fact. When building precision instrumentation, I was extremely happy to learn about this from one of our old-timers who had been working on systems since the days of the VAX. You need not worry about DC ground-loops with Ethernet. When I saw the post-title, I thought, "oh, no, what about the transformer-coupling?". Was very happy to see a simple technique outlined in the article.