When choosing a brand new growth board to your subsequent venture, one of the necessary issues to contemplate is the interfaces that it has obtainable. Can it discuss in SPI? How about UART or I2C? It’s by these interfaces that the board will talk with exterior gadgets, so if the sensor you wish to use doesn’t communicate the identical language as the event board, you’re out of luck.
Nonetheless, should you don’t thoughts doing all of your venture in arduous mode, there’s another choice that ought to all the time be stored in thoughts — bit banging. Similar to it says on the tin, these free GPIO pins are for normal objective use, and that features simulating commonplace communications protocols. So long as the GPIO pins can swap on and off quick sufficient to maintain up with the specs, there’s nothing stopping you from coding up your personal answer to duplicate the sign sample of any current interface.
A few of these interfaces, like UART, should not too terribly troublesome to duplicate. However then there are the powerful ones, like Quick Ethernet, which {hardware} hacker Steve Markgraf simply wrote a bit-banging library for. The communication velocity is sort of quick, making it difficult for normal GPIO pins to maintain up with, however Markgraf bought some assist in that division by utilizing a Raspberry Pi Pico 2. Specialised {hardware} on this board can twiddle the pins at a blazing velocity.
Markgraf’s new library, Pico-100BASE-TX, cleverly exploits the Programmable I/O (PIO) subsystem. Utilizing this subsystem, it could actually stream knowledge at roughly 11 MB/s, successfully making a 100 Mbit/s Ethernet transmitter, totally by bit banging. However if you wish to obtain indicators as properly, you’ll have to look elsewhere — the library has not carried out that functionality.
Packets acquired from the Pico (📷: Steve Markgraf)
With the velocity drawback solved, it was time to implement the protocol. 100BASE-TX Ethernet makes use of MLT-3 encoding, which cycles by three voltage ranges (-1, 0, +1). It additionally depends on 4B5B encoding and scrambling to keep up sign integrity and stop lengthy runs of similar bits. The scrambler makes use of an 11-bit Linear Suggestions Shift Register, precomputed into lookup tables that take up about 10 KB of RAM. With pre-inverted scrambling and a stream of idle symbols, knowledge might be pushed to the PIO totally by DMA, conserving CPU load minimal.
This isn’t totally a plug-and-play Ethernet answer. Connecting a microcontroller on to a community interface designed for specialised PHY chips is a dangerous transfer. Markgraf warns customers not to hook up with any Energy over Ethernet gear and to make use of both a correct pulse transformer or a resistor community for defense. In testing, he discovered {that a} pair of resistors and an outdated Ethernet cable have been generally sufficient, however success various relying on the related {hardware}.
The GitHub repository contains some instance functions like counter, which streams a easy 16-bit worth over UDP, internal_adc for sending analog readings, and pcm1802_audio, which transmits 75 kHz audio from an exterior ADC.
Most individuals can be higher off choosing up an Ethernet HAT for his or her Pico, however in case you are in a rush to get your venture carried out and don’t wish to watch for a brand new element to ship, then Pico-100BASE-TX may be simply what you’re on the lookout for.

