Welcome, Guest. Please login or register.

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

Description:

0 Members and 1 Guest are viewing this topic.

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Connecting Ethernet device to serial port
« on: May 24, 2008, 10:16:52 PM »
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
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #1 on: May 25, 2008, 08:54:02 AM »
@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?

@bloodline
The original way (under Windows) is:

Software <-> virtual COM port <-> COM port redirector software <-> ethernet port <-> device

We need to do:

Software <-> real serial port <-> ethernet to serial adapter (hardware) <-> device

So what I don't know is whether the ethernet to serial adapter will carry out the same functions on the RS232 data as the COM port redirector software. Sure the RS232 data within might be the same, but it may be encapsulated differently.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #2 on: May 25, 2008, 09:58:23 AM »
@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
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #3 on: May 25, 2008, 10:53:40 AM »
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
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #4 on: May 25, 2008, 11:22:04 AM »
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
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #5 on: May 25, 2008, 11:33:23 AM »
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

Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #6 on: May 25, 2008, 12:00:45 PM »
Quote
Speelgoedmannetje wrote:
It doesn't work that way. On the site it's stated that the device works as a server in your network.

So there's no way for it to work unless the software knows that it is communicating with an ethernet device across a TCP/IP stack?

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #7 on: May 25, 2008, 12:02:22 PM »
Quote
Speelgoedmannetje wrote:
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.

Well, the idea was to use just the Mac Mini :-( If there's no software solution for the Mac, then we might as well run the Windows software on a separate box.

I'll keep looking for equivalent Mac software. At least now I know it's definitely required. Cheers Speel.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #8 on: May 25, 2008, 12:22:25 PM »
@bloodline
We have Parallels and yes coherence is pretty cool. But we'd rather get it working on the Mac since AppleScript is perfect for writing the intelligence behind the system.

@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
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #9 on: May 25, 2008, 12:55:53 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?

Almost :-)

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

I know what you're thinking - if it connects directly to the Ethernet port why not just write to it directly? Because we don't know how. And since there is already a way of writing to it using a terminal, or even using a script to write bytes to a serial port, we doing the same on the Mac would work.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #10 on: May 25, 2008, 12:57:57 PM »
Quote
Speelgoedmannetje wrote:
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,

Hmm, will look in to that! I bet the principle would be the same on the Mac since device drivers are exposed in much the same way (/dev/*)

Quote
Speelgoedmannetje wrote:
it might be as simple as changing properties of the telnet program to use TCP/IP.

Well we don't actually want to use telnet since we need it to be scriptable (input and output need to be considered).

Quote
Speelgoedmannetje wrote:
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 :-)

Thanks :-)

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #11 on: May 25, 2008, 12:59:03 PM »
Quote
bloodline wrote:
Ok then the problem is the encapsulation software... Which should be quite easy to write, as there are only two problems: It needs to fake a com port... easy enough to do with MacOSX, this is where its Unix roots show up...

Do you know how? I tried to find out how to spoof a com port but couldn't find anything.

Quote
bloodline wrote:
but we don't know the protocol that the ethernet/serial box uses... what is the format of the packets that it expects?!?

No idea. Would it help to snoop the com port under Windows and see what's being transmitted?

(Edit - I *really* need to do some revision... ;-) )

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #12 on: May 25, 2008, 01:23:15 PM »
Quote
bloodline wrote:
Ok... you've lost me again...

The device you want to use already has an ethernet port? then why bother with all this serial nonsense?

Because there is no documentation on how to communicate directly over Ethernet. The documentation only tells you how to communicate with it via the virtual COM port.

Quote
bloodline wrote:
Now you want to use Ethernet... I assumed that this was the setup:

Software ±±>Encapsulator software __> Computer ==>E2S-Box --> Device

But we are missing the Encapsulator software that wraps the data sent via serial into TCP packets to be converted back to serial data once it's reached the E2S Box...

I hoped that the ethernet to serial device would do that for us...

Quote
bloodline wrote:
But what you are saying is that the Device already plus into Ethernet...

Yes, but that doesn't help us for the reasons stated above.

Quote
bloodline wrote:
So the device has both Serial an Ethernet... but you don't know how to access it via ethernet?

It *only* has Ethernet, but yes, we don't know how to address it via ethernet other than via the virtual COM port which then somehow redirects to the ethernet port.

Quote
bloodline wrote:
 Just fire up a Terminal and connect to its IP...?

Tried that. Telnet in to it and get some kind of configuration console but no way of actually controlling it. SSH is rejected.

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #13 on: May 25, 2008, 01:40:14 PM »
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.

I hope that makes sense - perhaps I should have been clearer to start with :-)

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show all replies
Re: Connecting Ethernet device to serial port
« Reply #14 on: May 25, 2008, 01:46:46 PM »
Quote
bloodline wrote:
When I started University, I decided that I had two options...

1. Spend a year Learning and cram an entire year's worth of Drinking into a single night...
2. Spend a year Drinking and cram an entire year's worth of Learning into a single night...

I decided that option 2 was much safer... ;-)

Well I don't really drink, so my options are:

1. Spend a year learning
2. Spend a year doing nothing and cram an entire year's worth of learning into a single night

I've got an exam on Tuesday on the auditory system, genetic inheritance and embryological development of the head and neck. The first two I think I'm ok on, as I know the auditory system very well and genetics is all very logical anyway. Development of the head and neck is really dull, so I'm thinking of just winging it. I just feel guilty because I used revision as an excuse to get out of a tedious family event, so I feel like I really should be revising :lol:

--
moto
Code: [Select]
10  IT\'S THE FINAL COUNTDOWN
20  FOR C = 1 TO 2
30     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NAAAA
40     DA-NA-NAAAA-NAAAA DA-NA-NA-NA-NA-NA-NAAAAA
50  NEXT C
60  NA-NA-NAAAA
70  NA-NA NA-NA-NA-NA-NAAAA NAAA-NAAAAAAAAAAA
80  GOTO 10