SPRUHJ1I January 2013 – October 2021 TMS320F2802-Q1 , TMS320F28026-Q1 , TMS320F28026F , TMS320F28027-Q1 , TMS320F28027F , TMS320F28027F-Q1 , TMS320F28052-Q1 , TMS320F28052F , TMS320F28052F-Q1 , TMS320F28052M , TMS320F28052M-Q1 , TMS320F28054-Q1 , TMS320F28054F , TMS320F28054F-Q1 , TMS320F28054M , TMS320F28054M-Q1 , TMS320F2806-Q1 , TMS320F28062-Q1 , TMS320F28062F , TMS320F28062F-Q1 , TMS320F28068F , TMS320F28068M , TMS320F28069-Q1 , TMS320F28069F , TMS320F28069F-Q1 , TMS320F28069M , TMS320F28069M-Q1
All of the functionality of InstaSPIN-FOC is accessible through an extensive API. This API remains the same whether InstaSPIN-FOC is in ROM or user memory. In this section, we will review the most commonly used functions that provide access to variables and enable your application to implement system control. These functions are used in the lab example projects at the end of this guide. For the latest and complete listing of the API functions, see the Resource Explorer found within CCStudio.
Another resource for the API functions that is especially useful during software development is the Outline View within CCStudio. This is feature provides navigation across the multiple files with a complete hyperlink listing of all the symbols within the file you are using that is part of a CCStudio project. Access this view from the CCStudio menu: Window->Show View->Outline.
Following is a screen capture using this view with ctrl.c. Notice that by clicking on the function name in the Outline window, the cursor in the Source window highlights the related code. You can quickly navigate functions and all symbols within a file, which is especially useful for the large number of API functions in InstaSPIN-FOC.
When using Outline View with ctrl.h you will notice some functions do not have source code listed. These functions will have a circle with a green and white pattern next to the filename (instead of a solid green circle). This indicates it is one of the few files that must remain in ROM since it is a function that interfaces directly to the FAST estimator. An example of this can be seen in the following image where the function CTRL_initCtrl() does not have source code but the function CTRL_isError() does.
Figure 4-1 provides an overview of the InstaSPIN-FOC system functions and variables as they relate to user memory and ROM. Notice the key functions: CTRL_run, CTRL_setup, EST_run, HAL_run, HAL_acqAdcInt, and HAL_readAdcData. Also, the variables shown are all available. For example, the Ki gain for PI used for Id and Iq can be read with the function CTRL_getKi and set with CTRL_setKi. The intention is to give full access to all functions and variables.
The API can be grouped into the following four categories:
For the F2802xF devices, the API has an additional library in user memory:
The commonly used functions from each of these groups are listed in the next sections.