Author Topic: Ethernet Hub (switch) Design  (Read 25664 times)

0 Members and 1 Guest are viewing this topic.

Offline palpurulTopic starter

  • Regular Contributor
  • *
  • Posts: 173
  • Country: tr
  • Hey
Ethernet Hub (switch) Design
« on: January 09, 2024, 12:31:06 pm »
Hello guys!

We have an application where we have to implement an ethernet switch.

As I am fairly new to ethernet applications I have a few questions and some of them might be stupid, so bear with me :)

Application:
What we need is basically 3 ethernet connections. We have a SOM with ethernet connection, an android phone that's connected to a USB-to-Ethernet bridge (LAN950x) and an external RJ45 ethernet that we get the internet connection from. The idea is to connect all of these ethernet connections together with KSZ8794CNX chip. We want to share the internet from the RJ45 connector to SOM unit and also establish communication with the phone over the switch and over the USB-to-Ethernet switch. Is it possible?

I've been doing a little bit of research, but I don't think I understand ethernet protocol on a basic level.

A few more questions:
  • Is there a concept of master/slave in ethernet as well? In USB we have device and host, I am not sure if that's applicable to ethernet protocol as well.
  • I do not need the RGMII/MII/RMII Interfaces in KSZ8794CNX, Can I omit them?
  • The datasheet of KSZ8794CNX mentions that the port with RGMII/MII/RMII Interface is the uplink. I really don't understand what it means. Is it the master (or host) of the switch? I've been researching about this and I always get mixed answers. From reading some of the tutorials, it feels like every port on an ethernet switch is the same, but some of them has different properties.

Thanks in advance!

PS: I also posted the same question on microchip's forum, but didn't get a respond yet :(
 

Offline wasedadoc

  • Super Contributor
  • ***
  • Posts: 1663
  • Country: gb
Re: Ethernet Hub (switch) Design
« Reply #1 on: January 09, 2024, 01:03:15 pm »
Is there a concept of master/slave in ethernet as well? In USB we have device and host,  protocol as well.
No.

Be aware that a hub and a switch are different.  A hub sends incoming packets to all the other ports.  A switch sends an incoming packet only to the port that the intended recipient is connected to.
« Last Edit: January 09, 2024, 01:06:28 pm by wasedadoc »
 
The following users thanked this post: palpurul

Offline 2N3055

  • Super Contributor
  • ***
  • Posts: 7278
  • Country: hr
Re: Ethernet Hub (switch) Design
« Reply #2 on: January 09, 2024, 01:12:02 pm »
Hello guys!

We have an application where we have to implement an ethernet switch.

As I am fairly new to ethernet applications I have a few questions and some of them might be stupid, so bear with me :)

Application:
What we need is basically 3 ethernet connections. We have a SOM with ethernet connection, an android phone that's connected to a USB-to-Ethernet bridge (LAN950x) and an external RJ45 ethernet that we get the internet connection from. The idea is to connect all of these ethernet connections together with KSZ8794CNX chip. We want to share the internet from the RJ45 connector to SOM unit and also establish communication with the phone over the switch and over the USB-to-Ethernet switch. Is it possible?

I've been doing a little bit of research, but I don't think I understand ethernet protocol on a basic level.

A few more questions:
  • Is there a concept of master/slave in ethernet as well? In USB we have device and host, I am not sure if that's applicable to ethernet protocol as well.
  • I do not need the RGMII/MII/RMII Interfaces in KSZ8794CNX, Can I omit them?
  • The datasheet of KSZ8794CNX mentions that the port with RGMII/MII/RMII Interface is the uplink. I really don't understand what it means. Is it the master (or host) of the switch? I've been researching about this and I always get mixed answers. From reading some of the tutorials, it feels like every port on an ethernet switch is the same, but some of them has different properties.

Thanks in advance!

PS: I also posted the same question on microchip's forum, but didn't get a respond yet :(

There are other documents in addition to datasheet on Microchip web site page for KSZ8794CNX ..
Browse through them, there are interesting ones answering your questions in detaill..
 
The following users thanked this post: palpurul

Offline CaptDon

  • Super Contributor
  • ***
  • Posts: 2065
  • Country: is
Re: Ethernet Hub (switch) Design
« Reply #3 on: January 09, 2024, 01:56:33 pm »
A hub is sort of the electronic equivalent of hooking all the wires together, no matter where the input came from it is sent out on every port. The switch looks at the I.P. / MAC and sends out only to the port expecting that packet. The switch learns about each user connected to each port. There are firmware applications available for download when you use an FPGA controlling several 'PHY's to create your own custom Hub, Switch or Router. Be aware of the short falls of self-design with the likes of packet formatting to conform to standards of transmission. We went crazy trying to do the 'Ethernet Control Buss' on locomotives and ran into terms like 'Jabber' and 'Runts' We were simply trying to squirt raw data through the PHY's to take advantage of the robustness of ethernet signalling. The PHY's were too smart and said "No you won't, we have rules here"!


Collector and repairer of vintage and not so vintage electronic gadgets and test equipment. What's the difference between a pizza and a musician? A pizza can feed a family of four!! Classically trained guitarist. Sound engineer.
 
The following users thanked this post: palpurul

Offline soldar

  • Super Contributor
  • ***
  • Posts: 3540
  • Country: es
Re: Ethernet Hub (switch) Design
« Reply #4 on: January 09, 2024, 02:16:36 pm »
Is there a reason you do not want to use a commercial switch? You can get one pretty much for free.

I have several in my junk pile. Now that ADSL has pretty much disappeared you can get old routers for free and just use the switch part.
All my posts are made with 100% recycled electrons and bare traces of grey matter.
 
The following users thanked this post: palpurul

Offline palpurulTopic starter

  • Regular Contributor
  • *
  • Posts: 173
  • Country: tr
  • Hey
Re: Ethernet Hub (switch) Design
« Reply #5 on: January 09, 2024, 02:49:09 pm »
Is there a reason you do not want to use a commercial switch? You can get one pretty much for free.

I have several in my junk pile. Now that ADSL has pretty much disappeared you can get old routers for free and just use the switch part.

I need to integrate into a product, so I selected these chips, but I am not sure if I am doing anything completely wrong.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 8177
  • Country: de
  • A qualified hobbyist ;)
Re: Ethernet Hub (switch) Design
« Reply #6 on: January 09, 2024, 03:00:47 pm »
We want to share the internet from the RJ45 connector to SOM unit and also establish communication with the phone over the switch and over the USB-to-Ethernet switch. Is it possible?

Yes! Connecting multiple ethernet devices is the job an ethernet bridge chip. The IP (network) layer is a different story.

I've been doing a little bit of research, but I don't think I understand ethernet protocol on a basic level.

Basically there are data frames with a source and destination address (MAC), and a payload (mostly IP). Any connected device can send a frame at any time, but some clever rules help to prevent multiple devices from sending at the same time.
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 14004
  • Country: gb
    • Mike's Electric Stuff
Re: Ethernet Hub (switch) Design
« Reply #7 on: January 09, 2024, 03:01:06 pm »
Quote
  • Is there a concept of master/slave in ethernet as well? In USB we have device and host, I am not sure if that's applicable to ethernet protocol as well.
no, all nodes are equal
Quote
  • I do not need the RGMII/MII/RMII Interfaces in KSZ8794CNX, Can I omit them?
Yes
Quote
  • The datasheet of KSZ8794CNX mentions that the port with RGMII/MII/RMII Interface is the uplink. I really don't understand what it means. Is it the master (or host) of the switch? I've been researching about this and I always get mixed answers. From reading some of the tutorials, it feels like every port on an ethernet switch is the same, but some of them has different properties.
"Uplink"  is a bit of an artefact from when ethernet didn't use  auto-MDX to allow port direction to be ignored. May also be relevant for higher-end systems where one port is expected to have much more traffic or run at higher speed (as is the case with the KSZ8794, where only this port can do 1gbit), but in most cases it can just be regarded as another normal port
« Last Edit: January 09, 2024, 03:16:47 pm by mikeselectricstuff »
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 
The following users thanked this post: palpurul

Offline madires

  • Super Contributor
  • ***
  • Posts: 8177
  • Country: de
  • A qualified hobbyist ;)
Re: Ethernet Hub (switch) Design
« Reply #8 on: January 09, 2024, 03:16:47 pm »
The switch looks at the I.P. / MAC and sends out only to the port expecting that packet.

The classic ethernet switch (bridge) looks at the destination MAC. When it's also lookting at the IP destination address it would be a so-called layer 3 switch (switch and router in one box/chip). The differentiation is based on the OSI reference model (ethernet = link layer, IP = network layer).

Be aware of the short falls of self-design with the likes of packet formatting to conform to standards of transmission. We went crazy trying to do the 'Ethernet Control Buss' on locomotives and ran into terms like 'Jabber' and 'Runts' We were simply trying to squirt raw data through the PHY's to take advantage of the robustness of ethernet signalling. The PHY's were too smart and said "No you won't, we have rules here"!

If you want to create your own protocol on top of ethernet it has to be done at the network layer (ethernet's payload).
 
The following users thanked this post: palpurul

Offline palpurulTopic starter

  • Regular Contributor
  • *
  • Posts: 173
  • Country: tr
  • Hey
Re: Ethernet Hub (switch) Design
« Reply #9 on: January 09, 2024, 03:19:15 pm »
Quote
  • Is there a concept of master/slave in ethernet as well? In USB we have device and host, I am not sure if that's applicable to ethernet protocol as well.
no, all nodes are equal
Quote
  • I do not need the RGMII/MII/RMII Interfaces in KSZ8794CNX, Can I omit them?
Yes
Quote
  • The datasheet of KSZ8794CNX mentions that the port with RGMII/MII/RMII Interface is the uplink. I really don't understand what it means. Is it the master (or host) of the switch? I've been researching about this and I always get mixed answers. From reading some of the tutorials, it feels like every port on an ethernet switch is the same, but some of them has different properties.
"Uplink"  is a bit of an artefact from when ethernet didn't use  auto-MDX to allow port direction to be ignored. May also be relevant for higher-end systems where one port is expected to have much more traffic or run at higher speed, but in most cases it can just be regarded as another normal port

Thank you for your response, that was very helpful.

Do you have any recommendation for ethernet PCB design. Terminations, magnetics and everything is bit confusing. It seems like each connector is a bit different (some of them have magnetics and terminations, some of them have none, some of them have termination or magnetics etc.), and there are also different things on the chip side as well. Some chips have terminations, and some chips don't. I am looking for a document or tutorials that kind of covers termination, magnetics and everything else. If you have anything for me please let me know.
 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 14004
  • Country: gb
    • Mike's Electric Stuff
Re: Ethernet Hub (switch) Design
« Reply #10 on: January 09, 2024, 04:00:25 pm »
Quote
  • Is there a concept of master/slave in ethernet as well? In USB we have device and host, I am not sure if that's applicable to ethernet protocol as well.
no, all nodes are equal
Quote
  • I do not need the RGMII/MII/RMII Interfaces in KSZ8794CNX, Can I omit them?
Yes
Quote
  • The datasheet of KSZ8794CNX mentions that the port with RGMII/MII/RMII Interface is the uplink. I really don't understand what it means. Is it the master (or host) of the switch? I've been researching about this and I always get mixed answers. From reading some of the tutorials, it feels like every port on an ethernet switch is the same, but some of them has different properties.
"Uplink"  is a bit of an artefact from when ethernet didn't use  auto-MDX to allow port direction to be ignored. May also be relevant for higher-end systems where one port is expected to have much more traffic or run at higher speed, but in most cases it can just be regarded as another normal port

Thank you for your response, that was very helpful.

Do you have any recommendation for ethernet PCB design. Terminations, magnetics and everything is bit confusing. It seems like each connector is a bit different (some of them have magnetics and terminations, some of them have none, some of them have termination or magnetics etc.), and there are also different things on the chip side as well. Some chips have terminations, and some chips don't. I am looking for a document or tutorials that kind of covers termination, magnetics and everything else. If you have anything for me please let me know.
see if you can find appnotes or reference designs for the switch chip or anything similar. 100M isn't too critical for PCB layout etc.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 
The following users thanked this post: palpurul

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 3894
  • Country: nl
Re: Ethernet Hub (switch) Design
« Reply #11 on: January 09, 2024, 06:47:45 pm »
"Uplink"  is a bit of an artefact from when ethernet didn't use  auto-MDX to allow port direction to be ignored. May also be relevant for ...

Best I know, the "Uplink" is also used for packets the switch does not know what to do with such as incoming DHCP requests. Although a switch may also work on the ethernet layer and not look into TCP/IP packets at all. There are also different sorts of switches. Have a look at "Managed switch" for the more advanced versions.

True Hub's probably don't exist anymore (for Ethernet). They were a thing in the 10Mbps era when electronics was a lot more expensive, but that was ages ago.

Maybe it is a good idea to use a commercially available switch and then open the housing and just use the PCB. I also have vague memories of very small USB hubs that just have solder pads and are meant to permanently put into 3rd-party equipment. (I think I saw them on Hackaday / Tindie) Maybe something similar exists for Ethernet.
 
The following users thanked this post: palpurul

Online magic

  • Super Contributor
  • ***
  • Posts: 7243
  • Country: pl
Re: Ethernet Hub (switch) Design
« Reply #12 on: January 09, 2024, 07:12:45 pm »
A switch does work at Ethernet layer and does not care about IP addresses and protocols like DHCP...

Some advanced switch ICs can do other things, for example VLANs or even layering violation like IPv4 NAT offload, but such functionality must be specifically enabled and configured by out-of-band means (i.e. non-Ethernet pins on the chip).

A physical box which contains a switch may also contain other things, for example a simple Ethernet and IP host capable of monitoring and configuring the switch, or a router. These are logically separate components and usually separate chips.

A switch IC may or may not have some dedicated ports meant primarily to connect with such on-board hosts (rather than external RJ45 jacks).
 
The following users thanked this post: palpurul

Offline mariush

  • Super Contributor
  • ***
  • Posts: 5143
  • Country: ro
  • .
Re: Ethernet Hub (switch) Design
« Reply #13 on: January 09, 2024, 07:28:30 pm »
Could you live with just 100 mbps?

LCSC has cheap 5 port switch chips like RTL8305 : https://www.lcsc.com/product-detail/Ethernet-ICs_Realtek-Semicon-RTL8305NB-VB-CG_C3010343.html

1.2$ for one, 0.75$ for 100 ..

some notes about the eeprom for optional configuration : https://github.com/tomazas/RTL8XXX-Switch/tree/master
and some application note for one of the switch chips : https://www.yumpu.com/en/document/read/50509937/realtek-rtl8305sb-port-4-application-note

There's also 5+2 gigabit switch RTL8367s for around 2.5$ : https://www.lcsc.com/product-detail/Ethernet-ICs_Realtek-Semicon-RTL8367S-CG_C2760849.html

.. and a 8 port gigabit switch IC RTL8370 for $4.1 a piece (and not much discount in higher volume)  : https://www.lcsc.com/product-detail/Ethernet-ICs_Realtek-Semicon-RTL8370N-VB-CG_C2803243.html

 
The following users thanked this post: palpurul, spostma

Offline palpurulTopic starter

  • Regular Contributor
  • *
  • Posts: 173
  • Country: tr
  • Hey
Re: Ethernet Hub (switch) Design
« Reply #14 on: January 10, 2024, 03:46:42 pm »
Could you live with just 100 mbps?

LCSC has cheap 5 port switch chips like RTL8305 : https://www.lcsc.com/product-detail/Ethernet-ICs_Realtek-Semicon-RTL8305NB-VB-CG_C3010343.html

1.2$ for one, 0.75$ for 100 ..

some notes about the eeprom for optional configuration : https://github.com/tomazas/RTL8XXX-Switch/tree/master
and some application note for one of the switch chips : https://www.yumpu.com/en/document/read/50509937/realtek-rtl8305sb-port-4-application-note

There's also 5+2 gigabit switch RTL8367s for around 2.5$ : https://www.lcsc.com/product-detail/Ethernet-ICs_Realtek-Semicon-RTL8367S-CG_C2760849.html

.. and a 8 port gigabit switch IC RTL8370 for $4.1 a piece (and not much discount in higher volume)  : https://www.lcsc.com/product-detail/Ethernet-ICs_Realtek-Semicon-RTL8370N-VB-CG_C2803243.html

Yep, I think I've seen those chips in some of the teardowns. They are quite common for switch design I think. I definitely don't need gigabit, 100Mbit is fine to me.

Thanks for the info!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf