PDA

View Full Version : Ethernet with microcontrollers



ShaneMichael
- 18th August 2017, 00:22
I have been asked to add Ethernet to the microcontroller on my project. I'm using an 18F4553 at this time. The microcontroller needs to handle the IP itself. I see the PIC18F97J60 supports Ethernet, but I don't find designers going this route, seems the preferred method to add Ethernet is to use something like the Lantronix XPort Pro. I also don't find many code examples to implement Ethernet in Microcode. Looks like a Nuts-N-Volts article was discussed several years ago.

This request comes from a steering group for the project, one person believes the Ethernet needs to be built on the microcontroller to future proof the board from components getting phased out. At this time the communication is from the USART to a wireless network modem that is embedded on the circuit board. The fear is the network modem may change their footprint, or not make the embedded wireless modem option at some future time. If that happens then we would need a hardware change to the circuit board at that time. The same argument was made against using something like the Lantronix serial to Ethernet adapter.

So my questions are; what are my options to add Ethernet to the Microcontroller? Is there Pic Basic support for Ethernet, what I found didn't look friendly? Would I need to change to a different language like "C" and upgrade to something with more processing power to reliably incorporate Ethernet to the microcontroller/microprocessor?

Let me know if I missed something obvious, like the thread that has all the information that I'm looking for.

Thanks

HenrikOlsson
- 18th August 2017, 07:34
Hi,

If you absolutely "must" avoid offloading the Ethernet stuff to a module then, and I hate to say it, PBP probably isn't your best option. I'm certainly no expert on this but having written PBP code for the Wiznet W5100 chip to do DHCP, SMPT, SNTP etc which are all "high level" stuff "on top of" the TCP and UDP protocols (which the W5100 handles in this case) I can tell you that implementing (and using) a full TCP/IP stack in PBP is what I personally would consider a monumental task. Yes, it has been done, at least to some extent. I have not tried it and I agree that it's far from "friendly".

With that said, you're always running the risk of a part getting obsolete forcing a hardware and/or software revision. I don't know if you're building dozens or tens of thousands of this product but I'd try to talk to the people at Lantronix, Tibbo, Wiznet etc to see if you can get an idea of the planned lifetime for the potential product and possibly stock up on it as it approaches EOL so you have time to re-think the situation at that time.

Microchip has a TCP/IP stack for their C-compiler, if you "must" incorporate the Ethernet stuff in the main microcontroller I'd probably read up on that (personally I don't "do" C so I'd be in the shit). Then, if you're redesigning the product to use a new microcontroller perhaps moving to a 32bit one which I'm sure will handle the Ethernet stuff much better than an 8-bit one. But, that too, is indeed a big task. Much bigger than being forced to switch to a different module 5 years down the road I'd think.

/Henrik.

pedja089
- 18th August 2017, 10:36
I have been working on and off on PBP Ethernet, and it's not easy. And not friendly, at all. Base of my work is article from Nuts and Volts, and building from there using various examples from net.
But one thing that surprises me a lot is that PBP is much more efficient than C. Lot less typing to do same thing, and as far as I can see much smaller code. But very little additional stuff you can put in 128K...

Scampy
- 18th August 2017, 11:20
Years ago i purchased an Ethernet module thinking that it would be as easy as setting up serial port - how wrong was I !

In my opinion PBP is seriously lacking in support of such things, but as Henrik has explained there is often a reason which in this case is the complexity of the protocols etc.

Art
- 18th August 2017, 14:05
There was a “Web Server in a Box” project a few years back with released source (C), and I got that working ok.
It’s a dsPic that uses one of Microchip’s companion ethernet controllers for a largely 2 chip + SD card web server.
The project was based on code that MC provide for a similar development board of their own.

Schematics and source for it are pretty easy to Google. It was popular a the time for tinkerers including myself.
http://www.siliconchip.com.au/Issue/2009/November/WIB%3A+Web+Server+In+A+Box%2C+Pt.1?res=nonflash

amgen
- 18th August 2017, 18:00
Much more 'logical' to add a module, and a wifi module at that. These modules today have 32 bit processors and big memory for the tasks for network and wifi. Plus some are only few $ and a fraction of the time to do network settings as opposed to programming all the tcp, ip, udp, password, etc, and all other kinds of routines and functions that are already on these modules.

ardhuru
- 21st August 2017, 06:30
Much more 'logical' to add a module, and a wifi module at that. These modules today have 32 bit processors and big memory for the tasks for network and wifi. Plus some are only few $ and a fraction of the time to do network settings as opposed to programming all the tcp, ip, udp, password, etc, and all other kinds of routines and functions that are already on these modules.

+ that statement.

Using one of the wifi modules amgen hints at is by far the easiest way to extend TCP/UDP support to a microcontroller.

Considering the popularity of the modules, they are unlikely to be discontinued in the near future. If AT ALL the form factor you design around does become obsolete, you could use a personality module-like pcb to accomodate the new one.

mpgmike
- 22nd August 2017, 17:23
I recently conquered USB communication with a PIC18xxK50 and HIDmaker software. Trace is the company that produces HIDmaker. They also have TCPmaker for ethernet. Review Dr. Bob's site for ideas:

http://www.tracesystemsinc.com/Table/tcp/tcpmaker/

Ioannis
- 22nd August 2017, 21:27
TCPmaker is great tool, only for C user though... :(

Ioannis

ShaneMichael
- 23rd August 2017, 17:10
Thanks for everyone's input, I'll use your reply's to update the steering group.