The Hercules LaunchPads of Texas Instruments have two (or three) CAN controllers.
It is possible to learn the CAN protocol and have real messages flowing with the LaunchPad and only three jellybean components.
This series explains how the standard TI examples work, but it goes further than that.
I'll also be looking at the signals with an oscilloscope and logic analyzer.
What you need to follow along:
- A Hercules LaunchPad, with Code Composer Studio and HALCoGen installed
- 1 resistor (I used 3K3 - value not critical, search your spare parts drawers)
- 2 to 3 diodes (whatever you have in those same drawers)
The CAN protocol
The theory
CAN bus - Wikipedia, the free encyclopedia
The hardware
Some hardware is needed to make the CAN examples work on the Launchpads.
I have made a previous blog post that shows how to get the signals out for a LaunchPad type I (TI Hercules LaunchPad - test the CAN with a poor man's CAN driver).
TI has now launched (pun intended) a new version with three CAN controllers. More buses = more possibilities, so I'm going to start with the TI's 2 CANs example, and then move on to 3.
A typical can implementation expects that you use line drivers and twisted pair as the physical wire. And that is the proper way to work.
A common setup is that for Transmit (Tx) , the signal from the controller is translated in the CAN line driver to a balanced signal. For incoming traffic,
the driver picks up the info from the balanced line signal and gives that to the controller's Receive (Rx) pin.
Our Hercules LaunchPads don't have a CAN line driver (some other development boards from TI do have them on-board). But that does not mean that we can't work with CAN.
Siemens has published a paper that describes a simplified version: AP2921 On-Board Communication via CAN without Transceiver.
Siemens' setup only requires a single resistor, and a jellybean diode per CAN device. So we can get started with a 3.3K resistor and two diodes.
For our LaunchPads, the schematic for this setup is so easy that we can build it up on a breadboard:
If you have a Hercules LaunchPad MK I (LAUNCHXL-RM42, LAUNCHXL-TMS570004), you'll be able to communicate to 2 CANs.
On the MK II (LAUNCHXL2-RM46, LAUNCHXL2-TMS57012) you can also run that 2 CANs setup, but additionally you 'll be able to extend your setup to 3 CANs.
The review of the example code and the setup instructions for each configuration will follow in the next posts.
related posts |
---|