Welcome, Guest. Please login or register.

Author Topic: Connecting Ethernet device to serial port  (Read 19227 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« on: May 24, 2008, 10:33:45 PM »
Seems all right to me, PC side has serial emulation, and RS232 is RS232, there's not much fuss about that. You only have to know the baud rate, start/stop bits, parity and whether it uses XON/XOFF.
RS232 on wikipedia
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #1 on: May 25, 2008, 09:28:19 AM »
Quote

bloodline wrote:
Quote

motorollin wrote:
I've got a device which connects via Ethernet, and then has software which emulates a serial port and bridges the virtual serial port to the ethernet device. You then send commands to the virtual serial port and they are received by the ethernet device.

The software is only for Windows, and I want to use it with a Mac. Unfortunately I can't find an equivalent. I do, however, have a couple of USB serial ports which work on the Mac. Does anyone know whether those Ethernet to Serial adapters which allow networking through a serial port would allow me to communicate with the ethernet device through a real serial port?

Here is a link to the COM port redirector software for Windows if it helps.

--
moto


I honestly can't follow that you are trying to do here!!!


MacUSB-->Serial-->Ethernet-->Serial-->Some Device


 :-?
Program wants to communicate with Com port device -> OS device driver transforms it into ethernet packages -> being send to ethernet to com device -> which transforms it to rs232 communication with the com port device.
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #2 on: May 25, 2008, 09:34:24 AM »
Quote

motorollin wrote:
@speel
Wouldn't it depend on what that software is doing? Presumably it wraps the RS232 commands inside Ethernet packets. Are you quite sure a hardware device would do something similar?
RS232 is mainly a hardware protocol. A software protocol for RS232 would be something like kermit, or telnet. And I'm indeed quite sure it can handle it. It's all pretty straight-forward. It explicitly uses windows, which has a software layer for RS232 communication. So, with this layer, any communication system can be used, as long as a 1on1 communication stream can be established.
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #3 on: May 25, 2008, 10:51:06 AM »
Quote

motorollin wrote:
@speel
Sounds good. If I understand you (and I might not - I'm at the edge of my knowledge about this stuff) if it works with kermit/telnet, which wrap RS232 commands in Ethernet, then it will work with a hardware adapter, which takes the RS232 data from a real port and wrap it in Ethernet before re-broadcasting it. Right?

--
moto
Kinda, except that RS232 doesn't have commands, since it's an hardware layer. Let's say, a program asks windows to send this or that data over the serial port. The program lets Windows send it over TCP/IP to the dedicated device (which has a dedicated IP adress, which the program is aware of). This device has a com port of it's own, and sends the data over a null-modem to the device.
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #4 on: May 25, 2008, 11:00:49 AM »
Quote

motorollin wrote:
Would the application need to know the IP address if the conversion is done in hardware? What I mean is, if the serial <-> Ethernet converter has its own TCP/IP stack and DHCP server (some do) then couldn't it receive raw RS232 data destined for a serial port from an app with no knowledge of the IP address, and then package it up and send it to the IP address it allocated to the Ethernet device?

--
moto
It doesn't receive raw RS232 data, since it's TCP, so that means it's in packages. I guess this program uses it's own IP port and it's own protocol 'inside' TCP/IP.
If it'd be done the way you say, it'd send the data to the very first router your computer is connected to, and this router discards the data because it doesn't recognise it as TCP/IP data.
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #5 on: May 25, 2008, 11:15:54 AM »
Btw. May I be so free to ask what you'll be using it for?
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #6 on: May 25, 2008, 11:38:30 AM »
Quote

motorollin wrote:
Now I'm really confused... I'm not talking about connecting the Ethernet device through a router or any other kind of intranet. Just a cat5 cable going directly from the Ethernet device in to the serial adapter, then a serial cable from the other side of the adapter to the serial port of the computer.

--
moto
It doesn't work that way. On the site it's stated that the device works as a server in your network.
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #7 on: May 25, 2008, 11:50:06 AM »
Quote

motorollin wrote:
Quote
Speelgoedmannetje wrote:
Btw. May I be so free to ask what you'll be using it for?

It's a home automation device which connects via Ethernet. As I said the software for Windows sets up a virtual serial port which you can connect to directly using hyperterminal or use software like HomeSeer. The virtual COM port automatically redirects to the device connected via Ethernet (but you have to tell it the correct IP address).

Since this software doesn't work on the Mac, I want to replace it with hardware. I have a USB RS232 port, so just need a device which will connect to it and have an Ethernet port to which I can connect the home automation hardware, allowing me to send the same commands I would type in to hyperterminal on the PC to the Mac's serial port.

--
moto

hm, you WILL need a specific program on your mac to redirect the serial data to TCP/IP data. But maybe you could configure the hyperterminal in such a way, that it can communicate over TCP/IP. Then you can use a simple PC with a com port and linux installed on it, and let iptables 'bridge' all incoming data (TCP/IP data stripped) to the com-port, and all com-port data be send to your own computer.
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #8 on: May 25, 2008, 12:13:16 PM »
Say, Moto, you could do some programming, not? You could make such yourself. It's really not much work. I can't do it for you, unfortunately, because I don't have a mac. Maybe you could ask someone who has a mac. :-)
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #9 on: May 25, 2008, 12:19:08 PM »
Quote

bloodline wrote:
Quote

Speelgoedmannetje wrote:
Say, Moto, you could do some programming, not? You could make such yourself. It's really not much work. I can't do it for you, unfortunately, because I don't have a mac. Maybe you could ask someone who has a mac. :-)


Indeed... but first one would need to understand the problem...
Moto wants this, but then instead of running it on Windows, running it on MacOS. He asked whether this could be used directly without the OS involved.
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #10 on: May 25, 2008, 12:29:27 PM »
Quote

motorollin wrote:
@speel
Yes I have done some programming, but nothing like this. It's the low-level stuff, actually capturing, manipulating and re-broadcasting the data that I struggle with.

--
moto
On the Linux side, it's a case of scripting (look for a bridging script on the internet to use as example), on the mac side I don't know, it might be as simple as changing properties of the telnet program to use TCP/IP.
Just have a look, it can be very simple. There are plenty of scripts and libraries to make your life very easy.
And if you don't understand stuff, well, we're here for you to help :-)
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #11 on: May 25, 2008, 12:40:55 PM »
Quote

bloodline wrote:

Software that write to a serial port --> Software that encapsulates the Serial data into TCP packets --> MAC-Ethernet Port --> Ethernet wire --> Ethernet-BOX-Serial port -->Some device that wants to plug into a Serial port

Right?
precisely :-)
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #12 on: May 25, 2008, 01:52:57 PM »
Quote

motorollin wrote:
Quote
bloodline wrote:
Wait... if your device has a serial port then plug it to the Mac with the USB serial port adaptors you have and write data directly to it via the /dev/xxx interface...?

Why can't I understand this? What's wrong with me? I'm going to get a drink...

:lol:

I'll start again ;-)

The device has ONLY an Ethernet port. No serial port at all. Once it is on the network, you can telnet to it to do some config, but cannot actually control it this way.

Documentation for the device details only how to communicate with it by writing hex bytes to a serial port. Since the device doesn't actually have a serial port, you install the virtual COM port and write them to that. The virtual COM port then redirects the information to the device using TCP/IP through it's Ethernet port. This works - under Windows. I can't find any equivalent software for the Mac.

The idea of the ethernet to serial adapter was to replace the Windows software. So instead of writing hex bytes to a virtual COM port which translates them to TCP/IP and then to Ethernet, you write them to a real serial port to which you connect some hardware which encapsulates the data, and then connects to the device's Ethernet port. From what Speel said though, this won't work, which puts me back at square one looking for a way to do it in software.
Ah, if the device actually has an ethernet port, this'd make things more easy. You only need to know the protocol of that device, then. But it sounds strange to me that you can do so little with telnet :-? You must be able to do everything with telnet, because telnet is dedicated to do everything; including scripts, running programs, etcetera.
If you plug this converter to your Apple's com-port, you can attach it directly using a cross-link cable. Still, you need the protocol. But all this fuss is not necessary.
-edit-Oh, ehm and the device needs to be able to interact with the  ethernet-to-comport adapter, and since it doesn't know the protocol of that adapter, so, that's a no-go anyway.
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #13 on: May 25, 2008, 03:38:06 PM »
Quote

bloodline wrote:

Never feel guilty about avoiding your family... you owe them nothing!!! :madashell:
What have you people always against family? I love my family, and vice versa (aunts still treat me as the benjamin of the family :oops:)
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #14 on: May 25, 2008, 04:02:56 PM »
Doesn't offer the export mode a CLI?
Btw. you can use Wireshark to observe the communication, as raw data.
And the canary said: \'chirp\'