Welcome, Guest. Please login or register.

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

Description:

0 Members and 1 Guest are viewing this topic.

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« on: May 24, 2008, 10:39:22 PM »
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


 :-?

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #1 on: May 25, 2008, 12:12:08 PM »
Quote

motorollin wrote:
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 still have no idea what you were trying to do... but if you haven't already... get Parallels, in coherence mode it is unbelievable :-)

Quote

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


Hmmm...

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #2 on: May 25, 2008, 12:15:35 PM »
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...

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #3 on: May 25, 2008, 12:38:51 PM »
Quote

Speelgoedmannetje wrote:
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.


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?

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #4 on: May 25, 2008, 12:44:42 PM »
Quote

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


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... but we don't know the protocol that the ethernet/serial box uses... what is the format of the packets that it expects?!?

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #5 on: May 25, 2008, 01:16:38 PM »
quote]
motorollin wrote:
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
[/quote]


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?

Let me try again:

Software ±±> Port : software taking to a serial port.
Software __> : Port : software taking to an Ethernet port.
Computer --> Device : connected via a serial cable.
Computer ==> Device : Connected via Ethernet.


So the basic set up would be:

Software ±±> Computer --> Device

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...

But what you are saying is that the Device already plus into Ethernet...

Quote

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.


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

 Just fire up a Terminal and connect to its IP...?

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #6 on: May 25, 2008, 01:31:00 PM »
Quote

motorollin wrote:

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...



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...

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #7 on: May 25, 2008, 01:40:50 PM »
Quote

motorollin wrote:

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



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... ;-)

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #8 on: May 25, 2008, 01:45:55 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.

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


Ok.. so what is really missing is basically the device driver software for the device... regardless of the fact that it's implemented as a virtual com port... this is simply the interface that is exposed to the controlling software....

No... you are screwed, and not in the good way :-)

You could capture the TCP/IP packets sent when issuing command and then disassemble them... but I fear that is more work than worth it... says the man who tried to run a PowerMac with no way to interface with it :-D

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #9 on: May 25, 2008, 01:55:44 PM »
Quote

motorollin wrote:
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:


I drink. Oh boy do I drink... I drink to forget... I drink to cope... I drink out of boredom... I drink out of depression... I drink out of habit... I drink because I can... I drink because I can always find an excuse to drink.

Suffice to say... I like a drink...

Quote

1. Spend a year learning


Waste of time... I've spent over 6 months learning German... and yet I'm still crap... I say learning is pointless.

Quote

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


Sounds like a good plan... and since you learned just before the Exam... you're less likely to forget it... makes sense really!! Lets crack open a beer and celebrate!

Quote

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.


It's not that dull... you just need to find what bit is the most interesting and focus on that...

Quote

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:


Never feel guilty about avoiding your family... you owe them nothing!!! :madashell:

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #10 on: May 25, 2008, 02:01:18 PM »
Quote

Speelgoedmannetje wrote:
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.


I don't believe the device is actually being controlled via the Serial interface.
The virtual com device, is probably not just encapsulating the commands issued via serial... I expect it's is interpreting the serial commands and then issuing proprietary control packets... that would mean Telnet would not control the device.

The fact that it is controlled via virtual com device is a red herring...

Quote

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.




Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #11 on: May 25, 2008, 03:34:13 PM »
Quote

motorollin wrote:
Quote
bloodline wrote:
I don't believe the device is actually being controlled via the Serial interface.
The virtual com device, is probably not just encapsulating the commands issued via serial... I expect it's is interpreting the serial commands and then issuing proprietary control packets... that would mean Telnet would not control the device.

The fact that it is controlled via virtual com device is a red herring...

Then for now I will disregard the serial aspect and concentrate on working out what is happening post-encapsulation.


Remember, this is just my theory... If you can Telent, that make sure you explore that avenue FULLY!!

But yes... I think the solution... if there is one, will come from examining the packets.

Quote

If I can work that out, maybe I can start thinking about a way to create those data myself. Presumably that would require low-level access to the TCP/IP stack? ("Here is a packet of data I have manually created. Send it please...")


Well, if it is a fixed function device... then you could easily build a library of packets that correspond to the commands you issue...

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #12 on: May 25, 2008, 04:43:12 PM »
Quote

motorollin wrote:
Quote
bloodline wrote:
Remember, this is just my theory... If you can Telent, that make sure you explore that avenue FULLY!!

Have just checked, and it's definitely a config interface only. After outputting the current config, the telnet interface gives you the following options, none of which allow any control or monitoring of what is happening in the device.

Change Setup:
  0 Server
  1 Channel 1
  2 Channel 2
  3 E-mail
  5 Expert
  6 Security
  7 Defaults
  8 Exit without save
  9 Save and exit            Your choice ?

Quote
bloodline wrote:
But yes... I think the solution... if there is one, will come from examining the packets.

It should be fairly easy to have a look at the packets. But I have no idea how I would go about writing an app to custom make a packet and shove it in to the TCP/IP stack. Furthermore, the app would have to monitor traffic coming from the device to detect state changes. I'm losing enthusiasm for this now...



Post the IP... I wanna log on :-D

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #13 on: May 25, 2008, 04:45:23 PM »
Quote

Speelgoedmannetje wrote:
Quote

bloodline wrote:

Never feel guilty about avoiding your family... you owe them nothing!!! :madashell:
What have you people always against family?


I didn't choose my family... I am disappointed with some of their decisions and actions.

Quote

I love my family, and vice versa (aunts still treat me as the benjamin of the family :oops:)


Yet, she still hasn't learned your name?

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #14 on: May 25, 2008, 11:10:39 PM »
Quote

Speelgoedmannetje wrote:
Benjamin means the youngest son.


Ahhh right you are! I though she might have dementia or something :-)