| Part 3: | Building Code Composer Studio Projects and Flashing the Motor Controller |
Building Code Composer Studio Projects:
In CCS, a collection of files related to a single program that will be loaded onto a DSP is called a project. What files should be included in a project is tracked using a Project file (*.pjt). Before a program can be loaded, its corresponding project must be built. The first step toward building a project is to actually open it by selecting Project->Open from the menu bar at the top of the window. This will bring up the Open Project File dialog box for browsing to the relevant Project file. Once opened, a new item with the project’s name will be displayed in the Project pane. Clicking on the ‘+’ will expand the item to include a list of folders. Expanding one of the folders in this list will bring up a list of files which can then be opened by double clicking of them. This is useful for quickly navigating to the different files in the project.

Before a project is ready to be loaded onto a DSP, it must be built by selecting Project->Build from the menu bar at the top of the window. During this process, all the source code files will be compiled and linked, and the other necessary output files will be generated. If successful, CCS will report no errors. If CSS does report errors, they will need to be corrected before continuing (some warnings, depending on their nature, may be acceptable however).
Flashing the Motor Controller:
As mentioned earlier, the On-Chip Flash Programmer will be used to load/flash the program onto the DSP, in this case the F2811 on the motor controller board. To access the plug-in, select Tools->F28xx On-Chip Flash Programmer. This should bring up the following window.
Usually, loading a program is simply a matter of choosing the ‘Erase, Program, Verify’ option and clicking the ‘Execute Operation’ button. However, the plug-in will need to be configured the first time it is used. To do this, first click ‘Browse’ and choose the proper COFF file (*.out). The COFF file is generated when the project is built and usually resides in the Debug or Release folders. After that, click on the ‘Flash Programmer Settings’ button. In the window that appears, click ‘Browse’ and choose the FlashAPIInterface2811V2_10.out file (or another compatible 2811 Flash API Interface file). The other settings in the window should be set to match those shown below. When this is done, click ‘Ok’.

It should now be possible choose ‘Erase, Program, Verify, Option’, if it is not already chose, and click the ‘Execute Operation’ button to flash the program onto the MC. When this happens, the program will be stored in the DSP’s flash memory. If the MC is connected to the PC via the JTAG Emulator, the program can be started and stopped using the Run and Halt buttons on Target Control toolbar (shown below). Alternatively, the program will run automatically once the DSP is powered on if the MC is not connected.
Continue to Part 4, Programming Overview...