Author Topic: Ethernet board development!!!  (Read 4504 times)

0 Members and 1 Guest are viewing this topic.

Offline pub2024Topic starter

  • Contributor
  • !
  • Posts: 11
  • Country: ro
Ethernet board development!!!
« on: January 20, 2024, 05:33:00 pm »
Hi everyone,

This is my first post in this forum. Here is my problem: I would like to develop a 10/100 ethernet card with the help of which I can send some output states (ON/OFF) on some pins of microcontrolers (which will actuate some relays). I have a little introduction to Atmel and ARM STM32 microcontrollers and I don't know how I can build such a PCB as simply as possible!!!

I was thinking of using an ARM STM32F103 with 48 pins together with a LAN8720A to be able to connect the Rj-45 connector and implicitly the ethernet connection. Do you think I could make this simple ethernet board with this STM32 and LAN8720A? Or would it be even simpler to try with an Atmel microcontroller + LAN8720A? And if so, what type of Atmel microcontroller would you recommend?

Of course, any other simpler solution is welcome. I wouldn't necessarily want to use the LAN8720A!!! However, I would like something on Atmel or STM32 microcontrollers!.

Please.
 

Online kripton2035

  • Super Contributor
  • ***
  • Posts: 2587
  • Country: fr
    • kripton2035 schematics repository
Re: Ethernet board development!!!
« Reply #1 on: January 20, 2024, 05:42:03 pm »
 

Offline pub2024Topic starter

  • Contributor
  • !
  • Posts: 11
  • Country: ro
Re: Ethernet board development!!!
« Reply #2 on: January 20, 2024, 06:02:19 pm »
Thanks for the answer, but could I connect two such cards from your example via ethernet cable and pair them client-server, so that when I give an impulse on an input of one card, the other card responds, on a specific output pin?
 

Offline fchk

  • Regular Contributor
  • *
  • Posts: 245
  • Country: de
Re: Ethernet board development!!!
« Reply #3 on: January 20, 2024, 06:07:59 pm »
The simplest hardware solution would be a PIC18F67J60. This is a 64 pin chip containing 8 bit processor, flash, RAM, UART/I2C, SPI, Ethernet MAC and Ethernet PHY. The only thing you need to add is 3.3V power, 25 MHz crystal, some passives, and a magjack.

https://www.microchip.com/en-us/product/pic18f67j60

From a software perspective the easiest way is a Wiznet 6100 chip connected via SPI to your preferred microcontroller. This chip has got the basic Internet protocols hardwired, so you don't need any software for this.
https://www.wiznet.io/product-item/w6100/

STM32F103 is old, and you risk getting fakes. Use something newer and better. STM32F302 for example.
https://www.st.com/en/microcontrollers-microprocessors/stm32f302.html

If you want Microchip (ex-Atmel), then use the newer AVR128D* instead of the old Atmega series.
 

Offline pub2024Topic starter

  • Contributor
  • !
  • Posts: 11
  • Country: ro
Re: Ethernet board development!!!
« Reply #4 on: January 20, 2024, 07:16:29 pm »
Thanks for the reply.
I will analyze your solutions.
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3710
  • Country: nl
Re: Ethernet board development!!!
« Reply #5 on: January 20, 2024, 08:05:05 pm »
I was thinking of using an ARM STM32F103 with 48 pins together with a LAN8720A to be able to connect the Rj-45 connector and implicitly the ethernet connection.

This is not going to work. The LAN8720A is a PHY that needs a RMII connection to an ethernet MAC. The STM32F103 does not have this interface.

It could be done with a STM32F407 or one of the other STM devices that have an ethernet MAC integrated as peripheral.

If it is only about switching some output pins from a server, then a solution with an already mentioned Wiznet chip like the W5500 and an AVR chip like on the Arduino nano can do the trick.

I would recommend to first buy a couple of modules and slap them together to get your software working and see if your concept works and then think of designing a PCB for it.

Sorry for links to the Dutch Aliexpress site, but the item id will be the same in what ever country/language you need them.

For instance a W5500 module example here https://nl.aliexpress.com/item/32832354059.html and a STM32F103 module example here https://nl.aliexpress.com/item/1005005764647193.html.

Or a LAN8720 module example here https://nl.aliexpress.com/item/32485939954.html and a STM32F407 module example here https://nl.aliexpress.com/item/4000602517153.html

There are many different solutions of course and my point was to make you aware of looking at the specifications of the devices you are looking at to make sure they match with each other.

Online kripton2035

  • Super Contributor
  • ***
  • Posts: 2587
  • Country: fr
    • kripton2035 schematics repository
Re: Ethernet board development!!!
« Reply #6 on: January 20, 2024, 08:21:01 pm »
Thanks for the answer, but could I connect two such cards from your example via ethernet cable and pair them client-server, so that when I give an impulse on an input of one card, the other card responds, on a specific output pin?
yes you can do that with these cards. you need to program the esp32 one as a client and one as a server. it can be done using arduino ide for these boards.
 

Online tellurium

  • Regular Contributor
  • *
  • Posts: 229
  • Country: ua
Re: Ethernet board development!!!
« Reply #7 on: January 20, 2024, 10:09:40 pm »
A possible solution: (almost) any micro + W5500 (MAC + PHY).
Example board: W5500-EVB-Pico, which is RP2040 + W5500
https://docs.wiznet.io/Product/iEthernet/W5500/w5500-evb-pico

They share schematic, etc.

If you want TCP/IP to fly via your Ethernet connection, you'd better choose a micro with more RAM - and rp2040 there is a good choice for this regard.

Another solution is ch32v307, which has MAC + PHY onboard - and it has been discussed on this forum extensively.
« Last Edit: January 20, 2024, 10:12:23 pm by tellurium »
Open source embedded network library https://mongoose.ws
TCP/IP stack + TLS1.3 + HTTP/WebSocket/MQTT in a single file
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 26907
  • Country: nl
    • NCT Developments
Re: Ethernet board development!!!
« Reply #8 on: January 20, 2024, 10:54:39 pm »
I second the solution for using a Wiznet chip. The easiest solution by far and nowadays they also have IPv6 versions available.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline pub2024Topic starter

  • Contributor
  • !
  • Posts: 11
  • Country: ro
Re: Ethernet board development!!!
« Reply #9 on: January 21, 2024, 07:17:25 pm »
Thank you all for the answers.

I especially appreciate the response of the user @pcprogrammer who said, I quote: "This is not going to work. The LAN8720A is a PHY that needs a RMII connection to an ethernet MAC. The STM32F103 does not have this interface".
I will continue to analyze the solutions proposed by you. Thank you very much everyone.
 
The following users thanked this post: pcprogrammer

Offline tilblackout

  • Contributor
  • Posts: 31
  • Country: cn
Re: Ethernet board development!!!
« Reply #10 on: January 22, 2024, 03:50:55 am »
Basically, every product in my company uses Ethernet with RGMII interface. According to my experience, only high-end chips support this interface. For example, chips that support Cortex-A cores and can run Linux such as STM32 MP series, as well as high-end MCU chips such as I.MX RT series from NXP.
 

Online pcprogrammer

  • Super Contributor
  • ***
  • Posts: 3710
  • Country: nl
Re: Ethernet board development!!!
« Reply #11 on: January 22, 2024, 07:42:41 am »
Basically, every product in my company uses Ethernet with RGMII interface. According to my experience, only high-end chips support this interface. For example, chips that support Cortex-A cores and can run Linux such as STM32 MP series, as well as high-end MCU chips such as I.MX RT series from NXP.

Good for your company, but the OP specifically mentioned 10/100Mbit ethernet, so no need for high end chips that support 1Gbit ethernet. Even a simple AVR with a W5500 can do the trick. There are examples around in the Arduino world where this combination allows controlling pins from another computer. This seems to be all the OP is after.

Offline elektryk

  • Regular Contributor
  • *
  • Posts: 81
  • Country: pl
Re: Ethernet board development!!!
« Reply #12 on: January 22, 2024, 09:00:59 am »
Quote
I would like to develop a 10/100 ethernet card with the help of which I can send some output states (ON/OFF) on some pins of microcontrolers (which will actuate some relays).

Easy solution to do that is ENC28J60 with AVR. For toggling some pins 10Mbps should be sufficient.
http://tuxgraphics.org/electronics/200905/embedded-tcp-ip-stack.shtml
 

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 3698
  • Country: gb
  • Doing electronics since the 1960s...
Re: Ethernet board development!!!
« Reply #13 on: January 22, 2024, 10:01:07 am »
The hardware for this is trivial. Just buy some development board which has

- an RJ45 connector with integrated magnetics (Hanrun is a big name)
- a PHY chip (e.g. LAN8742)
- a CPU which can talk to the PHY chip, and has some GPIO pins which can drive whatever...

But that is about 1% of the job. The other 99% is software to make it all work. You need a TCP/IP stack on the CPU; I use LWIP which, like most high-profile open source software, does work but needs a lot of, shall we say, "integration work" :) and there is no support anywhere. Then you need an application running on the CPU which interfaces to the TCP/IP module (with LWIP you can use BSD sockets or Netconn APIs). Then you need to spend months or years googling for patches to make it all reliable. Then to get a properly finished product you need to write a user interface for configuration, via USB (VCP and/or MSC and a config file) or via an HTTP server running on your box. You can find HTTP server code all over the place, most of it horribly bloated; I started with one such and after some weeks binned it and wrote my own very simple HTTP server in a week or two.

I've done all this (with a colleague, over past 5 years) and really would not want to do it again, ever. I used a STM32F417 and one could not do it with much less by the time you have a "fully finished" product with the above mentioned user interface etc. If you read the many threads I have started here over the last few years you will get the idea :)

Now of course it is all "easy", but I am not going to post a useless statement like that here :) Yes my box does all the above and much more. So if you had a commercial requirement I could easily knock up a daughter board for it (it has an SPI expansion port) with a bunch of MOSFETs or relays. It powers up, gets an IP via DHCP (or fixed IP) and then you could just send it packets. Or you could buy my box (under $200) and design your own expansion board. It also has four serial ports so you could squirt out strings via those.

STM have various "DISCO" boards and you can use CUBE IDE to generate most of the code, and it may even more or less work at a basic level. I think most micro vendors do a similar thing. But  these are just to get you started - beyond flashing an LED they are hard work.

Another much simpler approach which was popular in the early 1990s was to forget TCP/IP and just make a box which receives UDP packets and extracts some bits from them and uses these to drive I/O signals. I used to sell such a thing back then (it was German made). The data was not routable of course, the box had no IP address, just a MAC address which was partly set up on dipswitches. That could probably be done with just the RJ45 and some PHY chip and a simple micro which can talk to the PHY chip using the standard "64 bit UART" interface etc. Or maybe there are PHY chips which are even simpler... This approach might work for you but you could not sell it generally because today everybody wants a TCP/IP product, with all the mod cons like DHCP... it would be a support nightmare because everybody thinks RJ45 = TCP/IP :)

« Last Edit: January 22, 2024, 10:59:02 am by peter-h »
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Online kripton2035

  • Super Contributor
  • ***
  • Posts: 2587
  • Country: fr
    • kripton2035 schematics repository
Re: Ethernet board development!!!
« Reply #14 on: January 22, 2024, 11:29:18 am »
really, using the board(s) I gave you above, and two arduino scripts one for the server, one for the client
these scripts are in the arduino IDE examples
it is a quite simple task...
with other controllers it can be more "professional" but really more difficult to achieve...
 

Online kripton2035

  • Super Contributor
  • ***
  • Posts: 2587
  • Country: fr
    • kripton2035 schematics repository
Re: Ethernet board development!!!
« Reply #15 on: January 22, 2024, 11:31:43 am »

 

Offline mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13748
  • Country: gb
    • Mike's Electric Stuff
Re: Ethernet board development!!!
« Reply #16 on: January 22, 2024, 11:57:27 am »
+1 for Wiznet W5500 + any cheap MCU (e.g.CH32V003)
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Offline pub2024Topic starter

  • Contributor
  • !
  • Posts: 11
  • Country: ro
Re: Ethernet board development!!!
« Reply #17 on: January 22, 2024, 08:39:02 pm »
Thanks again for the answers.

Today a friend brought me a NUCLEO-G474RE board and I would like to know if I can connect another Ethernet board with ENC28J60 to that board ???
 

Offline bingo600

  • Super Contributor
  • ***
  • Posts: 1989
  • Country: dk
Re: Ethernet board development!!!
« Reply #18 on: January 22, 2024, 08:47:16 pm »
Some of the early  ENC28J60 boards had a MDIX error, meaning that they couldn't do "Auto crossover".
So you had to use a "Crossed ethernet cable".

My suggestion would be to connect both boards to an ethernet switch, and let the switch handle the crossover, and speed/duplex negotiation.

Then it ought to work.

/Bingo
 

Offline pub2024Topic starter

  • Contributor
  • !
  • Posts: 11
  • Country: ro
Re: Ethernet board development!!!
« Reply #19 on: February 03, 2024, 07:08:23 am »
If you want Microchip (ex-Atmel), then use the newer AVR128D* instead of the old Atmega series.
We are just analyzing a solution with AVR128D* microcontroller, but I can't find a USB programming board for this series of microcontrollers on the net! Can you help me with an example?
I have boards for programming the old AVR series, but it is not possible to program the AVR128D series that appeared a few years ago!
 

Offline elektryk

  • Regular Contributor
  • *
  • Posts: 81
  • Country: pl
Re: Ethernet board development!!!
« Reply #20 on: February 03, 2024, 09:48:35 am »
There are some dev boards for AVR128, for example https://www.microchip.com/en-us/development-tool/dm164151

If you need programmer only, then check MPLAB Snap.
« Last Edit: February 03, 2024, 09:50:06 am by elektryk »
 

Offline pub2024Topic starter

  • Contributor
  • !
  • Posts: 11
  • Country: ro
Re: Ethernet board development!!!
« Reply #21 on: February 03, 2024, 10:09:39 am »
I have seen MPLAB® SNAP at various online stores, but the user manual is quite shallow. For example, in the case of programming some AVR microcontrollers, not exactly all types of microcontrollers supported by this PCB programmer are mentioned and the output connector (see the image below) does not show how to connect it to an AVR or Atmega microcontroller, where we have MISO, MOSI, SCK etc pins???
« Last Edit: February 03, 2024, 12:20:21 pm by pub2024 »
 

Offline elektryk

  • Regular Contributor
  • *
  • Posts: 81
  • Country: pl
Re: Ethernet board development!!!
« Reply #22 on: February 03, 2024, 03:05:48 pm »
 

Offline pub2024Topic starter

  • Contributor
  • !
  • Posts: 11
  • Country: ro
Re: Ethernet board development!!!
« Reply #23 on: February 04, 2024, 07:40:05 am »
Thanks.
 

Offline elektryk

  • Regular Contributor
  • *
  • Posts: 81
  • Country: pl
Re: Ethernet board development!!!
« Reply #24 on: February 05, 2024, 05:31:30 am »
I'm not sure if they improved it in newer revisions but I had to add pullup in mine to work with UPDI (just added pullup without removing pull down).
https://ww1.microchip.com/downloads/en/DeviceDoc/ETN36_MPLAB%20Snap%20AVR%20Interface%20Modification.pdf
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf