This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CAN support for C2000

Other Parts Discussed in Thread: TMS320F28027, TMS320F28035, CONTROLSUITE, CCSTUDIO

Hi Guys,

I am a total noob to TI and the way their whole system is setup. I am a 4th year engineering student and have a project with the C2000 LaunchPad. 

First, please suggest some introduction documentation that will bring me up to speed.

Second, do the c2000 have CAN functionality? What will be the best way to add this fuction if not?

Thanks in advance!

  • Hi Bartho,

    First of all... Welcome to the world of C2000 family!

    First, please suggest some introduction documentation that will bring me up to speed.

    I would like you to go through this wiki link: http://processors.wiki.ti.com/index.php/C2000_LaunchPad

    Also, to know basics of C2000 family refer this: 0763.C2000 Controllers.pdf

    Second, do the c2000 have CAN functionality? What will be the best way to add this fuction if not?

    C2000 controllers do have eCAN module but few of them don't! The C2000 launchpad has a controller TMS320F28027 which does not have an eCAN module.

    Regards,

    Gautam

  • Bartho,


    Welcome to C2000! It will be easier to suggest documents if you can tell us more about your project and your background in microcontroller programming. I'm assuming you're using Code Composer Studio and writing code in C, so the first thing I would suggest is making sure you're familiar with the syntax of pointers and structures. You should also make sure you're familiar with the concept of memory-mapped registers as an interface for controlling hardware with a CPU. You should be able to handle the former on your own. Hopefully your computer architecture classes have covered the latter. I can give you a brief refresher if you'd like.

    Unfortunately, the Launchpad uses the one C2000 device that doesn't have a CAN module (F2802x). CAN is too complex to implement in software using GPIOs. One option would be to use an external CAN controller with an SPI interface. I don't think TI makes one, but Microchip's MCP2515 might do the job. Getting that working would be a project in itself, though. Alternately, if you're not wedded to the Launchpad, you could try a different C2000 part. All of the F2803x chips have CAN built in. Regardless of which option you choose, you will need an external CAN transceiver to interface with an actual CAN bus.

    Please let me know if there's anything else I can help with.

  • Hi Adam,

    So for my backround: I did do a course on micro controllers using a Renesas chip. The course was more based on fundamental priciples. Setting up eeprom and uart etc. We did not have debugging capabilities like with the CCS. 

    Then I am switching to the TMS320F28035 for it's CAN functionality. 

    The project that I have is Battery management system/battery monitoring system for a LI-Ion battery. Will be using the AD7280A chip for cell balancing and voltage measurements. Will use a difference amplifier for current measurements. These values must the be sent via a CAN bus to the master controller. (Power values) Hope that is enough detail? 

    Thanks for all the help!

  • Bartho,

    The first thing you'll want to do is download controlSUITE, which will give you all of our support software and example code, and Code Composer Studio, which is our software development IDE:

    http://www.ti.com/tool/controlsuite
    http://www.ti.com/tool/ccstudio

    Look in c:\ti\controlSUITE\device_support\f2803x\<latest version>. The doc/ directory has a guide for getting started with software development. There are a lot of options to deal with, so I'll try to give you a simple flow for project creation. The easiest way is to modify an existing example project, but in case something goes wrong, here's what you need to do it manually:

    1. Create a new CCS project, selecting your part number (TMS320F28035) and emulator (??) along the way. This will get you a project with a blank main.c file, a linker command file (for running out of RAM), and a suitable CCXML file for using the debugger.

    2. Set up your build options. You shouldn't have to do much. Under C2000 Compiler -> Include Options, add:

    c:\ti\controlSUITE\device_support\f28035\<latest version>\DSP2803x_common\include
    c:\ti\controlSUITE\device_support\f28035\<latest version>\DSP2803x_headers\include

    to your include paths.

    3. Add files to your project. For any project, you will need:

    * One linker command file for memory allocation from DSP2803x_common\cmd. 28035_RAM_lnk.cmd is for running out of RAM, and F28035.cmd is for running out of flash.
    * One linker command file for the register structures from DSP2803x_headers\cmd. Use the non-BIOS version.
    * DSP2803x_GlobalVariableDefs.c (register structure declarations) from DSP2803x_headers\source.
    * DSP2803x_CodeStartBranch.asm from DSP2803x_common\source. This is your program entry point. It calls the C library's environment setup routines and eventually leads to main().

    In addition, you'll probably want other support files from DSP2803x_common\source. All example code needs the SysCtrl and usDelay files. For interrupts, you'll need PieCtrl, PieVect, and DefaultIsr. There are a couple eCAN initialization functions in the ECan file.

    4. Write your code in main.c and whatever other files you create. You'll need to #include "DSP28x_Project.h" in each file, plus whatever C standard library headers you need.

    5. Compile your code. Fix any errors or warnings.

    6. Launch the debugger using the CCXML file from the Target Configurations panel. Be sure your hardware is powered up and the emulator is connected.

    7. Connect to the target CPU using the debug panel. Right-click on the CPU and choose Connect. Once you've done this, you can load your code (compiled .out file) from the Run menu.

    Note that the eCAN registers require 32-bit writes. The examples all use a shadow register structure to accomplish this. This is because the C28 CPU normally does 16-bit accesses when writing to bit fields. It's important to remember that the C28 (being a DSP) does not use the normal data sizes you may be used to from ARM or x86. In C28 C:

    * char is 16 bits (yes, that means we have 16-bit bytes)
    * int is 16 bits
    * long is 32 bits
    * Pointers are 24 bits

    Usually you don't have to worry about this. Let the example code be your guide.

    Please let me know if you'd like me to ramble about anything else. :-)

  • Hi Adam

    So I am having some difficulty setting up my controller. I am using the cc2803x iso control card. I want to program it using the onboard usb slot. Which emulator should I use? I cant seem to specify which one? At the moment I am trying the XDS100 v1 and I have tried v2 and v3, but none of them are working? Can you please help me with setting up the connection? I would really appreciate you help. Been at this for 2 days with no success. :(

    Thanks in advance!

  • Bartho,

    I'm afraid I don't know very much about the controlCARDs. You might do better posting this as a new question where more people will see it. Please be sure to mention any specific error messages you get. Before that, you might check whether the Windows drivers are installed correctly after you plug in the controlCARD. Sorry I can't be more helpful.