Rs485Converter

Aus Ethersex_Wiki
Wechseln zu: Navigation, Suche

RS232-RS485 Converter

This Project wants to be a simple, low cost, open-source rs232 to rs485 converter (half duplex). So you can simply attach the converter to your serial port (com-port) and start to talk on a rs485 bus.

Why the hell is there an ATTiny2313 on the converter?

Because this is a half duplex rs485 converter, we must toggle the RE/DE pins at the MAX485 in order to enable sending. My first thought was to to this with the RTS pin of the serial port. But there were a few problems:

  • The sending toggle should be done within userspace, were we can't guarantee real time. So it would be possible that our RE/DE pins is high 500ms too long and we miss the answer to our packet.
  • With the 16550 ( the chip on your mainboard, if you have an x86, which does the serial port for you ), you can't drive the RTS pin in an rs485 compatible mode in hardware, so it would have be done in a kernel modul, and then it is also only estimation, when the last byte is sent.

So i decided to attach an ATTiny2313 ( the smallest avr I had here ), which does the toggling of the RE/DE pin. It enables the RE/DE pin for sending, when it does detect a rising edge on the RTS pin. The RE/DE is enabled until there is no pin change for about 1ms on the TX line. It also drives the RX/TX leds of the dongle.

Get the source/schematics

If you have comments, critic write a mail to

 stettberger(at)dokucode(dot)de