Datasheet
Copyright © 2013 ARM Ltd. All rights reserved
CAN: Controller Area Network Lab using ST STM32 Cortex-M processors. www.keil.com
13
CAN Controllers and their Errata Sheets:
CAN controllers are very sophisticated modules. Many times someone is experiencing trouble getting something to work or
has an unexpected crash or result and they desperately search their code for the error causing this. Sometimes the answer lies
in the errata sheet and not in your software. This document lists all known deviant behaviour from that claimed in the device
datasheet. Some CAN controllers have bugs and you should find out what they are.
Note that technical support staff statistics show that many errors are in the user software code so check this carefully.
You should get the latest errata sheets and read them. You can potentially save an enormous amount of time. Sometimes the
weirdest problems are caused by these defects. Then you have to be prepared for the day these bugs get fixed and show up in
silicon on your board. Most issues will be in the controllers and not the rather simpler transceivers.
TIP: There are several Internet CAN newsgroups and mailing lists that can help you with your network. Remember that not
all people on these groups are experts and there is some risk of getting poor information. Fortunately, these self-proclaimed
experts are in the minority. See http://tech.groups.yahoo.com/group/CANbus/ and www.canlist.org.
For CANopen and other information see: www.can-cia.org/ Most CANopen docs are free. Most other documents are not.
Test Tools:
The biggest problem in getting your first CAN network running is that in order to see some messages, you have to have both
a receiving node and a transmitting node properly working at the same time. This can be quite an onerous task. There are
two ways to help here. One is to use a working node such as an evaluation board with some proven CAN examples provided.
You can attempt to receive these known good CAN frames with your node.
Second, you can purchase a CAN test tool. This is the best idea. These provide both sending and receiving capabilities and
usually (optionally) act as a CAN node. There are two types: simple low cost devices that provide basic creating and
displaying bus traffic and those offering advanced capabilities such as translation that can save some serious cash and time.
Typical sources for inexpensive tools are SYS TEC (www.phytec.com/products/can/),
UUwww.kvaser.comUU and PEAK
UUwww.peak-system.comUU which is also sold in the USA through www.phytec.com. There are many other companies that sell
these types of inexpensive tools. Search the Internet to find these.
Oscilloscopes are quite useful in making sure the CAN waveforms are not distorted. This can disclose the causes of some
very strange network behavior. For a combination CAN analyzer and oscilloscope see www.phytec.com/pcan-diag.html or
search the web for Phytec PCAN-Diag. Standard scopes also work well and of these, memory scopes work best. CAN aware
scopes can provide the most useful testing abilities available.
If you are developing a more capable and powerful CAN system, you might want to consider a CAN analyzer. These offer
very advanced features such as triggering, filtering and best of all; a database where your ID and data bytes are displayed in
words rather than raw hex numbers. This will save a lot of time and make for a better, more reliable product. Normally, you
can construct your own database to convert numbers embedded in the CAN frames to your own custom descriptive words.
Typical suppliers are Dearborn Group
UUwww.dgtech.comUU, National Instruments UUwww.ni.comUU, Intrepid UUwww.intrepidcs.comUU
and Vector CANalyzer UUwww.vector.comUU. Do not be afraid to use an automotive type device even if your application is
something else. CAN is CAN no matter where it is used and no matter what anybody says. Everything else sits on top of
CAN. Even so, it would be good to check if an analyzer is sufficiently adaptable for your needs.
As with all tools, buy the best analyzer you can afford ! You are rarely disappointed with fine products…only cheap ones…
CAN Documents:
CAN documents are available for ISO (ISO 11898) and SAE (J1939). They are not free. www.iso.org and www.sae.org.
The original Bosch 2.0 document is free: Search the web for can2spec.pdf.
Keil provided Software:
Keil sells CAN middleware for many ARM Cortex-M processors. Visit www.keil.com/rl-arm/rl-can.asp
The Keil RTX RTOS is now available free with a BSD type license. Ports are available for Keil MDK, IAR and GCC.
See www.arm.com/cmsis for more information. See http://forums.arm.com for general information.
What’s ahead:
Now, on the next few pages, we will look at how we can program a real CAN controller to transmit and receive messages.
There are some hands-on experiments you can try – the Keil evaluation software is free and for most exercises no hardware is
needed. We will use the Keil simulator which is part of MDK. No license is needed. For the others, you will need a
STM32F400 Discovery board. No hardware debug adapter is needed. We will use the on-board ST-Link V2.