TIMotorLIB can be used with Code Composer 3.3 and 4.0 versions. Creation steps for a project using the library in both IDE's is described below.
- Project --> New...
- Choose a Project Name, a Location, set Project Type to Executable (.out) and Target to TMS320C28XX
- Open Project --> Build Options
- In Project --> Build Options --> Compiler --> Basic, set Opt Level to Function (-o2)
- In Project --> Build Options --> Compiler --> Advanced, set Use large memory model and Unified memory model.
- In Project --> Build Options --> Compiler --> Preprocessor add to the Include Search Path TIMotorLIB directory and Texas Headers (downloadable from here) directory to compiler include path:
C:\tidcs\c28\DSP2833x\vXXX\DSP2833x\headers\include
C:\tidcs\c28\DSP2833x\vXXX\DSP2833x\common\include
C:\tidcs\c28\DSP2833x\vXXX\DSP2833x\common\source
- In Project --> Build Options --> Compiler --> Preprocessor Pre-Define needed library symbols: FIXED_POINT_LIB, D_AXIS_REAL or Q_AXIS_REAL and USE_XINTF
- In Project --> Build Options --> Linker --> Basic, set Stack Size to 0x380.
- In Project --> Build Options --> Linker --> Libraries, add C:\CCStudio_v3.3\C2000\cgtools\lib to search path and include rts2800_ml.lib.
- Project --> Add Files to Project. Object and Library Files: TIMotorLIB.lib, IQMath.lib and SFO_TI_Build_V5.lib
- Project --> Add Files to Project. Linker Command File: TIMotorLIB.cmd
- Choose a project name.
- Select both Debug/Release configurations.
- Link Linker Command File: TIMotorLIB.cmd in the TIMotorLIB folder.
- Project --> Properties --> Basic Options: Optimization level (O2 (default)).
- Project --> Properties --> Runtime Model Options: Check Use large memory model and Unified memory model.
- Project --> Properties --> C2000 Linker: File Search Path: Include library or command file as imput: rts2800\_ml.lib.
- Project --> Properties --> C2000 Linker: Basic Options: Set C System stack size: 0x380.
- Add TIMotorLIB directory to compiler include path (Project --> Properties --> Tool Settings: C/C++ Build --> Include Options: WorkSpace: TIMotorLIB
- Add Texas Headers (downloadable from here) directory to compiler include path:
C:\tidcs\c28\DSP2833x\vXXX\DSP2833x\headers\include
C:\tidcs\c28\DSP2833x\vXXX\DSP2833x\common\include
C:\tidcs\c28\DSP2833x\vXXX\DSP2833x\common\source
TIMotorLIB can be configured some of its parameters by means of preprocesor language. Used macros are following described:
- DSP_FAMILY: This macro is used to change Texas Headers includes depending on family selection. By default is set to DSP2833x
- LIBRARY_BUILD: This macro is used to report errors at compiling time if needed symbols have not been defined. Definition of this macro asserts that error reporting only heppens when a file is compiled to generate an executable. THIS SYMBOL MUST BE DEFINED WHEN COMPILING TIMOTORLIB.
- FIXED_POINT_LIB/FLOATING_POINT_LIB: The library has been designed with the aim of working both in fixed point DSCs (using IQMath) and in floating point DSCs. ONE OPTION MUST BE DEFINED WHEN COMPILING TIMOTORLIB.
- Note:
- Floating point behavior needs to be tested.
- D_AXIS_REAL/Q_AXIS_REAL: Three phase systems are best analyzed when represented as a complex variable (ab = a+jb). When dealing with complex variables, an axis orientation must be chosen. There are two common used options dq = d+jq (D_AXIS_REAL) or qd = q-jd (Q_AXIS_REAL). ONE OPTION MUST BE DEFINED WHEN COMPILING TIMOTORLIB. be selected by definin
- USE_XINTF/USE_FLASH: DataStorage unit is used for data storing in memory. The library can be configured for using an external memory connected through the external interface (USE_XINTF) or flash memory (USE_FLASH). ONE OPTION MUST BE DEFINED WHEN COMPILING TIMOTORLIB.
- Note:
- Flash is still not working in version 0.3