PIC24 ECAN Library

Announce wiki articles, source code or projects here

PIC24 ECAN Library

Postby Coccoliso » Mon Apr 20, 2015 8:06 am

I posted in wiki a CAN BUS library for Firewing R2 / PIC24 device here http://www.firewing.info/pmwiki.php?n=F ... User.CAN24
User avatar
Coccoliso
 
Posts: 177
Joined: Sat Sep 27, 2014 10:02 am

Re: PIC24 ECAN Library

Postby Timbo » Mon Apr 20, 2015 10:05 am

Many thanks even though I do not need can my self now.

Its great to know its there...
Timbo
 
Posts: 93
Joined: Fri May 03, 2013 7:51 pm

Re: PIC24 ECAN Library

Postby Coccoliso » Mon Apr 20, 2015 11:15 am

.. Is useful if you need to transfer data between PIC.
Some time ago I tried to link together two PIC18 in I2C and with that kind of MCU was impossible set one as "I2C master" so CAN is still the best system.
User avatar
Coccoliso
 
Posts: 177
Joined: Sat Sep 27, 2014 10:02 am

Re: PIC24 ECAN Library

Postby Timbo » Mon Apr 20, 2015 12:18 pm

I had not thought of using it just for direct Pic Pic coms. Usually I roll my one. But I can see a lot of advantages using a CAN bus.
Timbo
 
Posts: 93
Joined: Fri May 03, 2013 7:51 pm

Re: PIC24 ECAN Library

Postby Coccoliso » Mon Apr 20, 2015 12:31 pm

An example can be when you have to specialize many unit and share states between them.
I used it in domotic call system where I have different units with different functions but the state is common to all.
You can add / remove station unit or display unit without changing a single line of firmware.
User avatar
Coccoliso
 
Posts: 177
Joined: Sat Sep 27, 2014 10:02 am

Re: PIC24 ECAN Library

Postby Jerry Messina » Mon Apr 20, 2015 12:45 pm

CAN has a lot of advantages.

I tried to link together two PIC18 in I2C and with that kind of MCU was impossible set one as "I2C master"

Not sure what you mean. I link PIC18's together using I2C all the time... either using one as master and the rest as slaves or multi-masters (which is a lot more involved).

The I2C slave code is very different from the master end.

Oh, and thanks for the library!
Jerry Messina
 
Posts: 280
Joined: Thu Feb 14, 2013 10:16 am

Re: PIC24 ECAN Library

Postby Coccoliso » Mon Apr 20, 2015 1:11 pm

Jerry, I was referring to the PIC18 and some families like 46K2x.
With Swordfish about a year ago I tried with different MPU to run the application notes AN735a and AN736a and the only PIC18 that worked correctly as slave was the 18F452 and since then I have not tried again.
It still interests me so what PIC did you use?

PS: I noticed only now that have wrote in the previous post "AS MASTER" but I meant "AS SLAVE" .. and now understand the clarification.
User avatar
Coccoliso
 
Posts: 177
Joined: Sat Sep 27, 2014 10:02 am

Re: PIC24 ECAN Library

Postby Jerry Messina » Mon Apr 20, 2015 3:31 pm

I've used the 26K22, 45K50 and 87K22 in both master AND slave roles so the 46K2x should work also. I recently used a 26K22 to emulate portions of an MCP23017 I2C IO expander.

It doesn't surprise me that the mchip app notes only worked on an original 18F part. I think the app notes started out for the 16F series and were later changed for some of the 18F parts. Trouble is, there are a few different I2C hardware modules in the 18F's and they don't all work the same.

I remember having to handle some states differently.
Jerry Messina
 
Posts: 280
Joined: Thu Feb 14, 2013 10:16 am

Re: PIC24 ECAN Library

Postby Jerry Messina » Mon Apr 20, 2015 5:34 pm

Now that we're way off topic, I dug up some old sample code I had for an I2C slave and posted it on the swordfish forum

http://sfcompiler.co.uk/phpBB3/viewtopic.php?f=4&t=1948

From what I remember it worked for the K22, but it might have issues with other devices.
Jerry Messina
 
Posts: 280
Joined: Thu Feb 14, 2013 10:16 am


Return to Firewing Wiki

Who is online

Users browsing this forum: No registered users and 1 guest

cron

x