SPRA876B January 2003 – September 2017 TMS320C28341 , TMS320C28341 , TMS320C28342 , TMS320C28342 , TMS320C28343 , TMS320C28343 , TMS320C28343-Q1 , TMS320C28343-Q1 , TMS320C28344 , TMS320C28344 , TMS320C28345 , TMS320C28345 , TMS320C28346 , TMS320C28346 , TMS320C28346-Q1 , TMS320C28346-Q1 , TMS320F2801 , TMS320F2801 , TMS320F2801-Q1 , TMS320F2801-Q1 , TMS320F28016 , TMS320F28016 , TMS320F28016-Q1 , TMS320F28016-Q1 , TMS320F2802 , TMS320F2802 , TMS320F2802-Q1 , TMS320F2802-Q1 , TMS320F28030 , TMS320F28030 , TMS320F28030-Q1 , TMS320F28030-Q1 , TMS320F28031 , TMS320F28031 , TMS320F28031-Q1 , TMS320F28031-Q1 , TMS320F28032 , TMS320F28032 , TMS320F28032-Q1 , TMS320F28032-Q1 , TMS320F28033 , TMS320F28033 , TMS320F28033-Q1 , TMS320F28033-Q1 , TMS320F28034 , TMS320F28034 , TMS320F28034-Q1 , TMS320F28034-Q1 , TMS320F28035 , TMS320F28035 , TMS320F28035-EP , TMS320F28035-EP , TMS320F28035-Q1 , TMS320F28035-Q1 , TMS320F28050 , TMS320F28050 , TMS320F28051 , TMS320F28051 , TMS320F28052 , TMS320F28052 , TMS320F28052-Q1 , TMS320F28052-Q1 , TMS320F28053 , TMS320F28053 , TMS320F28054 , TMS320F28054 , TMS320F28054-Q1 , TMS320F28054-Q1 , TMS320F28055 , TMS320F28055 , TMS320F2806 , TMS320F2806 , TMS320F2806-Q1 , TMS320F2806-Q1 , TMS320F28062 , TMS320F28062 , TMS320F28062-Q1 , TMS320F28062-Q1 , TMS320F28062F , TMS320F28062F , TMS320F28062F-Q1 , TMS320F28062F-Q1 , TMS320F28063 , TMS320F28063 , TMS320F28064 , TMS320F28064 , TMS320F28065 , TMS320F28065 , TMS320F28066 , TMS320F28066 , TMS320F28066-Q1 , TMS320F28066-Q1 , TMS320F28067 , TMS320F28067 , TMS320F28067-Q1 , TMS320F28067-Q1 , TMS320F28068F , TMS320F28068F , TMS320F28068M , TMS320F28068M , TMS320F28069 , TMS320F28069 , TMS320F28069-Q1 , TMS320F28069-Q1 , TMS320F28069F , TMS320F28069F , TMS320F28069F-Q1 , TMS320F28069F-Q1 , TMS320F28069M , TMS320F28069M , TMS320F28069M-Q1 , TMS320F28069M-Q1 , TMS320F2808 , TMS320F2808 , TMS320F2808-Q1 , TMS320F2808-Q1 , TMS320F2809 , TMS320F2809 , TMS320F2810 , TMS320F2810 , TMS320F2810-Q1 , TMS320F2810-Q1 , TMS320F2811 , TMS320F2811 , TMS320F2811-Q1 , TMS320F2811-Q1 , TMS320F2812 , TMS320F2812 , TMS320F2812-Q1 , TMS320F2812-Q1 , TMS320F28232 , TMS320F28232 , TMS320F28232-Q1 , TMS320F28232-Q1 , TMS320F28234 , TMS320F28234 , TMS320F28234-Q1 , TMS320F28234-Q1 , TMS320F28235 , TMS320F28235 , TMS320F28235-Q1 , TMS320F28235-Q1 , TMS320F28332 , TMS320F28332 , TMS320F28333 , TMS320F28333 , TMS320F28334 , TMS320F28334 , TMS320F28335 , TMS320F28335 , TMS320F28335-Q1 , TMS320F28335-Q1 , TMS320R2811 , TMS320R2811
The TMS320x28xx series of Microcontrollers/Digital Signal Controllers feature an on-chip enhanced Controller Area Network (eCAN) module. This module is a full-CAN controller, compliant with CAN specification 2.0B. This application report contains several programming examples, supplemental to those in C2000Ware/controlSUITE, to illustrate how the eCAN module is set up for different modes of operation. The objective is to help you come up to speed quickly in programming the eCAN. All programs have been extensively commented to aid easy understanding.
The code examples were tested on a TMS320F28335 device; however, the examples can be easily adapted to run on any C2000 device that features the eCAN module. Most of the examples need CAN-B (the second CAN node) for operation. For parts that have only one CAN module (CAN-A), a second (external) CAN node is needed to emulate the function of CAN-B. This requirement can be met by any CAN bus analysis tool. Many inexpensive USB-bus based CAN bus analysis tools are currently available. These tools provide visibility to the CAN bus traffic and are also capable of generating CAN bus frames and are an invaluable aid in debugging CAN issues. An oscilloscope with built-in CAN bus triggering/decoding is a vital debugging aid as well.
Project files are available for download from the following URL: http://www.ti.com/lit/zip/spra876.
All trademarks are the property of their respective owners.
CAN is a multi-master serial protocol that was originally developed for automotive applications. Due to its robustness and reliability, it now finds applications in diverse areas such as Industrial automation, appliances, medical electronics, maritime electronics, and so forth. CAN protocol features sophisticated error detection (and isolation) mechanisms and lends itself to simple wiring at the physical level.
Figure 1 shows the typical implementation of the CAN bus.
The example projects are meant to run seamlessly when installed in the Examples directory of C2000ware. If running the examples on a 2833x/2832x target, unzip the files in C:\ti\c2000\C2000Ware_1_00_01_00\device_support\f2833x\examples directory. For other target devices, the target directory and support files need to be modified.
This example performs repeated writes and reads to the mailbox RAM. Since it exercises the mailbox RAM heavily, it may also be used to check the correct functionality of the mailbox RAM bits.
This program transmits data to another CAN module. The transmit loop can be executed a predetermined number of times or infinite times. Useful to check the transmit functionality.
This is an example of how data may be received using polling.
This is a simple example of how data may be received using interrupts. It also illustrates the ability of the CAN module to service multiple interrupts automatically.
CAN-A transmits to CAN-B, which then echoes the data back to CAN-A. CAN-A then verifies the transmitted and received data. This example can be used to check communication between CAN-A and CAN-B. Both CAN ports of the DSP need to be connected to each other (via CAN transceivers).
Illustrates the operation of DBO field for a Transmit mailbox.
Illustrates the operation of DLC field for a Transmit mailbox.
This code illustrates the functionality of the WDIFn bit (WDIF- Write Denied Interrupt Flag).
This example illustrates the ”Message Object Time Out (MOTO)” feature.
This example illustrates the ability of the CAN module to service multiple interrupts automatically. Specifically, this example shows how when an interrupt flag is set while another interrupt flag is already set, the most recent interrupt flag automatically generates a core level interrupt upon exiting the ISR of the previous interrupt.
This example illustrates how contents of a mailbox can be protected from being overwritten by using the “Overwrite Protection Control (OPC)” bit.
This example illustrates the functionality of the “Timer Counter Overflow Flag (TCOF)” bit.
This program illustrates the programmable transmit-priority and time stamping feature.
Checks the transmit abort operation using the TRR bit.
This example illustrates the ability of the CAN module to enter and exit low-power mode (LPM). Note that this low-power-mode is local to the CAN module and should not be confused with the device-level low-power-modes like HALT, STANDBY and IDLE.
This example illustrates the ability of the CAN module to SEND remote frames from (and receive data frames in) the same Mailbox.
Illustrates how Acceptance Mask Filtering works using CANLAM registers.
A useful test-jig for debugging CAN bus issues. Can Transmit/Receive Standard and Extended frames at various bit-rates. Also capable of transmitting (and responding to) Remote frames. All options are selected using GPIO0-GPIO3 or through a hard-coded value in the program.