Shop OBEX P1 Docs P2 Docs Learn Events
New CAN device — Parallax Forums

New CAN device

kelvin jameskelvin james Posts: 531
edited 2012-01-14 10:16 in General Discussion
Can anyone explain in a little more detail about this, the doc is a little vauge on the operation. I would assume it is meant to be a serial buffer. Just wondering how it is considered a coprocessor, other than a communication buffer ?

kelvin
«1

Comments

  • GadgetmanGadgetman Posts: 2,436
    edited 2005-05-07 12:06
    No, it's not a buffer, though it may work as one.

    Consider it a 'network card' for your BS2.
    CAN = Controller Area Network

    Post Edited (Gadgetman) : 5/7/2005 12:11:19 PM GMT
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2005-05-07 15:47
    Isn't the CAN bus an automotive standard that is going to be adopted by all auto manufactures in a year or two?

    If so, Kevin may want to know.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    G. Herzog in Taiwan
  • kb2hapkb2hap Posts: 218
    edited 2005-05-07 15:51
    its also used in factory automation equiptment::"DeviceNet"

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    DTQ
  • KenMKenM Posts: 657
    edited 2005-05-07 16:14
    Currently, many automanufactures already use CAN in vehicles for communication between modules in the vehicle as a form of multiplexing, which cuts down on literally pounds of wire harness.

    For the vehicle's On Board Diagnostic system (OBD II), there are currently 5 different protocols used for the vehicle to communicate with·a scan tool. Some manufactureres already use CAN.

    Starting with 2007 (or '08, can't remember now) all vehicles sold in the United States with an OBD II system must use the CAN communication protocol.
    Kramer said...
    Isn't the CAN bus an automotive standard that is going to be adopted by all auto manufactures in a year or two?

    If so, Kevin may want to know.

  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2005-05-11 16:52
    Gadgetman said that you should consider it a 'controler network card'. FOR YOUR BS2.

    I had thought that CANbus was a complete microcontroller system, but now you have got my attention.
    Can anyone diagram a simple setup with the BS2 and CANbus? It would help get me started.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    G. Herzog in Taiwan
  • ForrestForrest Posts: 1,341
    edited 2005-05-11 17:18
    Parallax just started selling a CAN device that interfaces with a BS2 www.parallax.com/detail.asp?product_id=30011
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2005-05-12 16:41
    This is all very interesting.

    The 'CAN device' seems to give the BasicStamp more autonomy that other schemes of DIP microcontrollers that support CANbus. Servo Magazine (April 2005) has a list of 26 of the leading DIP microcontrollers and it missed mentioning that the BasicStamp is usable with the CANbus. I was beginning to wonder if you really could use the BasicStamp together with CAN.

    The main thing that seems attractive is the CANbus reduces wire. It is a 'bus' that mutiplexs information to/from other devices. If I was clear on what the other devices were or could be, I would have some idea of how to begin to apply all this. I guess I will have to look around.

    Is there a CANbus LCD interface? Is there a CANbus input device [noparse][[/noparse]keypad]?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    G. Herzog in Taiwan
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-05-12 17:22
    Since its the automotive industry that took the CAN bus and ran with it, the majority of CAN devices at this point are sensors and actuators (such as positioning motors for car seats). While there may not be CAN bus LCDs or keypads (I don't know if there are or not) you could certainly adapt one by patching it together with a CAN bus interface.·The LCD would fall under the actuator category and the keypad would fall under the sensor catagory in the data direction sense.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2005-05-13 03:19
    I see that the CAN device uses a serial interface with the BasicStamp. So, it would seem that you could use a serial LCD or KEYPAD wired directly to a BasicStamp on one serial port and use another serial port to interface the CANbus.

    The bus would remain their for control of various actuators and collection of sensor info from more distant locations.

    Is that a reasonable way to go?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    G. Herzog in Taiwan
  • stamp_demonstamp_demon Posts: 69
    edited 2005-05-24 06:25
    Is there any test code curently avalible for the bs2, and or bs2px, and the CAN?? I'd love to see it as I am considering in buying one. But would like to see some code to see if it is something I might be able to work with. Or if it is just too far above my head.. Thx _Duane
  • mmmm Posts: 56
    edited 2005-05-24 16:50
    CAN is also used in Avionics electronics, particularly for NAV and Comm systems to talk to the numerous sensors and remote mounted control heads etc.
  • edited 2005-05-24 22:45
    Hello:

    I work for Machine Bus Corp. We are the developers of the Stamp/CAN Interface sold by Parallax. I agree that the documentation maybe a little vague. I have requested that the documentation be updated. For now, you can view the latest doc and PBasic examples for the product at http://www.machinebus.com/downloads/mci100p.zip. There is also a white paper that describes the Controller Area Network (CAN) protocol in great detail.

    I think that Gadgetman described it best. The product is a CAN network card for your BS2. CAN has many wonderful qualities, but it is more complicated than other forms of serial communications. This coupled with high bus speeds can easily swamp a small processor. Much of the overhead associated with CAN communications is taken care of by this device.

    As for the applications of CAN, everyone in this post is correct. It is used in many industries. Upon further study, you will find that CAN is one of the best, embedded networking technologies available.

    If you would like to create a distributed control network, using CAN, I would recommend the BASIC Stamp since you are all familiar with it. The architecture of a distributed control system is often dictated by physical requirements. For example, you may need a keypad, a sensor and an LCD display in separate locations. Create your network using a BS2 and a Stamp/CAN Interface for each processing node. Write the PBasic code for the keypad, sensor and LCD as you normally would and add the CAN API code from the example. You will find simple examples in Appendix A and B of the datasheet.

    If you have a CAN bus that you would like to tap into, you would only need one BS2 and one Stamp/CAN Interface. Just be careful about transmitting messages on a working CAN bus. You could inadvertently cause a machine to fail in unexpected ways.

    If you have any additional questions, feel free to ask.

    Dan Mannisto
    Machine Bus Corp.
    danMannisto@machineBus.com
  • BTibbs327BTibbs327 Posts: 3
    edited 2011-10-07 10:29
    So where can I obtain one of these CAN Modules??
    I can't find it on parallax website and search doesn't either...
  • RDL2004RDL2004 Posts: 2,554
    edited 2011-10-07 10:45
    It's an old product, probably no longer in production. These things happen. Here is a clip from the Parallax 2006 catalog, which is 1 year newer than this thread was. :)
    643 x 192 - 101K
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-10-09 02:47
    One of the issues with CANbus is the additional cost per node that it adds to a project. Often, with micro-controllers RS-485 is just fine unless you really need a lot of nodes and multiple masters on the same twisted pair of wires.

    CANbus is a great solution, but the economics is pretty much dictated by those chip producers than offer the device inclusive of a micro-controller. Microchip's PIC have devices that include CANbus and really cannot be beat for costs. A 28pin PIC with CAN included can cost about $7USD if you shop around.

    If you really want the network to interface with other micro-controllers, the MCP2515 and MCP2551 chip set is available and Parallax even has an object in OBEX to support use on the Propeller. I have had good luck with using their SPI interface and BS2s.

    In my own case, I had 25 boards made to hold the MCP2515 and MCP2551. These allow me to use any micro-controller with them. But at the end of the day, it seems much easier to give in and use all Microchip products for a CAN solution as the CANbus itself tends to have tens of nodes that do tiny tasks as slaves and only a few masters.

    The product mentioned in this thread was a bit of dead end as it used CANbus, but also created its own system that limited what could be done. Most users just didn't see the value in such an expensive solution.
  • JonnyMacJonnyMac Posts: 9,207
    edited 2011-10-10 19:08
    I'm working with a client that needs CAN for a commercial product (PCB use the MCP2515 and MCP2551). It has been a bit of a bear working through some hardware issues (not designed by me, I'm just coding), but now that I have a handle on CAN (I think!) I'm going to create a CAN module for the Propeller Platform and then release my object. As with most of my code, it's very straightforward and I think will help others use CAN when the want/need to.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-10-11 01:55
    @JonnyMac
    Great!

    I am guessing that you are using the MCP2515 and MCP2551. I worked through getting them to operate on the BS2 and the learning curve was mostly about the initialization code. Once the device is working, it just hums along rather reliably. I found that using the recommended defaults worked fine for many months of having a pair of nodes working on 100 foot coil of telephone extension cable. It is nice that the unit actually gives you a tally of failed tries.

    The cost of a set of chips isn't really that much. It is just when you try to go to some convention like CANopen that you find they want thousands of USD for participation. That is a rather absurd jump in costs for the average user.
  • JonnyMacJonnyMac Posts: 9,207
    edited 2011-10-11 12:54
    I am guessing that you are using the MCP2515 and MCP2551.

    You got it. You're right, once things get going it's not bad at all.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-10-12 03:33
    There is a certain frustrating irony in that the name CANopen has been claimed by a rather expensive software application.

    Nonetheless, if one searches "Open Source CANbus", one does find that there are applications for people wanting to get started without a huge cash outlay.

    http://sourceforge.net/projects/can/files/Very%20Simple%20Control%20Protocol/0.2.0_RC1_C/vscp_src_0.2.0rc1c.zip/download?_test=goal
  • $WMc%$WMc% Posts: 1,884
    edited 2011-10-12 20:22
    Thanks for the info guys.
    '
    I have really wanted to read some data from my trucks OBDII jack with out having to use my lap-top.
    '
    I ran into the same high priced software/hardware blocker too.
    '
    I see you guys have broke through this.
    '
    I hope you guys can find the time to keep this thread informed.
    '
    Many Thanks
  • JonnyMacJonnyMac Posts: 9,207
    edited 2011-12-31 11:15
    An update on my CAN project.

    After getting the hang of CAN while working with a customer I have decided to make a board for my [original] Propeller Platform (same ExpressPCB mini-board size though I have switched to DipTrace for design). The board has the MCP2515 CAN interface and an MCP2551 driver -- pretty standard stuff. The MCP2515 connects to the Propeller through a SPI buss. The only connections to the MCP2515 are through SPI, but as this is intended to be an experimenter's board I have added pads for the other pins on the MPC2515 that an engineer might want to work with, and filled the unused PCB space with pads for extra circuitry.

    For those interested in connecting to the CAN signals on a OBD-II connector there is a DB-9 on the board. In order to keep things as flexible as possible there is a 9-pin female socket behind the DB-9 that matches the 3-pin female socket behind the CAN terminal block. These sockets allow the user to route the CAN-H, CAN-L, and ground connections to the DB-9 as desired (using jumper wires).

    I'm about to send the board out for prototypes and the write-up and my object will appear in the March edition of Nuts & Volts magazine.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2011-12-31 23:19
    Excellent!!! I've mentioned this before, but there are a lot automotive people out there that would like to take advantage of the CAN's snoop mode and the Propeller providing a Real time programmable video display is perfect for such.

    The MCP2551/2515 has multiple buffers, more than most people need to use on one CAN node, but I'd love to hear more about what people have found useful for all these different address slots. In the automotive context, I suppose one could be always following a certain engine function - like TACH - while another monitor other key features.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-01-01 13:35
    Nice work Jon. After your writeup yesterday I spent some time researching CAN. There are many xxxNet versions of CANbus out there but most want $$$ for the priviledge. However, the bus is a nice and cheap interface with excellent protection. There are quite a few CAN interface chips out there, but the MCP2551 seems the best of the bunch. For a lower standby current, the AMIS4265 (pin compatible) is a better but more $ choice - 15uA vs ~400uA.

    I had been looking for a nice bus to use for my boat - lots of sensors and controllers located around the boat to reduce the wiring. I wired my vessel and others like her. I accidentally blew my smart alternator regulators and at ~$750 a pop I have decided to build my own and fix & add modifications to improve things, including reduced wiring, and modular design.
    I will use the CAN bus but I think I will just use a subset of the CANbus protocol to simplify, at least for now.

    Jon, thanks again for your enlightening thread (the other one). It opened my eyes to a nice well thought out industrial (well automotive) bus with good immunity to RFI. And the bus chips are cheap.. MCP2551 from DigiKey $0.78/100.
  • kwinnkwinn Posts: 8,697
    edited 2012-01-01 14:34
    The MCP2551 transceiver is not limited to CANbus. It can be used with other protocols as well. Because of the open collector/emitter nature of the CANH/CANL drive circuitry it is really well suited to multi-master, peer-peer and master-slave communications . The dominant/recessive states allow for simple collision detection/avoidance, and bus arbitration. The current serial objects could be modified to do this.
  • JonnyMacJonnyMac Posts: 9,207
    edited 2012-01-01 17:25
    @Cluso: Seems like CAN would be a natural for your boat as it was originally designed for automotive use -- a boat's a vehicle, right? It took a couple days to get the hang of CAN but once I did I dare say the MCP2515 makes things pretty easy. By using message filtering you can take a big load off of the processor which, again, makes it really appropriate for remote smart nodes for your boat.
  • $WMc%$WMc% Posts: 1,884
    edited 2012-01-01 17:47
    JonnyMac wrote: »
    An update on my CAN project.

    After getting the hang of CAN while working with a customer I have decided to make a board for my [original] Propeller Platform (same ExpressPCB mini-board size though I have switched to DipTrace for design). The board has the MCP2515 CAN interface and an MCP2551 driver -- pretty standard stuff. The MCP2515 connects to the Propeller through a SPI buss. The only connections to the MCP2515 are through SPI, but as this is intended to be an experimenter's board I have added pads for the other pins on the MPC2515 that an engineer might want to work with, and filled the unused PCB space with pads for extra circuitry.

    For those interested in connecting to the CAN signals on a OBD-II connector there is a DB-9 on the board. In order to keep things as flexible as possible there is a 9-pin female socket behind the DB-9 that matches the 3-pin female socket behind the CAN terminal block. These sockets allow the user to route the CAN-H, CAN-L, and ground connections to the DB-9 as desired (using jumper wires).

    I'm about to send the board out for prototypes and the write-up and my object will appear in the March edition of Nuts & Volts magazine.
    '
    '
    Great news.
    '
    I want one of those boards!
    '
    I'll definitely check-out the March N&Vs
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-01-01 22:46
    Jon: I found Nema2000 is a CAN implementation. But I am not into using an MC2515 SPI chip.

    Got me thinking though. I knew I wanted to create a bus on the boat for a few things...

    Smart regulator:
    I have two Volvo 30hp Diesels with 135A alternators fitted with external smart regulation. While the now defunct expensive regulator can drive two alternators, it does so completely in parallel. If the engines are at different revs then the one alternator will be generating all the power. If I use a pair of shunts to detect the current being generated, I can adjust the individual field currents to get better current out.
    The regulator died when I accidentally switched off the battery from the regulator. I was switching over from house to engine battery (I had a flat engine battery). However, this was not the main problem. When the regulator dies, it then pumps out 16V and increases, causing other possible damage! Not a good design by any means. So, I intend to take care of this problem too. I have seen it before when someone had a failed regulator, but fortunately it was under warranty at the time, although I am unsure what killed it.
    Because I wired the boat(s) I know how much cable is used, and better ways to do it. If I run a bus around the boat (2wire for CAN plus 2wires for power 12V & Gnd or maybe 5V & Gnd) I can place the actual alternator regulator section at each engine, but control them from the nav station. At the same time I want to collect other information such as engine revs, oil pressure, water temperature. By making a fairly standard pcb with a few sensor inputs and a MOSFET driver (to supply PWM to the alternator field), I can have some spares onboard that can be swapped out in an emergency without costing the earth. Other sensors include battery voltage, current and temperature (2+ locations); fuel (x2) and black tank (x2) level sensors; fresh water x2 level sensors; Anchor Winch (MOSFET) control and chain length.

    Next I thought about the lighting. We are now moving to LED lighting and there is considerable savings by using lighter cable (weight and cost). Place a tiny controller at each light and control each light remotely too. We have two toilets on board, so flushing (macerator and water intake pump).

    And I havent even got to the main area of electronics. Currently I use a laptop for main navigation with C-Map and SOB software (Software on Board) and this is fed with GPS info. The backup is a Chartplotter with C-Map & GPS, plus an autopilot (another set of MOSFETs). Add Depth, Log (speed through water) and water temperature; Wind direction and speed; and of course the VHF radio which also gives out barometric pressure. All these instruments are currently on an interconnected bus and I can get all this info to my laptop via the prop chip. I want to add an AIS system too. I have actually thought about using a prop to decode the VHF AIS data using the work done by Phil and the Software Defined Radio.

    Anyway, this project is going to take a while to develop and I have some other things to do with the prop first.

    But, I digressed...

    Today I designed a circuit to implement the CAN bus. It will be a tiny smt pcb (as usual) and it plugs into a prop. It has USB and CAN options with each being a 2-4 circuit interface. I am using the MCP2551 CAN transceiver. Also on board is an ATTiny which I can program with the prop to do either USB (LS) or CAN functions, or the Prop can bypass the ATTiny and drive the USB and/or CAN bus. There are two prop connections of 2-4 pins each. The ATTiny also has 4-6 ADC and/or I/O pins as I dont want to waste any resources. This is just a toy to work on the interfaces and code.
  • JonnyMacJonnyMac Posts: 9,207
    edited 2012-01-02 11:01
    Cluso -- will be interesting to hear about your results. There are several chips with built-in CAN interfacing, I'm going with the MCP2515 because it's quite common and easy to use, something important to me, my clients, and very important to N&V readers.

    Keep us posted on your project, it sounds really cool.
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-01-02 12:46
    Jon: Yes, your audience requires simplicity and I think the choice of the MCP2515 with SPI is a good one.

    I started the pcb layout, and the space taken with all the links is excessive. So I had a rething overnight and will probably think again tonight. Maybe I'll keep it KISS w/o all the options, although I do intend to get the prop doing the protocol, so only a transceiver like the MCP2551 is required.

    kwinn: Yes I am looking into the CAN protocol and I do realise that it is possible to use another protocol.
  • JonnyMacJonnyMac Posts: 9,207
    edited 2012-01-11 09:34
    For those that are interested I've attached my Propeller demo for my March column. I'm still waiting on my own PCBs so I'm presently testing on Propeller ASC with an Arduino CAN Shield (from http://www.fazjaxton.net/products/canshield/) -- a board that works but is not intended to be on a buss of more than two CAN devices because the buss terminator is hardwired in. My design fits on the Propeller Platform, has lots of prototyping space, and makes all MCP2515 IO available for experimenting.

    The demo code is written in polling mode (just a CAN buss sniffer) and also sends a set of timer registers to the buss -- just to show how easy it is to setup and send a custom message. I've done all my testing with a commercial CAN buss device so I feel pretty good about my object and it working correctly (see images of my code output being used with PCAN-View software). That said, I'm human, can and do make mistakes, and am always appreciative of any feedback.
Sign In or Register to comment.