Ethernet in embedded application - Page 1
Forum section: electronics / general

author: Kittu20
author_rank: Regular Contributor
timestamp: February 25, 2023, 03:41:59 pm
content: have you ever used ethernet in embedded application maybe you can clear my confusion. I just wanted to know what was the reason in your project that you think you should use ethernet.I know one example of ethernet, suppose we have a computer and a printer that we want to connect to a network. We can connect them to a switch or router using Ethernet cables. The switch or router will act as a central hub for communication between the devices, allowing them to exchange data and communicate with other devices on the network.I have no idea how and when to use Ethernet in embedded application. can anyone tell me about your project where you have used ethernet

author: tellurium
author_rank: Frequent Contributor
timestamp: February 25, 2023, 04:05:30 pm
content: Isn't printer an "embedded application"?

author: Siwastaja
author_rank: Super Contributor
timestamp: February 25, 2023, 04:07:43 pm
content: One example: building automation system, which primarily just needs internet access, but also in some specific cases, needs TCP connectivity to a solar inverter, for example.Choice had to be made between WiFi and ethernet. Ethernet was chosen because:(a) most customers (households, commercial, light industrial) have a router with at least one free ethernet port,(b) Ethernet is more reliable than WiFi especially against configuration errors and changes(c) No configuration is (usually) needed - just plug it in, router gives it an IP address with DHCP, and you have access. WiFi requires configuration procedure, which needs to be explained to the customer, and which also needs to be redone if new router is installed.How? We ended up with Wiznet W6100. There were no large problems and it works fine. Was probably at least somewhat easier to integrate than software TCP/IP stacks.

author: kripton2035
author_rank: Super Contributor
timestamp: February 25, 2023, 05:03:47 pm
content: W32-ETH01https://www.aliexpress.com/item/1005003807175034.htmlyou program it with the arduino IDE...

author: rstofer
author_rank: Super Contributor
timestamp: February 25, 2023, 05:24:34 pm
content: Back around 1970, I was introduced to the IBM 1130 and Fortran. I spent a LOT of time programming that machine and I really enjoyed using it for EE classes, especially the drum plotter for Bode' Plots and such.Some time back, I built an FPGA emulation that runs the IBM software unchanged and at about 100 times faster but I didn't have a plotter; I had a LaserJet.So, I picked up an mbed LPC1768, built a daughter card with the required MagJack and used the Ethernet library to connect the uC to the LaserJet and SPI to communicate with the FPGA. There was a lot of code to convert from IBM 6 bit commands to HPGL sentences but I'll skip over that. The entire IBM plotter library works unchanged.Here's a photo of the real system but ours were IBM blue:http://computermuseum.informatik.uni-stuttgart.de/dev/ibm1130/ibm1130.htmlNote the drum plotter...This use of Ethernet is about embedded as it gets! The uC takes an input stream, does some transformations and sends an output stream to the LaserJet using Berkeley Sockets. This protocol is native at the printer, no real effort to make the connection and send the stream.

author: rstofer
author_rank: Super Contributor
timestamp: February 25, 2023, 05:54:15 pm
content: Hint to beginning uC developers: Berkeley Sockets is easy to implement because almost every Ethernet library will implement the lower level stuff. Client and Server code is pretty easy and, since TCP guarantees correct delivery, next layer up software is easy to write.There is code all over the Internet including:https://www.paulgriffiths.net/program/c/sockets.php

author: peter-h
author_rank: Super Contributor
timestamp: February 25, 2023, 06:01:24 pm
content: Ethernet adds huge complexity to an embedded project. Even lifting everything you can find online, you will spend months of your life debugging, fixing, going down rabbit holes (half of github is nonworking junk). Don't ask me how I know...

author: nctnico
author_rank: Super Contributor
timestamp: February 25, 2023, 06:18:37 pm
content: Quote from: Siwastaja on February 25, 2023, 04:07:43 pmI second the suggestion to use the Wiznet chips. I have used the uIP and LWIP software stacks as well but these are horrible to configure & use.

author: peter-h
author_rank: Super Contributor
timestamp: February 25, 2023, 06:32:13 pm
content: Depends on the cost sensitivity, performance, security (various aspects) and futureproofing that you need.

author: rstofer
author_rank: Super Contributor
timestamp: February 25, 2023, 06:50:40 pm
content: Today, I would be inclined to use the Raspberry Pi Pico W (for wifi). My application is trivial, monitor the running current of a remote sump pump and display the run status to a browser via an HTTP Server on the Pico. It's trivial given that there is an HTTP Server example to copy. The device is about $6 at Adafruit but you will probably have to solder the two 20 pin headers if you want delivery:https://www.adafruit.com/product/5525This is a neat module and connects right up to my WiFi LAN.I bought several of the Picos, some with WiFi, some without. They are really easy to work with using MicroPython and the Thonny IDE.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: February 25, 2023, 07:06:02 pm
content: Quote from: peter-h on February 25, 2023, 06:01:24 pmThat depends a lot on what you are doing. I used the Wiznet chips to do UDP for data for a lighting system - took maybe 3 days to get it all up & running.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: February 25, 2023, 07:07:49 pm
content: Quote from: nctnico on February 25, 2023, 06:18:37 pmI Third it. The only issues I've had are lack of support for long fragmented UDP packets, and packet loss problems when using a MEMS oscillator instead of a crystal.

author: Siwastaja
author_rank: Super Contributor
timestamp: February 25, 2023, 07:16:22 pm
content: I also bolted mbedTLS on top of the W6100 code and it was not too bad, but maybe 1-2 weeks worth of hard full-time work, mostly working through what all those TLS-related acronyms mean. It is working flawlessly though and I'm happy about that. If all you need are raw TCP sockets or UDP datagrams, then I'm sure the project's going to be very simple with Wiznet chips. Their example code is crappy, but crappy in agoodway - no overengineering or complex architecture.

author: peter-h
author_rank: Super Contributor
timestamp: February 25, 2023, 08:10:29 pm
content: QuoteHow do you deal with a production application?QuoteIF indeedThat's where LWIP comes in.QuoteYou are an expert. Then all this is easy

author: nctnico
author_rank: Super Contributor
timestamp: February 25, 2023, 10:35:30 pm
content: Quote from: peter-h on February 25, 2023, 08:10:29 pmFYI: the Wiznet chips also support raw sockets (getting packets from the network directly). Still, all the network stuff, low level packet handling and buffering is done by the Wiznet chip.

author: rstofer
author_rank: Super Contributor
timestamp: February 26, 2023, 02:10:59 am
content: Quote from: peter-h on February 25, 2023, 08:10:29 pmNot even a remote consideration, I am LONG retired.It is still worth noting that the mbed LPC1768 requires only a MagJack to get wired ethernet. The mbed library is based on LWIP so it's pretty solid.As to WiFi? I might think about the WizNet approach.

author: peter-h
author_rank: Super Contributor
timestamp: February 26, 2023, 06:28:17 am
content: QuoteThat's exactly my view. The main issue with LWIP is the configuration learning curve. But you cut out much of that if you are doing this just to be able to advertise that your product has "ethernet" i.e. you are happy with low performance, which is exactly what you will get with an SPI attached ETH moduleAlso with some chips e.g. ESP32 you get an LWIP config which does actually work out of the box. With ST, basically nothing works out of the box.

author: westfw
author_rank: Super Contributor
timestamp: February 26, 2023, 06:48:45 am
content: QuoteCompared to WiFi that amateurs are pros alike are throwing around like candy? Hah!

author: peter-h
author_rank: Super Contributor
timestamp: February 26, 2023, 07:41:24 am
content: I think wifi and bluetooth are even harder to get right. But usually the very large companies that tend to make such products have the resources to make it work.It's funny how the OP tossed in a little piece of chewing gum and a whole bunch of people are fighting over itAnd he's gone.

author: SiliconWizard
author_rank: Super Contributor
timestamp: February 26, 2023, 07:06:24 pm
content: Quote from: peter-h on February 26, 2023, 07:41:24 amHappens very frequently here.

author: westfw
author_rank: Super Contributor
timestamp: February 27, 2023, 12:39:12 am
content: Happens very frequently everywhere.My impression is that this particular "drive-by" problem is worse on the highly official vendor forums; people will ask a question and apparently never show up to see the answers. At least on these less official forums, we frequently get interesting (and even useful to many) conversations out of such prompts...

author: peter-h
author_rank: Super Contributor
timestamp: February 27, 2023, 06:21:50 am
content: I dont have much experience of vendor forums - only the ST one - but that may be because usually nobody on there posts a sensible or useful reply and then - due to the vast volume of questions posted by variously desperate people - the question scrolls off rapidly and nobody sees it anyway. On the ST forum that is basically what happens all day long.Addressing this unfortunately requires mod/admin participation. For example I co-run a forum (in technology, not electronics) and every morning when I get out of bed I "promote" new topics to home page banners. There is room for about 5 of these. They stay up there for 24hrs. Exceptionally 48hrs. And > 95% of readers come in via this home page. So if somebody asks a question which looks intelligent, it gets promoted for a day and usually draws good responses, and we get a good thread. If it looks like it was a drive-by posting, I don't promote itBut somebody has to do this work... and the mod has to actually understand the subject to perform this function.But then we have no adverts so no income.

author: tggzzz
author_rank: Super Contributor
timestamp: February 27, 2023, 10:45:49 am
content: Quote from: peter-h on February 26, 2023, 07:41:24 amGiven the OP's previous posting record (and questions), that was entirely predictable.