Page 1 of 2

PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Sun Mar 22, 2015 4:22 pm
by Wobbles
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

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Mon Mar 23, 2015 7:39 am
by Coccoliso
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.

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Mon Mar 23, 2015 9:32 am
by David Barker
Have you much experience using PICs? Does it have to be a single chip solution?

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Mon Mar 23, 2015 12:12 pm
by Wobbles
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

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Mon Mar 23, 2015 1:33 pm
by Jerry Messina
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)

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Mon Mar 23, 2015 3:28 pm
by Wobbles
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 )

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Mon Mar 23, 2015 4:05 pm
by Coccoliso
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?

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Mon Mar 23, 2015 5:52 pm
by Wobbles
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

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Tue Mar 24, 2015 11:42 am
by Jerry Messina
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

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Tue Mar 24, 2015 2:53 pm
by RangerBob
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

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Tue Mar 24, 2015 3:02 pm
by Wobbles
Thanks everyone for the input when i get back home (monday) i will crank the pc up and do some tinkering. :-)

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Fri Mar 27, 2015 5:31 pm
by Coccoliso
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

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Fri Mar 27, 2015 6:43 pm
by David Barker
Nice work - I've uploaded the files to the wiki, if you want to link to those on the wiki page...

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Fri Mar 27, 2015 8:32 pm
by Coccoliso
Thanks David,
I did it! :wink:

Re: PIC18F66J60 / 18F66J90 - Integral Ethernet

Posted: Fri Mar 27, 2015 10:09 pm
by Wobbles
Looking forward to trying it out :-)