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.

CCS/TMS320F28335: Getting started with the C2000 in 2018

Part Number: TMS320F28335
Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE

Tool/software: Code Composer Studio

I apologize for the very broad question, but I'm totally lost; I've been struggling here for a few days now and I need help.

I've got a TMS320F28335 and the Experimenter Kit. I somehow managed to get an LED blinking on this after jumping through a series of (seemingly out-dated tutorials). My goal is to get TI-RTOS running on this and to start working with PWM and serial communications. However, like I said (coming from the Atmel/Arduino world) the documentation seems to be very scattered and out of date depending on where I look and I cannot seem to get a straight, simple answer. I'm still not entirely sure if I'm missing things; almost every attempt to import example code (other than the LED Blink) results in numerous compilation errors. I got started with the F2833x Firmware Development Package User's Guide (I reported an error in it, I presume it was taken down because I can no longer find the most current version, or any version, on the TI website). Some of the documents make reference to ControlSuite while others make reference to C2000Ware. Following along with these tutorials is very difficult because everything is different. TI-RTOS seems like a whole other beast (which again, is a separate download). I'm just not sure how to get started here for real, there's way too much information and no clear direction on how to just pick this thing up and go.

  • Hello, Frank
    I can't help you on TI-RTOS, but maybe you'll find some info useful.
    ControlSUITE and C2000ware are related products for C28-core based MCU. But controlSUITE is something like old name for C2000ware. I think it's better to download C2000ware:
    www.ti.com/.../C2000WARE

    All MCU stuff is in folder "device_support".

    So C2000ware is a pack with: peripheral headers, peripheral drivers, linker files and examples for all C28 MCUs. Including F28335.
    How to start: install C2000ware, open CCS (v7.4.0 is the last one). Then go "Project - Imort CCS projects...". Browse to "C:\ti\c2000\C2000Ware_1_00_03_00\device_support\f2833x\examples\cpu_timer" and press "Import". This is an example with... well CPU timers.
    Could you please try it?

    I found workshops useful enough, though they are for F28379D, but give it a try:
    processors.wiki.ti.com/.../C2000_Multi-Day_Workshop
  • Ok, thanks, that worked. But now suppose I want to make my own project, not an example project. How would I go about doing that? There are so many files that are linked to the project and it's not exactly clear which ones I need to add to do a particular task. I mean, the file names are self-explanatory, but the layers upon layers of directories make it impossible to find what I'm looking for without some sort of document to map out what belongs in each file and where it's located.
  • Hi Frank,

    Welcome to C2000!

    Disona has given some very good tips. 

    In addition and especially for someone new to our device family, I'd like to recommend that you take a look at the F28335 Multi-Day workshop.  It was last updated in 2010 (we primarily focus on keeping 1-2 workshops up to date), but the content, labs and instructions should match up well - even to newer versions of CCS. 
    http://processors.wiki.ti.com/index.php/C2000_Archived_Workshops#C2000_Delfino_Multi-Day_Workshop_-_Revision_8.1_November_2010_.28ExpKit_F28335.3B_CCSv4.2.3B_DSP.2FBIOS_5.41.29

    Note that the first labs go through the process of building a new project. 

    I will comment that many people start with an example project and then adapt it to meet their needs.  Depends on preference and how much confidence one has with the example structure that C2000 built.

    For documentation, you'll find most information in the datasheet and the peripheral user guides.


    Thank you,
    Brett

  • Well, maybe it will seem a little bit difficult. I once tried to work with arduino (after TI MCUs) and I was astonished by number of libraries for every caprice - i2c, spi, oled/led displays - every feature had a tested library. I just called a function - and it worked! But C28 MCus are not that easy.

    I don't know your skills in bare-metal programming, so my explanations might seem unnecessary, but anyway, i try give it step-by-step:

    First, create a project for your MCU (F28335) with "Projects - New CCS Project". Set project path and MCU type. Select "Empry project" in examples.

    When you set up a new project you have to describe MCU memory. This is done by linker script. It describes memory of your MCU and puts program sections into that memory: code, variables etc. Linker scripts have "*.cmd" extension. You can take a linker script from controlsuite ("C:\ti\controlSUITE\device_support\f2833x\v142\DSP2833x_common\cmd"): "28335_RAM_lnk.cmd" if you want your project to reside in RAM memory (for debug) or "F28335.cmd" for flash.

    Any MCU is driven by its peripherals. Peripherals are controled with its registers. Peripheral regiesters reside in MCU memory (just like your program and data). TI gives you headers with peripheral description. You have to link that desritption to MCU memory, so you have to add one more linker script (C:\ti\controlSUITE\device_support\f2833x\v142\DSP2833x_headers\cmd) called "DSP2833x_Headers_nonBIOS.cmd". Of course, this is not for RTOS - there is "nonBIOS" in its name. Because i don't know bios stuff =)

    So now you have full MCU memory description. It's time to define stuff that will reside in that memory. At first - structures for peripherals. For example - you have SPI module. It has some setttings - baudrate, package length, chip-select behavior etc. You set that settings with some registers. Those registers are combined into structers - you can access them in your program like "SpiRegs.Baudrate = 57600;". And those structures are defined in peripheral headers according to documetation. So you can (have to) add the headers into your project. The headers reside in "C:\ti\controlSUITE\device_support\f2833x\v142\DSP2833x_headers\include" folder. You have to go to project properties (right click on your project), "CCS Build" - "C2000 Compiler"- "Include Optios". Then click "Add..." at "Add dir to path...", and browse to "C:\ti\controlSUITE\device_support\f2833x\v142\DSP2833x_headers\include". Now you have path to headers in your ptoject.

    Ok, you have definitions for peripheral structures, but what about declaration? Well, declaration is in "DSP2833x_GlobalVariableDefs.c" file - "C:\ti\controlSUITE\device_support\f2833x\v142\DSP2833x_headers\source". Copy this one to your project.

    Next, if you want (and you definitely want) your MCU to work properly, you have to set up MCU clock, enable peripherals and some other stuff. There are functions for this jobs, and you have to add source files with this functions to your project. The most important function is called "InitSysCtrl()". It is defined in one of source files. You have to browse to "C:\ti\controlSUITE\device_support\f2833x\v142\DSP2833x_common\" folder and copy "source" folder to your project. Now you have a variety of peripheral-functions in your project. It was too easy... NO! It was not easy! For some reason there are 3 files that declare same interrupts. Delete
    "DSP2833x_SWPrioritizedDefaultIsr.c" and "DSP2833x_SWPrioritizedPieVect.c". Don't ask me why.

    You now have system functions. But that functions are tricky - they want to use some special variables and types (Uint16 for example). You can examine build errors and fix them OR you can just add some headers with types and funtion defines. The headres are located in "C:\ti\controlSUITE\device_support\f2833x\v142\DSP2833x_common\include". Again you have to enter project properties and add this path to "Include options".

    Now - the only missing is "main" function. Create "main.c" file. Declare "void main (void)" in that file. Inside "void main()" call "InitSysCtrl()" function to set up the MCU. But don't forget to include headers for "InitSysCtrl()". For that you have to include FIRST "DSP2833x_Device.h" (it has typdefs and peripheral headers inclusion) and then "DSP2833x_Examples.h" - that one has "InitSysCtrl()" prototype.

    I now have F28335 empty project built. Do you have it? It's time to blink leds and spin a motor with FOC, i guess...

    It was easy =)

    Here's a "*.zip" file with an example, but you have to edit include paths. I hope this helps.

    F28335_proj.zip

  • Frank,

    Sorry about my delayed reply, but I was out on business travel this past week. In the past, I have had conversations with your company's engineering management about working with our devices.  As Brett has already pointed out, the F28335 workshop might be your best starting point.  I am the author of the workshops, and please do not get frustrated with the C2000.  Once the process is understood, things will get much easier.  The first minor issue that you will run into with the F28335 workshop is it was released back in November 2010 and developed with CCSv4, therefore some of the CCS related lab directions will differ slightly when using a newer version of CCS.  All of my workshops for the past +20 years have followed the same basic flow, which allows users to easily move between versions of CCS and also helps in understanding how to migrate between device families.  I just released a new F28379D (multi-day) workshop which uses the latest CCSv7.  The reason I am pointing this out to you, is so that you can refer to this workshop for updated lab directions that are specific to CCSv7 (that is, in case you are planning to use CCSv7).  All workshops are completely self-contained and do not require the installation of controlSUITE/C2000Ware.  All of the necessary support files (i.e. header files) are included with the installation (which makes it very portable).  However, please also note that the F28335 workshop includes a module on DSP/BIOS rather than TI-RTOS (SYS/BIOS).

    I understand you main question is - "where to start?" I strongly suggest downloading, installing, and running the F28335 workshop.  If you will be using CCSv7 rather than CCSv4, then also download the F28379D workshop manual to help assist with the CCS lab direction changes.  If you are still having difficulty, then please contact your local TI representative and we can try to have a conference call.  All of the workshop resources can be found at:

    http://processors.wiki.ti.com/index.php/C2000_32-bit_Real-Time_MCU_Training

    (Also, note that the F28379D one-day workshop has been recorded, but specifically module 3 video covers the basics of CCSv7. If you plan to use CCSv7 then this might be useful to you).

    Please let me know if this helps, or if you have any further questions. If this resolves your issue, please click the green "Verified Answer" button to close this thread.  Thank you.

    - Ken

  • www.mindshareadvantage.com/.../ is a good place to go to learn more about TI RTOS.
  • Hi Ken,

    I apologize for my delayed response as well. I  got sidetracked on other projects, but now I'm back on it for a little while.

    I Decided to use the F28379D workshop and modify it as needed for the F28335. I got up to about page 3-13 of the workshop PDF, where it starts telling you (vaguely) how to add in the device-specific header files. I tried adding in the one for the F28335 (note, that everything I did previously, to the best of my knowledge, was modified for the F28335). . I'm getting a memory error after adding the non-BIOS command file from C2000Ware. I've attached my Lab2 project and the build log below.1460.Lab2.zip

    Any help is appreciated.

    **** Build of configuration Debug for project Lab2 ****
    
    "C:\\ti\\ccsv7\\utils\\bin\\gmake" -k -j 8 all -O
    
    'Building file: "../Lab2.c"'
    
    'Invoking: C2000 Compiler'
    
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.7.LTS/bin/cl2000" -v28 -ml -mt --float_support=fpu32 --include_path="C:/ti/Workshops/C287x/Labs/Lab2/cpu01" --include_path="C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.7.LTS/include" --include_path="C:/ti/c2000/C2000Ware_1_00_04_00/device_support/f2833x/headers/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="Lab2.d_raw"  "../Lab2.c"
    
    'Finished building: "../Lab2.c"'
    
    'Building file: "../DSP2833x_GlobalVariableDefs.c"'
    
    'Invoking: C2000 Compiler'
    
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.7.LTS/bin/cl2000" -v28 -ml -mt --float_support=fpu32 --include_path="C:/ti/Workshops/C287x/Labs/Lab2/cpu01" --include_path="C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.7.LTS/include" --include_path="C:/ti/c2000/C2000Ware_1_00_04_00/device_support/f2833x/headers/include" --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number --preproc_with_compile --preproc_dependency="DSP2833x_GlobalVariableDefs.d_raw"  "../DSP2833x_GlobalVariableDefs.c"
    
    'Finished building: "../DSP2833x_GlobalVariableDefs.c"'
    
    'Building target: "Lab2.out"'
    
    'Invoking: C2000 Linker'
    
    "C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.7.LTS/bin/cl2000" -v28 -ml -mt --float_support=fpu32 --advice:performance=all -g --diag_warning=225 --diag_wrap=off --display_error_number -z -m"Lab2.map" --stack_size=0xFFF --warn_sections -i"C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.7.LTS/lib" -i"C:/ti/ccsv7/tools/compiler/ti-cgt-c2000_16.9.7.LTS/include" --reread_libs --diag_wrap=off --display_error_number --xml_link_info="Lab2_linkInfo.xml" --rom_model -o "Lab2.out" "./DSP2833x_GlobalVariableDefs.obj" "./Lab2.obj" "../DSP2833x_Headers_nonBIOS.cmd"  -llibc.a
    
    <Linking>
    
    warning #10247-D: creating output section ".text" without a SECTIONS specification
    
    warning #10247-D: creating output section ".cinit" without a SECTIONS specification
    
    warning #10247-D: creating output section ".ebss" without a SECTIONS specification
    
    warning #10247-D: creating output section ".reset" without a SECTIONS specification
    
    error #10099-D: program will not fit into available memory.  run placement with alignment/blocking fails for section ".stack" size 0xfff page 1.  Available memory ranges:
    
      DEV_EMU      size: 0x180        unused: 0xb0         max hole: 0xb0      
    
      FLASH_REGS   size: 0x60         unused: 0x58         max hole: 0x58      
    
      CSM          size: 0x10         unused: 0x0          max hole: 0x0      
    
      ADC_MIRROR   size: 0x10         unused: 0x0          max hole: 0x0      
    
      XINTF        size: 0x20         unused: 0x2          max hole: 0x2      
    
      CPU_TIMER0   size: 0x8          unused: 0x0          max hole: 0x0      
    
      CPU_TIMER1   size: 0x8          unused: 0x0          max hole: 0x0      
    
      CPU_TIMER2   size: 0x8          unused: 0x0          max hole: 0x0      
    
      PIE_CTRL     size: 0x20         unused: 0x6          max hole: 0x6      
    
      PIE_VECT     size: 0x100        unused: 0x0          max hole: 0x0      
    
      DMA          size: 0x200        unused: 0x120        max hole: 0x120    
    
      MCBSPA       size: 0x40         unused: 0x1b         max hole: 0x1b      
    
      MCBSPB       size: 0x40         unused: 0x1b         max hole: 0x1b      
    
      ECANA        size: 0x40         unused: 0xc          max hole: 0xc      
    
      ECANA_LAM    size: 0x40         unused: 0x0          max hole: 0x0      
    
      ECANA_MOTS   size: 0x40         unused: 0x0          max hole: 0x0      
    
      ECANA_MOTO   size: 0x40         unused: 0x0          max hole: 0x0      
    
      ECANA_MBOX   size: 0x100        unused: 0x0          max hole: 0x0      
    
      ECANB        size: 0x40         unused: 0xc          max hole: 0xc      
    
      ECANB_LAM    size: 0x40         unused: 0x0          max hole: 0x0      
    
      ECANB_MOTS   size: 0x40         unused: 0x0          max hole: 0x0      
    
      ECANB_MOTO   size: 0x40         unused: 0x0          max hole: 0x0      
    
      ECANB_MBOX   size: 0x100        unused: 0x0          max hole: 0x0      
    
      EPWM1        size: 0x22         unused: 0x0          max hole: 0x0      
    
      EPWM2        size: 0x22         unused: 0x0          max hole: 0x0      
    
      EPWM3        size: 0x22         unused: 0x0          max hole: 0x0      
    
      EPWM4        size: 0x22         unused: 0x0          max hole: 0x0      
    
      EPWM5        size: 0x22         unused: 0x0          max hole: 0x0      
    
      EPWM6        size: 0x22         unused: 0x0          max hole: 0x0      
    
      ECAP1        size: 0x20         unused: 0x0          max hole: 0x0      
    
      ECAP2        size: 0x20         unused: 0x0          max hole: 0x0      
    
      ECAP3        size: 0x20         unused: 0x0          max hole: 0x0      
    
      ECAP4        size: 0x20         unused: 0x0          max hole: 0x0      
    
      ECAP5        size: 0x20         unused: 0x0          max hole: 0x0      
    
      ECAP6        size: 0x20         unused: 0x0          max hole: 0x0      
    
      EQEP1        size: 0x40         unused: 0x0          max hole: 0x0      
    
      EQEP2        size: 0x40         unused: 0x0          max hole: 0x0      
    
      GPIOCTRL     size: 0x40         unused: 0x12         max hole: 0x12      
    
      GPIODAT      size: 0x20         unused: 0x0          max hole: 0x0      
    
      GPIOINT      size: 0x20         unused: 0x16         max hole: 0x16      
    
      SYSTEM       size: 0x20         unused: 0x0          max hole: 0x0      
    
      SPIA         size: 0x10         unused: 0x0          max hole: 0x0      
    
      SCIA         size: 0x10         unused: 0x0          max hole: 0x0      
    
      XINTRUPT     size: 0x10         unused: 0x0          max hole: 0x0      
    
      ADC          size: 0x20         unused: 0x2          max hole: 0x2      
    
      SCIB         size: 0x10         unused: 0x0          max hole: 0x0      
    
      SCIC         size: 0x10         unused: 0x0          max hole: 0x0      
    
      I2CA         size: 0x40         unused: 0x1e         max hole: 0x1e      
    
      CSM_PWL      size: 0x8          unused: 0x0          max hole: 0x0      
    
      PARTID       size: 0x1          unused: 0x0          max hole: 0x0      
    
    error #10099-D: program will not fit into available memory.  placement with alignment/blocking fails for section ".text" size 0xf4 page 0.  Available memory ranges:
    
    error #10099-D: program will not fit into available memory.  placement with alignment/blocking fails for section ".cinit" size 0x1f page 0.  Available memory ranges:
    
    error #10099-D: program will not fit into available memory.  placement with alignment/blocking fails for section ".reset" size 0x2 page 0.  Available memory ranges:
    
    error #10010: errors encountered during linking; "Lab2.out" not built
    
    >> Compilation failure
    
    makefile:142: recipe for target 'Lab2.out' failed
    
    gmake[1]: *** [Lab2.out] Error 1
    
    makefile:138: recipe for target 'all' failed
    
    gmake: *** [all] Error 2
    
    **** Build Finished ****

  • Frank,

    First, Lab 2 exercise does not use any of the peripherals and therefore does not need the header files. Next, your project is missing a 'user' linker command file (Lab2.cmd) - which is in the directions on page 2-21, step 11. This explains your linking errors. Lab 2 exercise is designed to be an intro to CCS with a basic (minimum) linker command file. The header files are used starting with the Lab 5 exercise. Working with the header files is explained very clearly in this lab exercise. Please read the directions carefully.

    I hope this helps. If this answers your question, please click the green "Verified Answer" button. Thanks.

    - Ken
  • All right. So I was going though it procedurally, step by step. I had the Lab2.cmd file in there during Lab2, but at Lab3, I had assumed it wanted me to add the peripheral-specific headers, so I deleted Lab2.cmd and replaced it with the .cmd file for the F28335, hence the problem. I'm reading it step-by-step and since Lab3 explained how to add the device-specific headers (starting at page 3-11), I assumed that's what I was supposed to do. Am I wrong?

  • Frank,

    A project can contain more than one linker command file, but they cannot overlap. The header files linker command file is specific to the device peripherals, and the user linker command file is for the application code. Are you following the multi-day workshop materials? If so, the next lab exercise after Lab 2 is Lab 5 (and not Lab 3). Lab 5 covers the topics from modules 3, 4, and 5. Follow the directions in Lab 5 and it will explain how to create a project with the header files.

    I hope this helps. If this answers your question, please click the green "Verified Answer" button. Thanks.

    - Ken
  • Frank,

    It's been a while since we have heard from you last. Therefore, we are assuming you were able to resolve your issue. If this isn’t the case, please reject this resolution or reply to this thread. If this thread locks, please make a new thread describing the current status of your issue. Thank you.

    - Ken
  • Hey Ken, yes, I apologize for the lack of responses. The nature of my work has me on many projects simultaneously. This has been at the bottom of my stack, so I go back to it when I have spare time, which is usually never. Let me try out your suggestions and get back to you now that I have some free time. 

  • Hey Ken,

    I thin I finally got things going, now that I've had some more time to dedicate to this. My biggest issue was tying C2000Ware in with the workshops, since the workshops don't use C2000Ware directly, so it was extremely confusing figuring out how to integrate them. The labs are structured in a way that it throws a bunch of theory at you while trying to teach you CCS (not to mention outdated versions of CCS), so you can imagine why I was confused. I finally found the attached PDF in the Resource Explorer in Code Composer (for some odd reason it doesn't appear to be available on the website, at least not the most recent version). Anyway, I'm posting it here for the next person who has problems. F2833x_DEV_USER_GUIDE.pdf

  • Frank,

    The F2833x workshop uses the 'device_support' resources which can be found in either C2000Ware or controlSUITE. When this workshop was developed, only controlSUITE was available. All newer workshops use C2000Ware. The document you attached can be found in the 'docs' folder under 'device_support' in both C2000Ware and controlSUITE.

    - Ken
  • Yes, I know that now, but it took a long time to figure that out. Why it wasn't also posted to the website is beyond me. Please see my arguments for posting it to the website here: e2e.ti.com/.../2551790

    Not to mention, the file in C2000Ware has an error in it. Why should I wait for a new version of C2000ware for the corrected document to be published? That information should be updated as soon as possible, front and center, on the website. Not hidden deep in the installation. I ended up going on a wild-goose-chase to find that information and it wasn't fun. I ended up in these date d"multi-day" workshops, trying to piece something together, but I wasn't getting very far due to different software versions and changes in library names and whatnot. Not to mention that the workshops always seemed to want to copy files into the workspace rather than link them. That's fine and dandy when you're working with a very specific target device... not when you're trying to piece a tutorial together from other ones to get it working on your target device... it just becomes a mess. Not to mention, odds are, 99.99% of people won't be making modifications to the SDK files, it makes no sense to copy files, the linker and compiler get confused because files aren't where they're supposed to be, etc. And when the files you need aren't present in the workshops (due to different target devices), you have to hunt for them in C2000Ware and cross your fingers you found the right file. The workshops ought to instruct you to install C2000ware, point you to the correct version for the workshop, and instruct you in using that; not shipping you a slimmed-down version of it for another MCU than the one you have.