• Resolved

CCS/TMS320F28335: Getting started with the C2000 in 2018

Part Number: TMS320F28335

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

    Regards, Disona.

  • In reply to Disona:

    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.
  • In reply to Frank Pernice90:

    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

  • In reply to Frank Pernice90:

    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

    Regards, Disona.

  • 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

  • In reply to Ken Schachter:

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

    Regards,

    Todd Anderson

  • In reply to Ken Schachter:

    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 ****

  • In reply to Frank Pernice90:

    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
  • In reply to Ken Schachter:

    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?

  • In reply to Frank Pernice90:

    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