Hint about communications: when it's worth to go with built-in Ethernet?

Go To Last Post
17 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I apologize if my question might appear silly or even off-topic. Usually my projects communicate with a PC using serial interfaces (RS232 or RS485). On the PC side there is an USB-serial converter. The kind of data exchanged is plain ascii strings (like NMEA) of about 100-bytes every dozens of ms. In some scenarios it's a question/answer pattern, in others both sides just send out data when something happens.

 

Well, now I'm going to develop a new project with the exactly same requirements of above, but where the physical medium to exchange data is Ethernet. I mean, there MUST be an Ethernet cable between the PC and my board. I cannot change this constraint.

This said, I have (at least) 3 options:

 

  1. use an MCU with a built-in TCP/IP stack (like PIC18F67J60)
  2. use any MCU (like xmega) with an external chip that does the low-level handling of the stack (like ENC28J60)
  3. use a complete Ethernet-to-serial converter (like wiznet products)

 

We've already found this options in an old thread. 

My question, now, is pretty specific: when is it worth to use an MCU with built-in Ethernet?

 

I share my idea, then I will appreciate any others.

 

In my scenario, I will exchange plain text strings. No streaming, web servers, or other features strictly related to TCP/IP protocols.

Another point is I have well-tested code for xmega, UART bootloader and many useful routines that I must rewrite if I go with another brand.

 

Hence, my opinion is to select a standalone ethernet-to-serial converter, in order to re-use my bootloader (most important).

Do you see any advantage to migrate to another microcontroller just to use a "native" ethernet connection?

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Personally, I'd just go for an off the shelf solution that has all your problems solved. You've not mentioned constraints like power, size, cost, how many you want to make etc.

I think you'll find the  PIC18F67J60 doesn't have tcp/ip built-in  - that is added in the code. The enc28j60 is like the PIC18F67J60 without the cpu. These are old devices and I would not recommend them for new designs.

For me, I'd probably hack a wireless router or use something like an Onion - these run linux and you load an app called ser2net.

 

 

Anyway, you're spoilt for choices - as to which one is 'best' is up to you.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

iw2nzm wrote:
Another point is I have well-tested code for xmega, UART bootloader and many useful routines that I must rewrite if I go with another brand.

Are you going to change also the bootloader to use Ethernet? If so, I think the third solution will be good, because it probably requires the least amount of code space. I created the bootloader for Xmega that uses Wiznet W5500 and its size was a bit less than 4KB. It had some more features than just flashing the microcontroller, I think writing the bootloader that uses W5500 and fits in 2KB wouldn't be hard task.

Regardless of the bootloader, I think the third option is really good one if you already have the code that uses USART, because change of the code to use W5500 (for example) would be very easy to do.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

Personally, I'd just go for an off the shelf solution that has all your problems solved. You've not mentioned constraints like power, size, cost, how many you want to make etc.

 

Yeah, you're right.

Very small volumes, size matters, cost doesn't nor power. Time-to-market (i.e. ready-to-use) is important.

 

Quote:
I think you'll find the  PIC18F67J60 doesn't have tcp/ip built-in  - that is added in the code. The enc28j60 is like the PIC18F67J60 without the cpu. These are old devices and I would not recommend them for new designs.

For me, I'd probably hack a wireless router or use something like an Onion - these run linux and you load an app called ser2net.

 

Anyway, you're spoilt for choices - as to which one is 'best' is up to you.

 

Of course, but it's very useful for me to listen to other ideas. I cannot simply be aware of all the products out there - and my point of view might be biased from my personal experiences.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MarekJ71 wrote:

Are you going to change also the bootloader to use Ethernet? 

 

I hope I won't. My bootloader works fine with UARTs. So using and Ethernet-to-serial converter should be enough to use it again without modifying anything.

 

Quote:

If so, I think the third solution will be good, because it probably requires the least amount of code space. I created the bootloader for Xmega that uses Wiznet W5500 and its size was a bit less than 4KB. It had some more features than just flashing the microcontroller, I think writing the bootloader that uses W5500 and fits in 2KB wouldn't be hard task.

Regardless of the bootloader, I think the third option is really good one if you already have the code that uses USART, because change of the code to use W5500 (for example) would be very easy to do.

 

Wait, why would I change the code that uses UART if I will use Wiznet? They are not transparent replacements of serial lines on ethernet (like Moxa products) ?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

iw2nzm wrote:
Wait, why would I change the code that uses UART if I will use Wiznet? They are not transparent replacements of serial lines on ethernet (like Moxa products) ?

No, at least not W5500. You connect it via SPI and and although the code that uses it is simple, you have to do something more than just write chars.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

W5500! My mistake, I read W550 (http://www.wiznet.io/product-ite...) that seems to use a transparent link.

 

Last Edited: Thu. Oct 26, 2017 - 11:47 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now I understand what you meant writing "complete Ethernet-to-serial converter".

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Dare to be naïve." - Buckminster Fuller

Last Edited: Thu. Oct 26, 2017 - 01:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
Personally, I'd just go for an off the shelf solution that has all your problems solved.
Ethernet was added to an Alvidi XMEGA128A1U by WIZnet W5200 :

http://www.alvidi.de/shop/product_info.php?info=p40_AVR-ATxmega-Development-Board-with-ATxmega128A1U.html

Kartman wrote:
... these run linux and you load an app called ser2net.
An alternative is a terminal server on either a SAMA5D2 SiP for 5 UART, a PocketBeagle with 3 UART, or an apu2 with 4 USB host ports and a spare UART (add more UARTs via the LPC)

 

GitHub

/serial-port-json-server

Serial Port JSON Server is a websocket server for your serial devices. It compiles to a binary for Windows, Mac, Linux, Raspberry Pi, or BeagleBone Black that lets you communicate with your serial port from a web application. This enables web apps to be written that can communicate with your local serial device such as an Arduino, CNC controller… http://chilipeppr.com

http://www.microchip.com/wwwproducts/en/ATSAMA5D27C-D1G

https://raw.githubusercontent.com/wiki/beagleboard/pocketbeagle/images/PocketBeagle_pinout.png

https://github.com/beagleboard/pocketbeagle/wiki/FAQ#How_do_I_get_connected_to_the_Internet

https://www.mouser.com/new/beagleboardorg/pocketbeagle/

http://pcengines.ch/apu2c0.htm

https://www.exar.com/products/interface/uarts/lpc-uarts

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
For me, I'd probably hack a wireless router ...
If there's space, place router PCBA nearby.

Simple connection from Olimex's RT5350 board (2 UART) to an Ethernet magjack :

https://github.com/OLIMEX/OLINUXINO/blob/master/HARDWARE/RT5350F/RT5350F-OLinuXino-EVB/RT5350F_OLinuXino_EVB_Rev_B.pdf

https://www.olimex.com/Products/OLinuXino/RT5350F/RT5350F-OLinuXino/open-source-hardware

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
I think you'll find the  PIC18F67J60 doesn't have tcp/ip built-in  - that is added in the code. The enc28j60 is like the PIC18F67J60 without the cpu. These are old devices and I would not recommend them for new designs.
ENC28J60 follow-on appear to be ENC424J600 and KSZ8851.

Mouser Electronics  - Electronic Components Distributor

Microchip Ethernet of Everything

Mouser Electronics

Microchip Ethernet of Everything

https://www.mouser.com/new/microchip/microchip-ethernet-of-everything/

(open Periphals tab)

http://www.microchip.com/wwwproducts/en/enc424j600

http://www.microchip.com/wwwproducts/en/ksz8851

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  1. use an MCU with a built-in TCP/IP stack (like PIC18F67J60)
  2. use any MCU (like xmega) with an external chip that does the low-level handling of the stack (like ENC28J60)

I'm worried:

  PIC18F does not have a "built in TCP/IP stack."  Perhaps it has a built-in ethernet interface and an available TCP/IP library.

  ENC28J60 does only ethernet, so you need a full TCP/IP stack in whatever processor you use.  A usable stack is probably 40kbytes (less, perhaps, with some cheating.)

 

Sounds like you should stick with serial/tcp solutions (liek SOME Wiznet chips, or Lantronix XPort, or assorted others.)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

westfw wrote:
A usable stack is probably 40kbytes (less, perhaps, with some cheating.)
Apparently less than 40KB though PIC32's TCP/IP stack has the most features :

Microchip Technology Inc

Microchip's TCP/IP Stacks

http://www.microchip.com/SWLibraryWeb/product.aspx?product=TCPIPSTACK

...

 

Microchip TCP/IP Lite Stack

The purpose of the TCP/IP Lite stack implementation is to provide optimized (low Flash and RAM footprint) TCP/IP stacks for microcontrollers with ≥ 8KB Flash (UDP only) and ≥ 16KB Flash (TCP/IP), while still having full functional TCP/IP v4 stack.

...

due to

Microchip

AN1310

High-Speed Serial Bootloader for PIC16 and PIC18 Devices

http://ww1.microchip.com/downloads/en/AppNotes/01310a.pdf

(page 18)

• TCPIP bootloaders —

 

Edit: due to

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Wed. Nov 1, 2017 - 02:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

RS232 etc is fine for low bandwith stuff.

Ethernet is of course a logic choice if RS232 bandwith is too low or if other nodes already have Ethernet, or if you want to use standarized protocols (ssh, ftp, http, etc).

 

Loads of uC's  with clock frequencies of a few hundred MHz have built in Ethernet.

For low end uC's the uC itself is probably the bottleneck.

 

There are 100's of small Linux boxes / SBC's with ethernet. Raspi is the most well known, but there are lots of different boards out there.

The "Cubox" is probably one of the smaller consumer end products.

https://www.solid-run.com/produc...

"Industrial" super mini PC's are probably available in half that size.

 

If I remember well I one saw a RJ-45 plug with not only built in transformer, but also with built in Ethernet controller and uC.

 

Some of theTPlink Ethernet <==> WiFi boxes / acces points are pretty popular in the hobby / hacker world (Reasonable quality software & documentation available).

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Paulvdh wrote:
If I remember well I one saw a RJ-45 plug with not only built in transformer, but also with built in Ethernet controller and uC.
Possibly the following that's a ColdFire MCU with Ethernet MAC and PHY :

via

Mouser Electronics

SBL2e-100IR NetBurner Ethernet Module

https://www.mouser.com/search/ProductDetail.aspx?R=0virtualkey0virtualkeySBL2e-100IR

Not as small as a Lantronix xPort and xPort has more RAM; NetBurner's MCU is about 2 or 3 times the MIPS with a second UART.

 


https://www.nxp.com/products/microcontrollers-and-processors/additional-processors-and-mcus/coldfire-plus-coldfire/coldfire-microcontrollers/coldfire-v2-mcus/integrated-coldfire-v2-ethernet-microcontrollers:MCF5223X

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Relative to a Lantronix XPort, greater flexibility with an xPico 110 :

  • Ethernet magjack or POE
  • second UART
  • more GPIO

 

https://www.lantronix.com/products/xpico-110/

https://www.mouser.com/new/lantronix/lantronix-xpico110-module/

 

"Dare to be naïve." - Buckminster Fuller