PIC18F66J60 / 18F66J90 - Integral Ethernet

General discussion relating to the library modules supplied with the compiler

Moderators: David Barker, Jerry Messina

Wobbles
Posts: 9
Joined: Sun Mar 22, 2015 4:07 pm
Location: Torbay, Devon, u.k.

PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by Wobbles » Sun Mar 22, 2015 4:22 pm

Hi, I am considering using Swordfish to work with the Pics as per in the subject line. Has anyone experience with utilising the Integral Ethernet on these devices and what problems if any should I encounter ? I need for example to ping an Address and monitor its success or otherwise.

Any help or advice would be appreciated
Me ? No I'm not confused , well I don't think I'm am, well maybe your right !

User avatar
Coccoliso
Posts: 152
Joined: Mon Feb 17, 2014 10:34 am

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by Coccoliso » Mon Mar 23, 2015 7:39 am

There is Microchip TCP stack but is written in pure C or an example of a library written for the PIC18F97J60 between SF modules here http://www.sfcompiler.co.uk/wiki/pmwiki ... rnetDriver which must be adapted.

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by David Barker » Mon Mar 23, 2015 9:32 am

Have you much experience using PICs? Does it have to be a single chip solution?

Wobbles
Posts: 9
Joined: Sun Mar 22, 2015 4:07 pm
Location: Torbay, Devon, u.k.

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by Wobbles » Mon Mar 23, 2015 12:12 pm

David Barker wrote:Have you much experience using PICs? Does it have to be a single chip solution?
Hi, I guess it doesn't have to be a one chip solution really , just so happened I have one on a development board.
Any suggestions for alternatives. Essentially bar a few outputs and inputs Ethernet is all I need so I'm guessing there a hundreds of options. I'm not a C person though so im hoping to code in Swordfish , Python or similar and Swordfish certainly seems the way to go.

Ps not a lot of pic experience , coding yes pics no
Me ? No I'm not confused , well I don't think I'm am, well maybe your right !

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by Jerry Messina » Mon Mar 23, 2015 1:33 pm

David has a port of the Microchip TCP/IP stack which you can find here:
http://www.sfcompiler.co.uk/wiki/pmwiki ... r.Ethernet

It uses the standalone Microchip ENC28J60. I used this code as the basis for a port I did for the ENC424J600, so I know it works.

A user here started porting the driver code to the 18F97J60, but it doesn't look like they finished it
http://sfcompiler.co.uk/phpBB3/viewtopic.php?f=5&t=689

It shouldn't be too hard to finish/correct it to get it working.


What network protocols do you need? Do you really want to be able to just ping another device or is there more involved?

Either way, unless you're doing something REALLY simple I'd recommend that you use a part with as much flash as you can get, like the 18F67J60 with 128K flash. There are other devices you can get that have a network stack builtin like the WIZnet parts if you want to go that route.

(btw... maybe it's a typo but the 18F66J90 doesn't have ethernet, just the J60 family)

Wobbles
Posts: 9
Joined: Sun Mar 22, 2015 4:07 pm
Location: Torbay, Devon, u.k.

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by Wobbles » Mon Mar 23, 2015 3:28 pm

Thanks , yes there is a little more to it but not a lot. I am unable to say on this forum too much sadly.

I will it seems have to master the Ethernet aspect of pic.

And oh yes you are correct the Microcontroller should be PIC 18F97J60 but I am now thinking these chips are overkill although simple in terms of more or less a one chip solution.

I wish I could say more about what I'm trying to do ( suspecting im out of my depth )

In summary I just need to know when a connection goes down ( in a perfect world I'd love to know when it's performance deteriorates )
Me ? No I'm not confused , well I don't think I'm am, well maybe your right !

User avatar
Coccoliso
Posts: 152
Joined: Mon Feb 17, 2014 10:34 am

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by Coccoliso » Mon Mar 23, 2015 4:05 pm

If you are forced to add an external ethernet chip then you should take an ETH module already assembled and tested, and with 8$-20$ you can get a ENC28J60, and you can use the tcp stack library as Jerry says, or which cost a bit more a module with W5100 ( Swordfish library here http://www.sfcompiler.co.uk/wiki/pmwiki ... User.W5100 ) or the W5500 ( Swordfish library here http://www.sfcompiler.co.uk/wiki/pmwiki ... User.W5500 ).
What should you do?
Only try if he lives (with a simple ping) or mount a server that can accept connections tcp/udp?
The device that you have to control is in your LAN or INTERNET?

Wobbles
Posts: 9
Joined: Sun Mar 22, 2015 4:07 pm
Location: Torbay, Devon, u.k.

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by Wobbles » Mon Mar 23, 2015 5:52 pm

Coccoliso wrote:If you are forced to add an external ethernet chip then you should take an ETH module already assembled and tested, and with 8$-20$ you can get a ENC28J60, and you can use the tcp stack library as Jerry says, or which cost a bit more a module with W5100 ( Swordfish library here http://www.sfcompiler.co.uk/wiki/pmwiki ... User.W5100 ) or the W5500 ( Swordfish library here http://www.sfcompiler.co.uk/wiki/pmwiki ... User.W5500 ).
What should you do?
Only try if he lives (with a simple ping) or mount a server that can accept connections tcp/udp?
The device that you have to control is in your LAN or INTERNET?
Ok. I think I need to give more info out. For this part of the project I have a remote network. Which needs to remain up as much as possible and thus avoid a long drive. The objective is to power cycle the hardware (eg router) upon failure. Effectively a "Cold Boot" I know this can be done with simpler methods such as a telephone operated switch but I need to have a self sustainable method - obviously this can not help with a line failure or physical fault. There is more to this than I have explained but for this segment that's the plan - hope I have explained myself more clearly

Maybe I should add the " in a perfect world" bit a web interface would mean I don't even have to drive there to set it up - they can do it :-) or I can remotely
Me ? No I'm not confused , well I don't think I'm am, well maybe your right !

Jerry Messina
Swordfish Developer
Posts: 1469
Joined: Fri Jan 30, 2009 6:27 pm
Location: US

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by Jerry Messina » Tue Mar 24, 2015 11:42 am

Maybe I should add the " in a perfect world" bit a web interface would mean I don't even have to drive there to set it up
Then you might be better off with one of the WIZnet chips if you can live w/ a two chip solution. Coccoliso's module for the W5500 http://www.sfcompiler.co.uk/wiki/pmwiki ... User.W5500 looks to be a lot easier than using the TCP/IP library as currently there's no HTTP module (although you could do it the same way he did to get a "simple web server").

Porting the HTTP code to get a true web server is a lot of effort. I did it a few years back and actually had it running but it was HUGE... so much so that it took up nearly the entire chip I was using, so I abandoned it.

I haven't used the WIZnet chips, but I think they support an IPRAW mode that would let you send an ICMP ping to another device http://www.wizwiki.net/wiki/doku.php?id ... tion:ipraw

Maybe somebody has tried this...

In the mean time, I think I'll get a J60 in the next week or so and see if I can't get the driver working

User avatar
RangerBob
Posts: 152
Joined: Thu May 31, 2007 8:52 am
Location: Beds, UK

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by RangerBob » Tue Mar 24, 2015 2:53 pm

Just to chime in that the swordfish ENC28J60 modules appear to be pretty much rock solid from my testing and use (I do have some small changes / fixes for it).

Not entirely sure what you want to use from it, but I did create a "Simple" HTTP Client a while back which may be of use:
http://digitaldiy.io/swordfish-module/4 ... RF0GY7kfYg
http://digitaldiy.io/swordfish-project/ ... lient.html

I also have tucked away in my folders somewhere a (again simple) HTTP Server that I've used before on some stuff. I've not published it here as it does "borrow" very heavily from the Microchip C HTTP2 server, but it supported the following features:

*HTTP GET Support (including query string arguments)
*SD Card storage of webpages for easy updating of webpages (and plenty of storage space for images, webpages, scripts etc.)
*"Dynamic" real-time variable support (ala HTTP2/MPFS2)
*Dynamic file system vs. static MPFS file system

Doesn't support (as I didn't need it, but you could probably add it):
*HTTP post
*Authentication
*Cookies
*MPFS upload

Wasn't the most clean of code but worked a treat. PM me for more info if necessary.

Jerry:
I always promised myself I'd get the J60 PHY driver working, but everytime I started to look at it I got disheartened and sidetracked. Good for you if you can get it going; let me know if you need any help testing it!

Rangerbob

Wobbles
Posts: 9
Joined: Sun Mar 22, 2015 4:07 pm
Location: Torbay, Devon, u.k.

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by Wobbles » Tue Mar 24, 2015 3:02 pm

Thanks everyone for the input when i get back home (monday) i will crank the pc up and do some tinkering. :-)
Me ? No I'm not confused , well I don't think I'm am, well maybe your right !

User avatar
Coccoliso
Posts: 152
Joined: Mon Feb 17, 2014 10:34 am

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by Coccoliso » Fri Mar 27, 2015 5:31 pm

Jerry Messina wrote: I haven't used the WIZnet chips, but I think they support an IPRAW mode that would let you send an ICMP ping to another device http://www.wizwiki.net/wiki/doku.php?id ... tion:ipraw

Maybe somebody has tried this...
After an intellectual effort ..
I added the ping function to the W5500 library.

For notes in use of the library and the wiring diagram of the ETH module can read here:
http://www.sfcompiler.co.uk/wiki/pmwiki ... User.W5500
Attachments
W5500-Test-Ping-Program.zip
Test-Program
(1.17 KiB) Downloaded 242 times
W5500-with-ping-support.zip
W5500 With Ping Support Library
(27.95 KiB) Downloaded 234 times

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by David Barker » Fri Mar 27, 2015 6:43 pm

Nice work - I've uploaded the files to the wiki, if you want to link to those on the wiki page...

User avatar
Coccoliso
Posts: 152
Joined: Mon Feb 17, 2014 10:34 am

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by Coccoliso » Fri Mar 27, 2015 8:32 pm

Thanks David,
I did it! :wink:

Wobbles
Posts: 9
Joined: Sun Mar 22, 2015 4:07 pm
Location: Torbay, Devon, u.k.

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Post by Wobbles » Fri Mar 27, 2015 10:09 pm

Looking forward to trying it out :-)
Me ? No I'm not confused , well I don't think I'm am, well maybe your right !

Post Reply