Welcome, Guest. Please login or register.

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

Description:

0 Members and 1 Guest are viewing this topic.

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Connecting Ethernet device to serial port
« Reply #59 from previous page: May 26, 2008, 09:29:41 PM »
Hmm Wikipedia actually helped :-)

http://en.wikipedia.org/wiki/Berkeley_sockets#TCP

Explains how to set up a client and a server. I guess the RFXCOM is doing all the server business, so I'll have a look at the client setup tomorrow after the Exam Of Doom.

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

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

motorollin wrote:
Hmm Wikipedia actually helped :-)

http://en.wikipedia.org/wiki/Berkeley_sockets#TCP

Explains how to set up a client and a server. I guess the RFXCOM is doing all the server business, so I'll have a look at the client setup tomorrow after the Exam Of Doom.

--
moto


Good luck tomorrow!

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Connecting Ethernet device to serial port
« Reply #61 on: May 26, 2008, 10:13:26 PM »
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 bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: Connecting Ethernet device to serial port
« Reply #62 on: May 26, 2008, 10:20:51 PM »
Quote

motorollin wrote:
Thanks :-)

--
moto


You should get some sleep.

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Connecting Ethernet device to serial port
« Reply #63 on: May 26, 2008, 10:26:32 PM »
I know. Up at 06:30 tomorrow to get to Brum in time. Can't sleep though :crazy:

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

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show only replies by Speelgoedmannetje
Re: Connecting Ethernet device to serial port
« Reply #64 on: May 26, 2008, 10:40:49 PM »
Quote

motorollin wrote:
Hmm Wikipedia actually helped :-)

http://en.wikipedia.org/wiki/Berkeley_sockets#TCP

Explains how to set up a client and a server. I guess the RFXCOM is doing all the server business, so I'll have a look at the client setup tomorrow after the Exam Of Doom.

--
moto
Have succes, Moto :-)
And the canary said: \'chirp\'
 

Offline Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show only replies by Speelgoedmannetje
Re: Connecting Ethernet device to serial port
« Reply #65 on: May 26, 2008, 10:42:38 PM »
Quote

motorollin wrote:
I know. Up at 06:30 tomorrow to get to Brum in time. Can't sleep though :crazy:

--
moto
It's okay if you can't sleep, as long as you're lying in bed (reading a book or something). You'll get enough rest.
And the canary said: \'chirp\'
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Connecting Ethernet device to serial port
« Reply #66 on: May 26, 2008, 10:48:44 PM »
Thanks :-D And I can stop thinking about this little project now I have had a small success. I compiled the example code from Wikipedia and got it working. It connects and disconnects a socket to my MacBook's IP address on port 80. I know it's working because if I specify a bogus IP it hangs (no intelligence to time-out) and if I turn off the web server it errors that the connection failed.

So now I just need to work out reading and writing, but that can wait until after 12:00 tomorrow when I can remove embryology from my brainbox.

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

  • Colonization had Galleons
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 6796
    • Show only replies by odin
Re: Connecting Ethernet device to serial port
« Reply #67 on: May 27, 2008, 05:13:14 PM »
Ah...the joy of last minute studying and the relief of forgetting it all instantly the moment you walk out of the room where the exam was =).

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Connecting Ethernet device to serial port
« Reply #68 on: May 27, 2008, 07:26:04 PM »
Quote
odin wrote:
Ah...the joy of last minute studying and the relief of forgetting it all instantly the moment you walk out of the room where the exam was =).

The exam was actually quite fun :crazy:

--
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 only replies by motorollin
Re: Connecting Ethernet device to serial port
« Reply #69 on: May 27, 2008, 07:28:22 PM »
Ok here's a packet being sent to the RFXCOM, sniffed from the Ethernet port of the computer, when it turns on a power socket:


00000000 21 70 00 00 12 04

3



So I'm guessing if I just write that to the socket from my test app, it should have the same effect as the original Windows app sending it? :-?

--
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 only replies by motorollin
Re: Connecting Ethernet device to serial port
« Reply #70 on: May 29, 2008, 07:43:54 AM »
Hmm, ok the data inside that Ethernet packet (21 70 00 00 12 04) corresponds to the hex values you would send to the virtual COM port for the same command. So perhaps the COM port redirector isn't doing anything fancy after all, just wrapping those hex bytes up in a TCP packet. I'm going to try something which will probably seem overly elaborate, but will test a theory:

Windows machine running terminal emulator <-> real COM port <-> serial cable <-> real COM port <-> Mac <-> MultiCOM redirector <-> RFXCOM (over Ethernet)

If that works then I will know it's possible to use MultiCOM on the Mac as the COM port redirect. I am already in contact with the author of MultiCOM who reckons it should work with a virtual COM port, making the setup like this:

Application on Mac sending hex bytes <-> virtual COM port <-> MultiCOM redirector <-> RFXCOM (over Ethernet)

Bloodline, you reckon it's quite simple to set up a virtual COM port under OS X. I have Googled it but can't find out how. Would you mind pointing me in the right direction?

--
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 only replies by motorollin
Re: Connecting Ethernet device to serial port
« Reply #71 on: May 29, 2008, 09:46:25 AM »
Right! First test worked. Snooped the serial port while pressing a button to turn a light on and got the hex values it sends. Then under Windows, opened a terminal and sent the same values to that COM port, and the light turned on! :-)

Next step is to make sure Multicom works as a redirect on the Mac side of serial data to the Ethernet 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 Speelgoedmannetje

  • Hero Member
  • *****
  • Join Date: Oct 2002
  • Posts: 9656
    • Show only replies by Speelgoedmannetje
Re: Connecting Ethernet device to serial port
« Reply #72 on: May 29, 2008, 10:19:38 AM »
Eeehmm, isn't it a good idea to get a datasheet of this thingy, rather than do this possibly extremely time-consuming reverse engineering?
And the canary said: \'chirp\'
 

Offline motorollinTopic starter

  • Hero Member
  • *****
  • Join Date: Nov 2005
  • Posts: 8669
    • Show only replies by motorollin
Re: Connecting Ethernet device to serial port
« Reply #73 on: May 29, 2008, 12:21:42 PM »
Eventually yes. I just snooped one code to test it.

--
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 only replies by motorollin
Re: Connecting Ethernet device to serial port
« Reply #74 on: May 29, 2008, 12:26:35 PM »
By the way there is practically no documentation about what is actually happening "behind the scenes", which is why we don't know how to replicate it. That's why we're having to "reverse engineer" it piece by piece.

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