Raw ethernet to serial...

Discussion to talk about software related topics only.
Post Reply
jolugar
Posts: 3
Joined: Thu Apr 04, 2013 12:18 pm

Raw ethernet to serial...

Post by jolugar »

Hi,

I need to do some communication features using ethernet to rs232 and viseversa, but not involving protocol issues... is there a way to use two ethernet devices interconected using rs232 as a media for tcp/ip communication between two ethernet hosts?

it doesn't matter the lower data transfer rate.
User avatar
Chris Ruff
Posts: 222
Joined: Thu Apr 24, 2008 4:09 pm
Location: topsail island, nc
Contact:

Re: Raw ethernet to serial...

Post by Chris Ruff »

so.....

You want to plug your laptop into one black box and plug your home Ethernet into the other box- and RS-232 between the boxes and everything will magically work on the laptop? Google will (slowly..) come up on your laptop screen browser?

right?

Chris
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand
User avatar
dciliske
Posts: 624
Joined: Mon Feb 06, 2012 9:37 am
Location: San Diego, CA
Contact:

Re: Raw ethernet to serial...

Post by dciliske »

Yes, yes there is. I happen to be working on essentially that issue right this second (though not exactly)... if you don't want to do any configuration or even appear as if it exists on the network, and simply transfer packets, it's fairly straight forward. You'll want to look at the tcp2serial or dualserial examples for doing the serial to ethernet task (called SerialPump if memory serves). It forms the basis for creating the tcp packets. In your case you want to pack your data in a Pool Buffer and then hand it off to the function TransmitBuffer (perhaps EthTransmitBuffer) to pass to the ethernet interface. You may want some sort of synchronization preamble, with length so you don't need to parse the packet and have less issue chopping up the frames. Finally, you'll need to enable promiscuous mode for the ethernet controller for the processor to be able to receive. I believe you should be able to send a frame without explicitly setting the Netburner's hardware MAC address to match the source address of the frame, but you might not; try and see.

-Dan
Dan Ciliske
Project Engineer
Netburner, Inc
jolugar
Posts: 3
Joined: Thu Apr 04, 2013 12:18 pm

Re: Raw ethernet to serial...

Post by jolugar »

Chris Ruff wrote:so.....

You want to plug your laptop into one black box and plug your home Ethernet into the other box- and RS-232 between the boxes and everything will magically work on the laptop? Google will (slowly..) come up on your laptop screen browser?

right?

Chris
Something like that, only that is not about (very slowly) browsing internet, is obout other type of protocol comunication carried over tcp for specific purpose devices, each device will do the TCP/IP managment, so just need to send the raw data.

I need advice for making some kind of ethernet hub using two NB mod5270, I've tried using the IP libraries for catching ethernet packets in promiscuous mode and then forwarding to serial, but can't catch packets for the IP address of the host that is not at the same physical level.

thanks.
User avatar
Chris Ruff
Posts: 222
Joined: Thu Apr 24, 2008 4:09 pm
Location: topsail island, nc
Contact:

Re: Raw ethernet to serial...

Post by Chris Ruff »

You would need to filter out all UDP and TCP/IP traffic that you don't want coming from the WAN end. It is clearly not possible to take thousands of packets and squeeze them through a tiny pipe (say..38400 baud?)and have the entire range of addresses/ports traffic transmitted through and to the downstream end. The upstream end from the device is not a problem since the packets from that 38400 bit rate pipe are simply added to the noisy network.

So your WAN box would need to be a router and the other box a repeater

my 2 cents yet again

Chris
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand
jolugar
Posts: 3
Joined: Thu Apr 04, 2013 12:18 pm

Re: Raw ethernet to serial...

Post by jolugar »

dciliske wrote:Yes, yes there is. I happen to be working on essentially that issue right this second (though not exactly)... if you don't want to do any configuration or even appear as if it exists on the network, and simply transfer packets, it's fairly straight forward. You'll want to look at the tcp2serial or dualserial examples for doing the serial to ethernet task (called SerialPump if memory serves). It forms the basis for creating the tcp packets. In your case you want to pack your data in a Pool Buffer and then hand it off to the function TransmitBuffer (perhaps EthTransmitBuffer) to pass to the ethernet interface. You may want some sort of synchronization preamble, with length so you don't need to parse the packet and have less issue chopping up the frames. Finally, you'll need to enable promiscuous mode for the ethernet controller for the processor to be able to receive. I believe you should be able to send a frame without explicitly setting the Netburner's hardware MAC address to match the source address of the frame, but you might not; try and see.

-Dan

Thanks a lot, that's what I was looking for, a function to forward raw data to the ethernet port after being recieved by the serial port... just need to do some tests on the NB MAC address issue, but for now you showed me the way to go on.

Thanks.
Post Reply