Author Topic: Simple way to show ethernet packet timing on scope  (Read 7068 times)

0 Members and 1 Guest are viewing this topic.

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 13889
  • Country: gb
    • Mike's Electric Stuff
Simple way to show ethernet packet timing on scope
« on: July 23, 2018, 05:11:28 pm »
Is there a simple way to see the duration and timing of 100Mbps ethernet packets on a scope ?
I'm trying to get a feel for timings when receiving UDP data with a W5500, and would like to see the timing of the packets on the wire relative to when I get an interrupt 
Scoping the Rx pins on the magjack just shows a random-ish waveform with no obvious pattern regardless of whether it's idle or transferring. I do have control over packet content so can transmit specific byte values.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline Nusa

  • Super Contributor
  • ***
  • Posts: 2417
  • Country: us
Re: Simple way to show ethernet packet timing on scope
« Reply #1 on: July 23, 2018, 05:51:07 pm »
I believe it's a differential signal, which means you either need a differential probe or you need to set up two scope channels to get a similar result.
 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 13889
  • Country: gb
    • Mike's Electric Stuff
Re: Simple way to show ethernet packet timing on scope
« Reply #2 on: July 23, 2018, 05:55:35 pm »
I believe it's a differential signal, which means you either need a differential probe or you need to set up two scope channels to get a similar result.
It's differential but driven symmetrically, so looking at one line gives you all the info.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline Kjelt

  • Super Contributor
  • ***
  • Posts: 6544
  • Country: nl
Re: Simple way to show ethernet packet timing on scope
« Reply #3 on: July 23, 2018, 05:58:14 pm »
Packet timing? Why a scope?
Just a cheap portmirroring networkswitch and a laptop with wireshark and you get the timing of your packets.
If you want flank-timing its more difficult, no idea but this looks interesting using a diff probe and tek scope with ethernet bus decoding built in
 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 13889
  • Country: gb
    • Mike's Electric Stuff
Re: Simple way to show ethernet packet timing on scope
« Reply #4 on: July 23, 2018, 06:01:06 pm »
Packet timing? Why a scope?
Just a cheap portmirroring networkswitch and a laptop with wireshark and you get the timing of your packets.
That doesn't show the relative timing to me pulling the packets out of the W5500, nor the length ( though that could be calculated). I basically want to know how fast packets can be sent before any get missed, and this is a function of several things, like W5500 latency, buffer size and how fast I can pull the data out.

Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1580
  • Country: de
Re: Simple way to show ethernet packet timing on scope
« Reply #5 on: July 23, 2018, 06:13:10 pm »
I understand that 100Mbit ethernet uses 4B5B encoding, scrambling and a three level transmit (MLT-3). So looking at only one differential line will not do the job at least for decoding.
I'd still think that using normal edge trigger with holdoff should to trigger on a packet.
Trying is the first step towards failure - Homer J. Simpson
 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 13889
  • Country: gb
    • Mike's Electric Stuff
Re: Simple way to show ethernet packet timing on scope
« Reply #6 on: July 23, 2018, 06:35:13 pm »
I understand that 100Mbit ethernet uses 4B5B encoding, scrambling and a three level transmit (MLT-3). So looking at only one differential line will not do the job at least for decoding.
I'd still think that using normal edge trigger with holdoff should to trigger on a packet.
I can trigger on the packet via the W5500 int pin no problem. What I want to see is the timing on the wire leading up to the W5500 deciding that it has got the packet.
 
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline 0xdeadbeef

  • Super Contributor
  • ***
  • Posts: 1580
  • Country: de
Re: Simple way to show ethernet packet timing on scope
« Reply #7 on: July 23, 2018, 07:17:13 pm »
Hm, I'd think it should be possible to determine the start of a packet visually, but triggering on it could be harder than imagined. Obviously the idle pattern (11111) is encoded into a multilevel signal that alternates all the time. So I guess anything that breaks this idle pattern is the start of a frame. I guess without dedicated HW (FPGA or whatever) that can detect the presence/absence of the idle pattern would be the only proper solution.
Trying is the first step towards failure - Homer J. Simpson
 

Online tautech

  • Super Contributor
  • ***
  • Posts: 29112
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Re: Simple way to show ethernet packet timing on scope
« Reply #8 on: July 23, 2018, 07:22:14 pm »
Holdoff should be your friend here, can you get it within the range you need Mike ?
Avid Rabid Hobbyist.
Some stuff seen @ Siglent HQ cannot be shared.
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22185
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Simple way to show ethernet packet timing on scope
« Reply #9 on: July 23, 2018, 08:16:39 pm »
Maybe more practical, set up another Ethernet chip for sending packets and measure the end-to-end delay (including transmitter and receiver)?

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 13889
  • Country: gb
    • Mike's Electric Stuff
Re: Simple way to show ethernet packet timing on scope
« Reply #10 on: July 23, 2018, 08:24:26 pm »
Once again I don't need to trigger on the packet, just see where it is relative to me reading it out of the W5500 - ideally start and end.
Sounds like the encoding makes it a lot less straightforward than I expected..
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Online tautech

  • Super Contributor
  • ***
  • Posts: 29112
  • Country: nz
  • Taupaki Technologies Ltd. Siglent Distributor NZ.
    • Taupaki Technologies Ltd.
Re: Simple way to show ethernet packet timing on scope
« Reply #11 on: July 23, 2018, 09:07:20 pm »
Once again I don't need to trigger on the packet, just see where it is relative to me reading it out of the W5500 - ideally start and end.
Sounds like the encoding makes it a lot less straightforward than I expected..
What about a Period trigger ?
Avid Rabid Hobbyist.
Some stuff seen @ Siglent HQ cannot be shared.
 

Online ajb

  • Super Contributor
  • ***
  • Posts: 2700
  • Country: us
Re: Simple way to show ethernet packet timing on scope
« Reply #12 on: July 23, 2018, 10:17:47 pm »
If you were to hook up an external PHY to the same link via an ethernet hub (not a switch!) or a passive tap, scoping its RXDV signal should give you a reasonable idea.  PHYs usually require minimal configuration, so it should be pretty easy to get a cheap PHY breakout PCB up and running for the purpose.  You might not even have to touch the SMI.
 

Online Hydron

  • Super Contributor
  • ***
  • Posts: 1029
  • Country: gb
Re: Simple way to show ethernet packet timing on scope
« Reply #13 on: July 23, 2018, 10:26:13 pm »
If you can dig out another Ethernet device with a separate MAC and PHY chip, you could try passively splitting the incoming data pair to both devices and sniff the MAC->PHY connection - it should have a deterministic latency given in the datasheet and handy pins like "receive data valid" etc if you don't want to sniff the whole bus. You probably want something using the full MII interface rather than RMII, and may need to force it to not auto-negotiate or auto crossover.

If that's not workable then maybe find said separate MAC/PHY device and put it on the transmit side? No need for any sketchy signal splitting etc in that case. Might get lucky and find a switch to use like that (I have an old gigabit switch here in London that has a separate PHY per port - let me know if you get desperate and I can chuck it on the scope to see what I get out in 100Mbit mode)

Edit: ajb - looks like I had the same idea at the same time as you! Bit slow typing it out on the phone, and it didn't give me the desktop version's new post summary thing.
« Last Edit: July 23, 2018, 10:37:25 pm by Hydron »
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8367
Re: Simple way to show ethernet packet timing on scope
« Reply #14 on: July 24, 2018, 02:54:56 am »
Don't know which scope you have but apparently some of them can do 10M/100M Ethernet decode. 100baseTX has no long-term scrambling to speak of but uses 4B5B and MLT3 to transform the bits so you might be able to trigger on a packet start if you work out what the resulting waveform should be (start of frame is very distinctive above physical layer, it may still be just as distinctive there.) Dig into IEEE 802.3 and have a look...
 

Offline ejeffrey

  • Super Contributor
  • ***
  • Posts: 3852
  • Country: us
Re: Simple way to show ethernet packet timing on scope
« Reply #15 on: July 24, 2018, 03:57:50 am »
I understand that 100Mbit ethernet uses 4B5B encoding, scrambling and a three level transmit (MLT-3). So looking at only one differential line will not do the job at least for decoding.
I'd still think that using normal edge trigger with holdoff should to trigger on a packet.
I can trigger on the packet via the W5500 int pin no problem. What I want to see is the timing on the wire leading up to the W5500 deciding that it has got the packet.

I don't know if this will give you the information you need, but you could try forcing it down to 10 megabit which has a much simpler encoding.  If you have a managed switch you may be able to force it to 10/half.  Otherwise, some NIC drivers will let you select which speeds it advertises for auto-negotiation.  Obviously the packets will have 10x longer duration, but you should be able to see the timing between the packet completed and the interrupt pin.
 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 13889
  • Country: gb
    • Mike's Electric Stuff
Re: Simple way to show ethernet packet timing on scope
« Reply #16 on: July 24, 2018, 06:49:56 am »
Don't know which scope you have but apparently some of them can do 10M/100M Ethernet decode. 100baseTX has no long-term scrambling to speak of but uses 4B5B and MLT3 to transform the bits so you might be able to trigger on a packet start if you work out what the resulting waveform should be (start of frame is very distinctive above physical layer, it may still be just as distinctive there.) Dig into IEEE 802.3 and have a look...
My MSOX3000T has envelope trigger so if I can capture a start sequence it may be possible to trigger on that
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 13889
  • Country: gb
    • Mike's Electric Stuff
Re: Simple way to show ethernet packet timing on scope
« Reply #17 on: July 24, 2018, 06:50:43 am »
If you can dig out another Ethernet device with a separate MAC and PHY chip, you could try passively splitting the incoming data pair to both devices and sniff the MAC->PHY connection - it should have a deterministic latency given in the datasheet and handy pins like "receive data valid" etc if you don't want to sniff the whole bus. You probably want something using the full MII interface rather than RMII, and may need to force it to not auto-negotiate or auto crossover.

That was my next thought....
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Online Hydron

  • Super Contributor
  • ***
  • Posts: 1029
  • Country: gb
Re: Simple way to show ethernet packet timing on scope
« Reply #18 on: July 24, 2018, 07:59:14 am »
Had a poke around on the switch I have with separate PHYs - couldn't immediately find the TX_EN pin (has BGA PHYs and a mystery switch ASIC so can't lookup pinout of either) but can definitely see the data as it's being sent out on the parallel bus (ping once a second via switch = triggered once a second).
Something like this should be enough to do the job of sniffing when packets go out once PHY and cable latency had been taken into account - PM me if you can't find an alternative solution in your junk pile and would be interested in the switch as a donation.
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4263
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Simple way to show ethernet packet timing on scope
« Reply #19 on: July 24, 2018, 08:28:59 am »
100Base-TX uses scrambling on the wires, so the line is always humming with activity even during idle periods.

Personally, I'd get an Ethernet hub, or a switch with port mirroring capability. (Many managed switches can do this; you just need to dig around in the UI to find that feature).

Then, plug it in between the two devices you want to monitor, and attach the mirrored port to a separate Ethernet device that you can probe.

On that device, look at the MII RX_DV pin with the scope.

You still don't know the latency through the switch, but it may be small compared to the times you're looking to measure.

I'm not sure whether it's possible to passively sniff a 100BaseTx line. Can't hurt to try, I suppose.

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 13889
  • Country: gb
    • Mike's Electric Stuff
Re: Simple way to show ethernet packet timing on scope
« Reply #20 on: July 24, 2018, 08:40:45 am »
100Base-TX uses scrambling on the wires, so the line is always humming with activity even during idle periods.

Personally, I'd get an Ethernet hub, or a switch with port mirroring capability. (Many managed switches can do this; you just need to dig around in the UI to find that feature).

Then, plug it in between the two devices you want to monitor, and attach the mirrored port to a separate Ethernet device that you can probe.

On that device, look at the MII RX_DV pin with the scope.

You still don't know the latency through the switch, but it may be small compared to the times you're looking to measure.

I'm not sure whether it's possible to passively sniff a 100BaseTx line. Can't hurt to try, I suppose.
A passive tap works fine with wireshark, so that should work OK. I believe 100baset is designed for about 100 metres of cable, so a couple of metres should have plenty of margin to drive two receivers
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 4263
  • Country: gb
  • Professional design engineer
    • Cawte Engineering | Reliable Electronics
Re: Simple way to show ethernet packet timing on scope
« Reply #21 on: July 24, 2018, 09:09:45 am »
Yes, it's designed for 100m and is generally quite robust against all sorts of abuse on short cables. My concern was over the protocol; if a PHY requires the ability to transmit in order to establish a connection and synchronise with the far end, then it won't work if that capability is disconnected. I've designed dozens of Ethernet devices, but always wired them point-to-point as per the spec.

I guess an easy way to tell is to disconnect one pair between two devices, and see if you can still send packets one way. You'll need to disable auto-MDIX to prevent them from trying to work out which pair is which.

Offline bson

  • Supporter
  • ****
  • Posts: 2382
  • Country: us
Re: Simple way to show ethernet packet timing on scope
« Reply #22 on: July 26, 2018, 04:20:57 am »
100M (-TX) is only 31.25MHz and you can easily probe this between the magnetics and the PHY.  However, it's 4B5B encoded (https://en.wikipedia.org/wiki/4B5B) in 3 levels, MLT-3 (https://en.wikipedia.org/wiki/MLT-3_encoding).  This is how it only needs to be 31.25MHz.  This means unless you actually have the ability to decode it it's going to be hard to identify specific IP datagrams.
« Last Edit: July 26, 2018, 04:25:55 am by bson »
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 27574
  • Country: nl
    • NCT Developments
Re: Simple way to show ethernet packet timing on scope
« Reply #23 on: July 26, 2018, 05:37:57 pm »
Once again I don't need to trigger on the packet, just see where it is relative to me reading it out of the W5500 - ideally start and end.
Sounds like the encoding makes it a lot less straightforward than I expected..
Hook up an ethernet phy to the ethernet pair you receive the packets on and use the parallel interface to trigger on. If there is data, the data strobe will be high.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online mikeselectricstuffTopic starter

  • Super Contributor
  • ***
  • Posts: 13889
  • Country: gb
    • Mike's Electric Stuff
Re: Simple way to show ethernet packet timing on scope
« Reply #24 on: August 28, 2018, 06:23:21 pm »
Just played with a Microchip KSZ8061 PHY chip, and that does exactly what I wanted - works fine in passive tap mode.

Annoyingly their eval board ( https://www.digikey.co.uk/products/en?keywords=AC320004-6%20 ) doesn't have a clock, so needs a bit of additional soldering to get working.

Scope shows 4 UDP packets, W5500 interrupt and my code pulling packets from its buffer.
Also useful to see exactly how fast my PC code is sending packets.

I might have a play with hooking it to an FPGA to turn the RMII data to 8-bit parallel to show on the scope bus display

Interestingly that Phy has a mode where you can tie two of them back-to-back to act as a repeater - that plus an FPGA might have some interesting applications for low-level realtime man-in-the-middle & fuzzing applications without any buffering delays you'd get using a normal ethernet interface.   
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf