Bit-Banged Ethernet On The Raspberry Pi Pico

Whilst the Raspberry Pi RP2040 is quite a capable little chip, on the whole it’s nothing really special compared to the big brand offerings. But, the PIO peripheral is a bit special, and its inclusion was clearly a masterstroke of foresight, because it has bestowed the platform all kinds of capabilities that would be really hard to do any other way, especially for the price.

Our focus this time is on Ethernet, utilizing the PIO as a simple serialiser to push out a pre-formatted bitstream. [kingyo] so far has managed to implement the Pico-10BASE-T providing the bare minimum of UDP transmission (GitHub project) using only a handful of resistors as a proof of concept. For a safer implementation it is more usual to couple such a thing magnetically, and [kingyo] does show construction of a rudimentary pulse transformer, although off the shelf parts are obviously available for this. For the sake of completeness, it is also possible to capacitively couple Ethernet hardware (checkout this Micrel app note for starters) but it isn’t done all that much in practice.

Inside the expedient pulse transformer.

UDP is a simple Ethernet protocol for transferring application data. Being connection-less, payload data are simply formatted into a packet buffer up front. This is all fine, until you realize that the packets are pretty long and the bitrate can be quite high for a low-cost uC, which is why devices with dedicated Ethernet MAC functionality have a specific hardware serialiser-deserialiser (SERDES) block just for this function.

Like many small uC devices, the RP2040 does not have a MAC function built in, but it does have the PIO, and that can easily be programmed to perform the SERDES function in only a handful of lines of code, albeit only currently operating at 10 MBit/sec. This will cause some connectivity problems for modern switch hardware, as they will likely no longer support this low speed, but that’s easily solved by snagging some older switch hardware off eBay.

As for the UDP receive, that is promised for the future, but for getting data out of a remote device over a wired network, Pico-10BASE-T is a pretty good starting point. We’ve seen a few projects before that utilize the PIO to generate high speed signals, such as DVI, albeit with a heavy dose of overclocking needed. If you want a bit more of an intro to all things Pico, you could do worse than check out this video series we highlighted a while back.

Eight RS232 Ports, One Ethernet Port

When it comes to impromptu enclosures, [Paul Wallace] is a man after our own hearts, for his serial-to-Ethernet converters allowing him to control older test equipment were housed in takeaway curry containers. Once the test equipment pile had grown it became obvious that a pile of curry containers was a bit unwieldy, even if the curry had been enjoyable, so he set about creating an all-in-one multiway serial to Ethernet box.

Reminiscent of the serial terminal access controllers that were found in dumb terminal sites back in the day, it’s a box with eight DB-9 connectors for serial ports and a single RJ45 Ethernet port. Inside is a Teensy 4.1 which packs a PHY and eight hardware serial ports, and a pile of MAX232 level converter modules. These have a small modification to wire in the CTS and RTS lines, and the whole is clothed in a custom 3D printed case.

The result is a very neat, almost commercial standard box that should save him quite a bit of space. Not everyone has eight devices to drive, so if you have just one how about using an ESP8266?

Receiver board of the Ethernet tester, with only probing pins, and no resistors populated

Ethernet Tester Needs No LEDs, Only Your Multimeter

Ethernet cable testers are dime a dozen, but none of them are as elegant and multimeter-friendly as this tester from our Hackaday.io regular, [Bharbour]. An Ethernet cable has 8 wires, and the 9 volts of easily available batteries come awfully close to that – which is why the board has a voltage divider! On the ‘sender’ end, you just plug this board onto the connector, powered by a 9 volt battery. On the “receiver” end, you take your multimeter out and measure the testpoints – TP7 should be at seven volts, TP3 at three volts, and so on.

As a result, you can easily check any of the individual wires, as opposed to many testers which only test pair-by-pair. This also helps you detect crossover and miswired cables – while firmly keeping you in the realm of real-life pin numbers! This tester is well thought-out when it comes to being easily reproducible – the PCB files are available in the “Files” section, and since the “receiver” and “sender” PCBs are identical, you only need to do a single “three PCBs” order from OSHPark in order to build your own!

Bharbour has a rich library of projects, and we encourage you to check them out! If you ever want to get yourself up to speed on Ethernet basics, we’ve talked about its entire history – and we’ve even explained PoE! After some intensive learning time, perhaps you can try your hand at crimping the shortest Ethernet cable ever.

Tiny Ethernet Cable Arms Race Spawns From Reddit Discussion

If you’ve had any dealings with Cat 5 and Cat 6 cable, and let’s be honest, who hasn’t, you’ve probably wrestled with lengths anywhere from 1 meter to 25 meters if you’re hooking up a long haul. Network admins will be familiar with the 0.1 m variety for neat hookups in server cabinets. However, a Reddit community has recently taken things further.

It all started on r/ubiquiti, where user [aayo-gorkhali] posted a custom-built cable just over 2 inches long. The intention was to allow a Ubiquiti U6-IW access point to be placed on a wall. The tiny cable was used to hook up to the keystone jack that formerly lived in that position, as an alternative to re-terminating the wall jack into a regular RJ45 connector.

Naturally this led to an arms race, with [darkw1sh] posting a shorter example with two RJ-45 connectors mounted back to back with the bare minimum of cable crimped into the housings. [Josh_Your_IT_Guy] went out the belt sander to one-up that effort, measuring just over an inch in length.

[rickyh7] took things further, posting a “cable” just a half-inch long (~13 mm). In reality, it consists of just the pinned section of two RJ-45 connectors mounted back to back, wired together in the normal way. While electrically it should work, and it passes a cable tester check, it would be virtually impossible to actually plug it into two devices at once due to its tiny length.

We want to see this go to the logical end point, though. This would naturally involve hacking away the plastic casings off a pair of laptops and soldering their motherboards together at the traces leading to the Ethernet jack. Then your “cable” is merely the width of the solder joint itself.

Alternatively, you could spend your afternoon learning about other nifty hacks with Ethernet cables that have more real-world applications!

Hackaday Links Column Banner

Hackaday Links: January 23, 2022

When Tonga’s Hunga-Tonga Hunga-Ha’apai volcano erupted on January 15, one hacker in the UK knew just what to do. Sandy Macdonald from York quickly cobbled together a Raspberry Pi and a pressure/humidity sensor board and added a little code to create a recording barometer. The idea was to see if the shock wave from the eruption would be detectable over 16,000 km away — and surprise, surprise, it was! It took more than 14 hours to reach Sandy’s impromptu recording station, but the data clearly show a rapid pulse of increasing pressure as the shockwave approached, and a decreased pressure as it passed. What’s more, the shock wave that traveled the “other way” around the planet was detectable too, about seven hours after the first event. In fact, data gathered through the 19th clearly show three full passes of the shockwaves. We just find this fascinating, and applaud Sandy for the presence of mind to throw this together when news of the eruption came out.

Good news for professional astronomers and others with eyes turned skyward — it seems like the ever-expanding Starlink satellite constellation isn’t going to kill ground-based observation. At least that’s the conclusion of a team using the Zwicky Transient Facility (ZTF) at the Palomar Observatory outside San Diego. ZTF is designed to catalog anything that blinks, flashes, or explodes in the night sky, making it perfect to detect the streaks from the 1,800-odd Starlink satellites currently in orbit. They analyzed the number of satellite transients captured in ZTF images, and found that fully 20 percent of images show streaks now, as opposed to 0.5 percent back in 2019 when the constellation was much smaller. They conclude that at the 10,000 satellite full build-out, essentially every ZTF image will have a streak in it, but since the artifacts are tiny and well-characterized, they really won’t hinder the science to any appreciable degree.

Speaking of space, we finally have a bit of insight into the causes of space anemia. The 10% to 12% decrease in red blood cells in astronauts during their first ten days in space has been well known since the dawn of the Space Age, but the causes had never really been clear. It was assumed that the anemia was a result of the shifting of fluids in microgravity, but nobody really knew for sure until doing a six-month study on fourteen ISS astronauts. They used exhaled carbon monoxide as a proxy for the destruction of red blood cells (RBCs) — one molecule of CO is liberated for each hemoglobin molecule that’s destroyed — and found that the destruction of RBCs is a primary effect of being in space. Luckily, there appears to be a limit to how many RBCs are lost in space, so the astronauts didn’t suffer from complications of severe anemia while in space. Once they came back to gravity, the anemia reversed, albeit slowly and with up to a year of measurable changes to their blood.

From the “Better Late Than Never” department, we see that this week that Wired finally featured Hackaday Superfriend Sam Zeloof and his homemade integrated circuits. We’re glad to see Sam get coverage — the story was also picked up by Ars Technica — but it’s clear that nobody at either outfit reads Hackaday, since we’ve been featuring Sam since we first heard about his garage fab in 2017. That was back when Sam was still “just” making transistors; since then, we’ve featured some of his lab upgrades, watched him delve into electron beam lithography, and broke the story on his first legit integrated circuit. Along the way, we managed to coax him out to Supercon in 2019 where he gave both a talk and an interview.

And finally, if you’re in the mood for a contest, why not check out WIZNet’s Ethernet HAT contest? The idea is to explore what a Raspberry Pi Pico with Ethernet attached is good for. WIZNet has two flavors of board: one is an Ethernet HAT for the Pico, while the other is as RP2040 with built-in Ethernet. The good news is, if you submit an idea, they’ll send you a board for free. We love it when someone from the Hackaday community wins a contest, so if you enter, be sure to let us know. And hurry — submissions close January 31.

Ethernet Cable Turned Into Antenna To Exploit Air-Gapped Computers

Good news, everyone! Security researcher [Mordechai Guri] has given us yet another reason to look askance at our computers and wonder who might be sniffing in our private doings.

This time, your suspicious gaze will settle on the lowly Ethernet cable, which he has used to exfiltrate data across an air gap. The exploit requires almost nothing in the way of fancy hardware — he used both an RTL-SDR dongle and a HackRF to receive the exfiltrated data, and didn’t exactly splurge on the receiving antenna, which was just a random chunk of wire. The attack, dubbed “LANtenna”, does require some software running on the target machine, which modulates the desired data and transmits it over the Ethernet cable using one of two methods: by toggling the speed of the network connection, or by sending raw UDP packets. Either way, an RF signal is radiated by the Ethernet cable, which was easily received and decoded over a distance of at least two meters. The bit rate is low — only a few bits per second — but that may be all a malicious actor needs to achieve their goal.

To be sure, this exploit is quite contrived, and fairly optimized for demonstration purposes. But it’s a pretty effective demonstration, but along with the previously demonstrated hard drive activity lights, power supply fans, and even networked security cameras, it adds another seemingly innocuous element to the list of potential vectors for side-channel attacks.

[via The Register]

Cable Modem Turned Spectrum Analyzer

Hopefully by now most of us know better than to rent a modem from an internet service provider. Buying your own and using it is almost always an easy way to save some money, but even then these pieces of equipment won’t last forever. If you’re sitting on an older cable modem and thinking about tossing it in the garbage, there might be a way to repurpose it before it goes to the great workbench in the sky. [kc9umr] has a way of turning these devices into capable spectrum analyzers.

The spectrum analyzer feature is a crucial component of cable modems to help take advantage of the wide piece of spectrum that is available to them on the cable lines. With some of them it’s possible to access this feature directly by pointing a browser at it, but apparently some of them have a patch from the cable companies to limit access. By finding one that hasn’t had this patch applied it’s possible to access the spectrum analyzer, and once [kc9umr] attached some adapters and an antenna to his cable modem he was able to demonstrate it to great effect.

While it’s somewhat down to luck as to whether or not any given modem will grant access to this feature, for the ones that do it seems like a powerful and cheap tool. It’s agnostic to platform, so any computer on the network can access it easily, and compared to an RTL-SDR it has a wider range. There are some limitations, but for the price it can’t be beat which will cost under $50 in parts unless you happen to need two inputs like this analyzer .

Thanks to [Ezra] for the tip!