Shop OBEX P1 Docs P2 Docs Learn Events
Controller Area Network (CAN) on propeller? — Parallax Forums

Controller Area Network (CAN) on propeller?

OakGraphicsOakGraphics Posts: 202
edited 2012-01-14 18:07 in Propeller 1
Howdy guys.

I am thinking of a project to read in various things from a CAN Bus (Controller Area Network) (see http://www.canbus.us/·)

In theory - I should be able to get what my car dash would get - and more.· I was hoping to be able to build a circuit that could make a virtual dashboard, as well as make a circuit that I could generate the data to controll a different dashboard.· This would be 2 projects really - as one would be for use to create the lcd screen that F1 steering wheels have on them for racing simulation (something like http://www.hardwaresecrets.com/fullimage.php?image=5501 ), and the other would be controlled via·USB·to be able to make a 'virtual car' dashboard.·(see http://realvirtualcar.blogspot.com/·)

Any thoughts on this?· I looked through the object exchange and I don't see anything there offhand, but looking at the CANbus specs it doesent look like the Propeller would have a problem with it.··· Or should I consider a dedicated CANbus controller and let the propeller do all the other stuff? (lcd, buttons, etc)
·

Comments

  • LeonLeon Posts: 7,620
    edited 2007-10-16 08:55
    CAN would be very difficult to implement in software; the simpler LIN would be quite feasible, Atmel has an app note on it for the AVR. If you need CAN it would be best to use a dedicated CAN controller, IMHO.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle
  • simonlsimonl Posts: 866
    edited 2007-10-16 10:14
    I also doubt you'll be able to achieve this directly on the Prop (but nothing surprises me with this chip anymore - what _can't_ it do?!).

    I'd take a look at the MicroChip MCP2515; this is a standalone CAN controller with an SPI interface (for which there _is_ an object), so that will just (!) leave you with working out how to control its registers [noparse];)[/noparse]

    HTH.

    <edit>
    Just to clarify: there _is_ an object for SPI - _not_ for the MCP2515!
    </edit>

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,

    Simon
    www.norfolkhelicopterclub.co.uk
    You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
    BTW: I type as I'm thinking, so please don't take any offense at my writing style smile.gif

    Post Edited (simonl) : 10/16/2007 10:19:21 AM GMT
  • hippyhippy Posts: 1,981
    edited 2007-10-16 14:35
    @ leon, simonl : For a read-only CANbus application ( which this appears to be ) handling the incoming bit-stream should be a lot easier than transmission and the arbitration / collision detection which goes with that.

    I'm aware of but never used CANbus. It seems fairly straight forward; a bit rate of 10Kbps through 1Mbps, and a Propeller should be able to bit-bang in packets at those rates, with enough processing time to check CRC etc. Packets can be built, buffered and handed over to another Cog for processing. Packet rate is likely more important than actual data rate but I'd expect a Propeller to be at least comparable in processing terms as whatever is fitted into a dashboard display.

    The MCP2515 is well worth considering and its datasheet seems a better guide to what's on the CANbus bus than other material I've read. Bit synchronisation and bit stuffing seems to be the ain complexities of CANbus over any other asynchronous data stream so it probably is easier to off-load the work to an external chip which brings other advantages such as packet filtering.

    Getting a CANBus receiver working with a MCP2515 then moving to a bit-banged solution would likely be a sensible way to proceed.
  • rjo_rjo_ Posts: 1,825
    edited 2007-10-16 15:08
    A couple of guys have expressed similar goals... way back in 2006 Kramer was getting close... not a straight implementation though.

    http://forums.parallax.com/forums/default.aspx?f=25&m=139971

    I think you could develop something with lots of repurposing potential. Every-time I go by a junkyard, with all of those unused carputers, sensors and actuators, I wish I was just a little smarter and that someone would come along and blaze the trail.

    Great project for a grad student... or a budding entrepreneur.
  • WookieWookie Posts: 27
    edited 2007-10-17 22:56
    Take a look at this site:

    www.scantool.net

    They have complete OBDII interfaces that will negotiate all the data transfer/commands/etc and ship the data down to you via USB or Serial. They use the ELM chip as a basis for their products, which can be used to develop your own embedded application if necessary.

    http://www.elmelectronics.com/index.html

    I have the ELM 5 scantool from scantool.net and am in the process of using the prop to build my own aux. instrument cluster on a uLED, which I will mount in an unused part of my dash. Ill post the code up when I get finished.
  • Stephen MoracoStephen Moraco Posts: 321
    edited 2007-11-24 23:12
    simonl said...
    I'd take a look at the MicroChip MCP2515; this is a standalone CAN controller with an SPI interface (for which there _is_ an object), so that will just (!) leave you with working out how to control its registers [noparse];)[/noparse]

    <edit>
    Just to clarify: there _is_ an object for SPI - _not_ for the MCP2515!
    </edit>
    In case you are interested, I'm turning on such a device now as I'm writing this.· The design consists of

    ·· USB <-> FT232R <-> Propeller <-> MCP2515 <-> MCP2551 <-> CAN Bus

    I now have a serial-autobaud object and an MCP2515-specific SPI object.· These are appearing to work well
    but I'm still in the turning it all on stage... I'll be posting some of these as I get them fully tested.

    I'm doing this work for use by myself and my collegues at AMSAT-NA/AMSAT-DL. These are Amateur radio
    enthusiasts who build amateur radio satellites.· We are flying the CAN bus as the payload communications
    network onboard the next couple of satellites.·· See: http://can-do.moraco.info·and http://projects.moraco.us

    I needed a cheaper, faster, driver-flaw-free USB2CAN dongle and I'm now hours away from this being a
    reality!

    I've been "soaking-up" all things spin and have been in heavy turn-on / learning...· I've been writing software
    for a really long time and have many years in developing embedded systems.· I do have to say that
    working in spin and the associated assembly language is turning out to be quite fun.· It is also not without
    it share of "how in the world do I do..."· events and the accompanying "why is it doing that?" events.

    I'll post here when I've awakened the web-site for this new device...·· So far I'm calling it "propCAN".·
    (If any of you have suggestions for better names, let me know·smile.gif·)

    Anyway, reguarding this thread... we now have information on how to do CAN Bus using the propeller...

    - Stephen

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    ·
  • rjo_rjo_ Posts: 1,825
    edited 2007-11-25 03:57
    Steven,

    Great link. I had heard of AMSAT, but I never actually knew what it was. It sounds like a project that just shouldn't work... but it has... for more than 20 years.

    propCAN sounds pretty good to me[noparse]:)[/noparse]

    I've been trying to find ways to get my mechanic friends interested in the Prop... propCAN will do that.

    Thanks

    Rich
  • simonlsimonl Posts: 866
    edited 2007-11-27 11:49
    Hi Stephen,

    Brilliant! I first encountered CAN when reading about rocketry project at PSAS (Portland State Uni?). I see their later projects moved away from CAN due, I think, to it's non-deterministic messaging nature - I guess you're not seeing any problems with that?

    propCAN is perfect - because the prop' can CAN (not sure if it can can-can, but if I put it out as a challenge I'm sure someone could make it!).

    I look forward to seeing the fruits of your labour - keep up the good work.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Cheers,

    Simon
    www.norfolkhelicopterclub.co.uk
    You'll always have as many take-offs as landings, the trick is to be sure you can take-off again ;-)
    BTW: I type as I'm thinking, so please don't take any offense at my writing style smile.gif
  • Stephen MoracoStephen Moraco Posts: 321
    edited 2007-12-27 03:35
    The propCAN website is now up.

    It contains a description of the device as well as a gallery of pictures of my first boards with which I'm developing the code.

    · See: http://propcan.moraco.us

    Enjoy!



    Stephen, KZ0Q

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    ·
  • AleAle Posts: 2,363
    edited 2007-12-27 07:36
    Stephen, the page at procan.moraco.us renders wrongly in firefox for linux (xubuntu 7.10, x86-64). The text is over the pictures and some paragraphs are over other paragraphs.

    See please the attached ss:

    Post Edited (Ale) : 12/27/2007 7:44:51 AM GMT
    1359 x 976 - 270K
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2010-07-23 10:52
    Resurrected from the dead!

    Recently I have read a couple magazine articles about CANbus and thought I would would raise this tread up and see what Stephen Moraco has been up to or anyone else using the Propeller and CANbus. Tell me about your experience? Any more object to share in the OBEX? And feedback on the posted MCP2515 object from those who have used it? Anyone trying porting CANopenNode (open source, high level layer protocol for CANbus sourceforge.net/projects/canopennode/)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, P.E.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" 16:9 LCD Composite video display, eProto for SunSPOT, PropNET, PolkaDOT-51
    www.tdswieter.com
  • AJMAJM Posts: 171
    edited 2010-07-23 12:21
    I am also interested in hearing about anyone's experience with prop/CANbus work.

    Stephen's website is up but it appears that it has not been updated recently. Maybe he would answer an email or two.
  • bgbockbgbock Posts: 5
    edited 2011-04-19 13:19
    This hardware might also help out. A few of the links are not working but if someone is interested I have the downloads before the links went bad. I also have all the devices too. This was used in a project in the Servo magazine in May 2006. If I remember correctly there was something about this working with a BASIC Stamp II also. It would be great to have this working with a Prop.

    https://id306.securedata.net/machinebus.com/merchantmanager/index.php
  • TurboManTurboMan Posts: 19
    edited 2011-04-28 07:17
    I would be interested in the documents for the UCI100 if you have them.
  • JonnyMacJonnyMac Posts: 9,198
    edited 2012-01-14 18:07
    @Timothy: I had a client project last summer/fall that forced me to learn a bit about CAN. As I found it interesting (and easy to implement using the MCP2515/MCP2551 chips) I decided to write my own object (the client's was customized due to their non-standard use of CAN addressing) and even made a simple experimenter's board for the Propeller Platform.

    My easy-to-use MCP2515 object (with a sniffer demo) is now in ObEx
    -- http://obex.parallax.com/objects/832/

    I have some spare Propeller Platform MCP2515 PCBs available in this thread:
    -- http://forums.parallax.com/showthread.php?137251-Propeller-Platform-CAN-Shield-PCB-Available-%28limit-qty%29
Sign In or Register to comment.