Bitbang Ethernet

Implementation UDP into microcontroller Igor Atmel-UDP device:
UDP/IP infrared remote control
web page shows implementation UDP/IP on firmware level (similar as emulation of RS232 interface or USB interface).

UDP_IP_computer_infrared_remote_control

What makes it really cool is that the ethernet is bitbanged using nothing but the bare pins of an ATMEGA168. The downside is that this Ethernet implementation is 10 Mbit/s transmit-only: it cannot receive network packets. In think this is a cool hack, that could be enough for some projects.

By the way ATMEGA168 is same chip as used on Arduino Diecimila. Maybe this idea could be adapted to Arduino boards as well if the board is modufied for this (Arduino runs on 16 MHz, this circuits needs 20 MHz clock).

If you want a real full standard Ethernet interface that can transmit and receive, you need to use a real Ethernet controller for it (Ethernet chip or interface built into the microcontroller).

8 Comments

  1. Johnb808 says:

    Great, thanks for sharing this blog.Really thank you!

    Reply
  2. Tomi Engdahl says:

    Bit-banging Ethernet On An ATTiny85
    http://hackaday.com/2014/08/29/bit-banging-ethernet-on-an-attiny85/

    [Cnlohr] just published an ingenious but dangerous way to send Ethernet packets using an ATTiny85. The ATtiny directly drives one pair of differential TX wires of a standard Ethernet cable. Doing so will force the TX signal ground to be the same as the ATTiny’s and in some cases may put 48V on your AVR if your cable is plugged into a Power Over Ethernet switch… which may be a problem.

    the microcontroller is clocked at 20Mhz to bit-bang the Manchester encoded electrical signals. Using a neat trick his home switch will detect his platform as a 10MBit Ethernet switch which can then send hard-coded packets to his computer.

    Reply
  3. Tomi Engdahl says:

    A simplex 10Base-T send-only ethernet stack for AVRs
    https://github.com/cnlohr/ethertiny

    This is a really dangerous project. Use at your own risk.

    By directly ethernet without magnetics to an AVR, you may cause serious damage, fire, or anything else crazy if there is a DC offset. It does not follow 802.3 standards for 10Base-T Ethernet.

    You are still responsible for sending the NLP pulses every 16 +/- 8ms.

    Right now, port PB3,PB4 are the TX+/TX- pins. A switch can be connected between PB0 and PB1 and another switch may be connected btween PB2 and PB1.

    Reply
  4. Tomi Engdahl says:

    Implementation UDP into microcontroller Igor Atmel-UDP device:
    UDP/IP infrared remote control
    http://www.cesko.host.sk/IgorPlugUDP/IgorPlug-UDP%20%28AVR%29_eng.htm

    Purpose of this article is to inform readers about implementations UDP protocol (only transmitting) into singlechip microcontroller, which this interface directly not supports. Simply: implementation UDP/IP on firmware level (similar as emulation of RS232 interface in microcontrollers, which not have RS232 support).

    Reply
  5. Tomi Engdahl says:

    Interesting points from http://www.cesko.host.sk/IgorPlugUDP/IgorPlug-UDP%20%28AVR%29_eng.htm

    Device supports only transmitting, because receiving is not possible at this microcontroller speed. Therefore we must use device on full duplex networks only! Otherwise is probability that on network occurs collisions during device transmitting and because device not checks collisions (not receiving), then the transmitted code is not delivered to destination.

    Buffer is transmitted by UDP/IP protocol as broadcast to specified network. Default destination firmware values are:

    destination IP=192.168.1.255 (broadcast to 192.168.1.xxx adresses)
    destination port=6668, source port=6668
    destination MAC=FF-FF-FF-FF-FF-FF (broadcast)

    but can be easily changed

    I develop for programmers DLL library “IgorUDP.dll”, which offers access to the device from your programs in the simple way. It contains only 3 functions: InitUDP, CloseUDP and DoGetInfraCode.

    Reply
  6. Tomi Engdahl says:

    Bit-Banged Ethernet On The Raspberry Pi Pico
    https://hackaday.com/2022/08/26/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.

    Pico-10BASE-T
    https://github.com/kingyoPiyo/Pico-10BASE-T

    10BASE-T from Raspberry Pi Pico

    Note:

    DO NOT CONNECT to PoE equipment!!
    Currently transmission only (UDP is available)
    Receiving process will be implemented in the future…
    It is advisable to insert a pulse transformer for safety.

    Reply
  7. Tomi Engdahl says:

    Half-Duplex Ethernet with just an ATTiny85
    https://www.youtube.com/watch?v=m4f4OzEyueg&t=1s

    Github: https://github.com/cnlohr/ethertiny

    TX and RX actually works. The only reason I felt challenged to do the RX portion was because Igor Češko said that the AVR wasn’t fast enough to RX. His AVR, that might be true, but not the ATTiny85!!!

    Reply
  8. Tomi says:

    https://github.com/holysnippet/pico_eth_doc

    pico_eth

    RP2040 Minimal hardware (PIO) Ethernet compatible interface + lwIP TCP/IP stack driver – ROBIN Guillaume, 2022

    This library allows you to add Ethernet 10Base-T compatible connectivity to your Pico at the cost of some passive components. It uses the proven TCP/IP lwIP stack provided in the latest RP2040 SDK. It is therefore compatible with programs written in polling mode for the Pico W or existing lwIP apps and code.

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *

*

*