usb ?

Thread Starter

Mathematics!

Joined Jul 21, 2008
1,036
So I looked at the usb pin out and basically it
is

pin 1 5vdc VCC
pins 2 and 3 transmitter , reciever data
pin 4 GND

When I look up the cat5e pinout it is just 4 pairs of wires that are used for transmitting data / receiving data... so I could use any pairs probably should stick with the tx , rx main ones...

To make a usb to ethernet converter cable is it as easy as just putting pins 2 , 3 of usb onto the first tx , rx pins of the cat5e wire and VCC , GND on the second pair?

I am curious if ethernet cat5e operates at 5vdc as the usb does if so then getting the correct pins and wires should be it if not then some conversion most be made to to get it to the correct voltage ,...etc

Any input would be great I am not willing to buy this cord I want to make it from scratch.

Any help would be great because I am not sure what the voltages used for the cat5e cords are usually for network nic card/ router stuff anybody know?
Basically how much voltage is used in ethernet cat5e , cat6 cord?
 

rjenkins

Joined Nov 6, 2005
1,013
The actual ethernet signals are roughly 1V if I remember correctly...

I would not refer to RJ45/CAT5 wiring as Ethernet unless you are doing conversion to an actual Ethernet protocol, as it's confusing...

To try linking USB via RJ45 cables, I'd put the data lines on one pair and use one other pair each for 0V and +5V.

(Ethernet interfaces are transformer coupled; each pair used has a transformer winding across it, so putting 5V & 0V on a single pair could cause damage if you ever accidentally cross-connect your USB-over-RJ45 with an Ethernet port).

The older 10/100 MBit Ethernet standard only uses two pairs out of the four, the center pair (usually blue) is left available for telephone use, as an RJ11 can be plugged directly in to an Ethernet socket. The phone system uses 48V DC and 90V? ring signal so that gives an idea of the safe voltage rating of the RJ45 & CAT5 setup.

If the middle pair is Blue, the other spare is Brown. I'd use both browns for +5V, the blue pair for data and green (or both green & orange) as 0V.

That should be safe against accidental connection with other gear.

I can't find any standard for doing this and I don't know if it will work more than a few metres. I think the maximum cable length according to the USB standards is 5m.

You can get Ethernet connected USB extenders, however these are active devices which repeat the data using true Ethernet protocol.
 

Thread Starter

Mathematics!

Joined Jul 21, 2008
1,036
Basically I am trying to make these from scratch not buy.
http://images.esellerpro.com/2242/I/188/82/USB-EXTENDER.jpg

Seems to me that you use one pair for 5vdc and ground
And another pair for data. That would be if your going from cat5 to a usb device

But if I was going from a usb to ethernet device would I only need one pair because the data pair pins on the usb is 0 - 2vdc for a logical 0 and
3 - 5 vdc for logical 1. I don't think you need a power source when going down the cat5 ethernet wire to a router or nic.
So if I convert the data voltage down to 1volt I should be fine. But I am also wondering if I need a second pair of wires because I thought ethernet devices always used 2 pairs of transmitters/recievers but if I am going in one direction maybe I only need one?

Also for ethernet do they use PWM or some kind of modulation scheme I cann't find how they delimit a 0 from a logical one.

Obviously usb is pretty easy just stay in the range of 0 -2 vdc for 0 and
3-5 vdc for 1
But for ethernet the voltage is always 1vdc so their must be some range for a logical zero and one but seems it will be more tightly bound and more prone to error maybe just me.

So USB can only be 5 meters = 16.4041995 feet

before crap happens

Wonder why that happens since cat5e ethernet cables use 1/5th the voltage and I have used them up to 150/200 ft with no signal loss or speed loss. I would think the usb would be able to go farther since their will still be more voltage after the voltage drop on the 22gage wires...
Guess it is probably the fact that usb is not as sensitive or the modulation scheme makes it not usable at long distances since you have to be in the range of 3-5volts for a 1.
But either way you should beable to amplify/repeat the 16ft usb signal over and over again to go distances ....

Thanks for your input
 
Last edited:

rjenkins

Joined Nov 6, 2005
1,013
The gadgets in the picture are usb-over-cat5 extenders, they are not Ethernet.
I'd guess they use balanced line drivers & receivers to match the impedance of the Cat5 cable, allowing long distance operation.

USB uses (roughly) TTL logic levels over a single pair which switches direction. It's similar to RS485 but at much higher data rates, either 12MBit or 480MBit.

You can get active USB extension cables that regenerate the USB data. Up to five x 5m cables can then be daisy chained.

Ethernet uses manchester encoding at 10Mbit or 100MBit etc., transmitted through transformer coupled, impedance matched and terminated unidirectional transmission lines. The distance limits are solely down to signal attenuation over cable length and 100M is the rated length for a single segment (though it would probably work far beyond that with high quality cable).

The protocols and signalling methods and speeds are completely different between USB and Ethernet. True USB to Ethernet adapters are intelligent, processor based units with memory buffers to handle multiple Ethernet data frames (up to 1500 Bytes each frame).

My reason for advising you to split the 0V & 5V over two pairs is that if you ever accidentally connect it to an actual ethernet port, with power on a single pair you would be putting it directly across a transformer winding, which could either burn out the transformer in the ethernet interface or damage the USB port the power is being drawn from.

Info on Manchester encoding: http://www.erg.abdn.ac.uk/users/gorry/course/phy-pages/man.html
And the Ethernet frame structure: http://www.dcs.gla.ac.uk/~lewis/networkpages/m04s03EthernetFrame.htm
 
Last edited:

Thread Starter

Mathematics!

Joined Jul 21, 2008
1,036
The gadgets in the picture are usb-over-cat5 extenders, they are not Ethernet.
Ok , so then other then having the ability to extend your cables distance greater then 5m then what exactly would be the use for converting usb to ethernet?

But if I was going to say write a raw program to send data out a usb port
what would I have to do to convert the data into a form that a nic or router ,...etc would beable to process?

Like you told me about Manchester encoding , and the ethernet packet structure (TCP/IP protocal ,...etc) I know how to create a packet and use the Manchester encoding to do it.

But I don't know what voltage means logical 0 or 1 for ethernet devices like routers , nics ,..etc? So I am not sure how to send a zero and a one even though I know how to do everything else.
Is it like the usb split it in half like from 0 to 0.5volts => logical 0 and
0.5 to 1 => logical 1???
If that is the case then all I have to do is use some resistor to drop the voltage in the range of 1volt after I send it out the usb port....

Thanks for your input
 

rjenkins

Joined Nov 6, 2005
1,013
You can't directly control the signals on either the USB or Ethernet ports.

Each has a hardware adapter chip in the machine which can only work at fixed speeds and uses fixed data formats. The two use different data rates, bit encoding and frame formats; they are completely and absolutely incompatible.

Even at the physical level they are totally different. USB has one signal pair which switches between sending and receiving, Ethernet uses two (or four) signal pairs with separate send and recieve.

I designed and built an Ethernet interface a few years back; it used three gate array chips clocked at 160MHz (plus some static ram) just to handle 10Mbit ethernet.
Trying to do any high speed data protocol without a ready-made dedicated device to handle it is incredibly difficult.
 

Thread Starter

Mathematics!

Joined Jul 21, 2008
1,036
got you.

But just curious what makes the difference of a zero and one in ethernet devices?

I.E you told me about the modulation down the cat5e being Manchester encoding or some variation line code. And I have work with TCP/IP and packet type structures a ton.

However you said ethernet uses around 1volt or 2 ...etc.
What voltage range corosponds to a 0 or 1.

Like if I made an ethernet device with some chips sending data out some pins down a cat5e wire what voltages would represent a 1 and what would represent a zero.

Thanks.
And ethernet uses at least 4 wires out of the 8 wires on the cat5e wire
so then why are their 2 recievers and 2 transmitters and what 2 do I use to recieve and what 2 are for transmitting ... I guess I am a little confused about how the transmission takes place....

I know the modulation scheme , packet structure ,...etc but I don't know how to represent a 0 or 1 interms of voltages and I don't know what wires to send these voltages out and recieve on...

If I knew this I would be all set with knowing how data is sent in ethernet networks ,...etc down a wire.

Thanks
 

rjenkins

Joined Nov 6, 2005
1,013
Each end of each pair is transformer coupled, so all the cables are DC isolated and floating.

I did a lot of research on this when I built my interface boards. As far as I can remember, I used conventional balancel line drivers and receivers, 26C31 and 26C32 or similar.

I matched those to the 100 Ohm transformers with a chain of three resistors across the output of the driver, chosen so the equivalent resistance across the center resistor was about 100 Ohms (and the transformer connected there) with a drive voltage of something like 1V. Possibly a 220 Ohms in the center and 100 Ohms either end from the driver.

The receiver just connected to the transformer with a 100 Ohm terminating resistor across it.

The voltage is not particularly critical as it's going to a differential receiver which works from about 100mV up, so something like 1 - 2V is fine.

Due to the manchester coding, there is no level for 1 or 0. a 'One Bit' is high for the first half of the bit timeslot and low for the second, a 'Zero Bit' is reversed.

The Green and Orange pairs are used for data, which is transmit and which is receive depends which end of the link you are looking at. Computers etc. are wired opposite to Switches/Hubs so pin-for-pin cables can be used.

Here's a nice schematic of a commercial interface setup. In this the transformer module also include line chokes to suppress any unbalanced signal. That prevents electrical noise emission from the cables.

They use a different matching resistor setup to my homebrew board, but the concept is the same - it puts 100 Ohms across each pair to give correct termination. They also link all the pairs to a common point using resistors, presumably to prevent voltage building up between cores within the cables.
http://www.nist.gov/smartspace/images/online_tech_doc_Ethernet_elec_Schematic.jpg

And another schematic, this one using a Microchip ENC28J60. Very similar in concept but this one can be used with a PIC!
http://www.animalrobots.eu/wp-content/Images/Ethernet_02.jpg

(Both from Google Images, searching 'ethernet transformer').
 
Last edited:

Thread Starter

Mathematics!

Joined Jul 21, 2008
1,036
Right! Manchester code

In your links I am curious ENC28J60 is for is this a line driver that is just used to invert the bits?

Also what is the purpose of the 80225 chip is this a line driver as well?

Can you just use a MCU Avr chip and a few transfomers ,resistors ,caps ,...etc and leave out these chips if inverting is not an issue? For instance if you are using 10BT devices.

For the clock signal for Manchester code for ethernet devices their must be a standard is this 25MHz because if you don't have a standard clock signal for the data then the bit boundaries will not be correct and could screw up the data sampling...etc???? I guess it would depend on the data transfer and what version of ethernet but they should beable to be backwards compatible ? <---wondering how this works and how to figure out the clock cycle signal should be?

Thanks I will probably need a little more guideness before I start my usb projects.... It's great that you could do all that really cool man.
 
Last edited:

rjenkins

Joined Nov 6, 2005
1,013
Those chips are the Ethernet protocol handlers. The big one is the type of thing that would be on a PC I/O card, the 28J60 works with a PIC or other MCU & connects via the SPI data port. That's what I'd use if I was going to add ethernet to a project nowadays.

The micro writes a frame of addressing & data to the protocol handler and that does all the buffering, timing, error checking etc., for the actual line protocol.
Likewise for receive data, frames are checked for valid CRC and buffered for the micro to read in it's own time.

10MBit Ethernet uses a 10MHz or 20MHz clock to produce the manchester coded data.

The receive side is the really complex part, that needs either a digital PLL running many times the data rate (I used 16x, 160MHz) or an analog PLL, probably at 20MHz.

Either way it must get phase lock in a short time (like 30 - 40 cycles) so the receive logic can start examining the receive data for the framing code that sets the byte sync.
One of the reasons Manchester coding is used is that it guarantees at least one polarity change every bit time, so makes clock recovery accurate. It also means there is never a speady state on the line during a transmission, so the transformers can work reliably & only handle a narrow frequency range.

There are other parts to it as well, like a 'presence pulse' or heartbeat that allows both ends of a link to know there is a connection, even if no data is transferred.

Without that, neither end will listen for data reliably.
 

Thread Starter

Mathematics!

Joined Jul 21, 2008
1,036
Ok , Then these Ethernet protocol handlers chips do they do both the recieveing and transmitting of the data.

For instance if I had a few AVR or PIC chips lying around would all I have to get to do the transmitting/recieveing of ethernet packets
is a few 80225 chips.

Or do these chips just do the transmitting side?

Also just curious if these chips do all the clock signal , ECC ,....etc
do they also store the data in some EEPROM or something that the MCU can read at it's own speed because data be to quick for some MCU to process on the spot.

If this is all true then all I would have to do is get some of these types of chips and I would be all set to do ethernet application devices.

Also are these Ethernet protocol handlers chips programmable or are they
just hookup the pins and components and your read to read/write data using the MCU. If so then are these chips set to output 5volts to the MCU because most of my MCU work on 5volts approx out/in the pins for high and 0volts for low.
Also on the ethernet side their must be a range that is not exceptable to use you said they usually work on 1 or 2 volts but if you where using some other device that was outputing in the range of 5 or 12 volt Manchester code range for the output of the ethernet. Would the chip still work or does it only work for excepting and transmitting in the 1 or 2 volt range.

Just some questions to clear up.
So I don't really need to worry about modulating/demodulating or when to transmit/recieve the data these chips do it for me. All I need to do is have the MCU hand off the data and retreive the data from the ethernet chips buffer. Correct me if I am wrong but that makes it a lot easier.
 

rjenkins

Joined Nov 6, 2005
1,013
They are generally full duplex, they can transmit and receive simultaneously (but I don't know the details for those specific ones offhand).

The 80255 would probably take more signals to drive than a typical PIC has, the little Microchip one is designed to work with low pin count MCUs using the SPI port rather than needing a full parallel data & address bus.

They do contain RAM buffers to do all the intermediate storage.

I have no idea what the actual maximum voltage is on the Ethernet side, but I suspect the transformers would saturate and limit the voltage fed to the chips before it got too high.
 

Thread Starter

Mathematics!

Joined Jul 21, 2008
1,036
For usb what determines a logical 1 from a 0?

the pinout is
VCC
data1
data2
GND


How does this work basically what voltage on pins data1,data2 gives a logical 1 ? What voltage on pins data1,data2 gives a logical 0?
And what delimits when the next bit is send from the previous bit...
for instance if I some how read a 1 how long after do I need to wait to read the next bit (or another words what delimits the bits/sampling rate ,...etc)

Last question what voltage or what delimits the idle state on pins data1,data2 (i.e when you should stop reading the usb because nothing is being sent or connected to it ,...etc)
 
Top