JAJU802A January 2022 – October 2022
The general structure of the project is shown in Figure 3-6. The device peripherals configuration is based on C2000Ware driverlib. The users only need to change the codes and definitions in hal.c and hal.h, and the parameters in user_mtr1/mtr2/pfc.h if they want to migrate the reference design software to their own board.
Once the project is imported, the project explore will appear inside CCS as shown in Figure 3-7.
The folder src_foc includes the typical FOC modules include transform, PID and estimators that consist of the motor drive algorithm are independent on specific device and board.
The folder src_lib includes the digital power control modules for PFC, InstaSPIN-FOC library and math library that is independent of device and board.
The folder src_sys includes some files reserved for system control that are independent on specific device and board.
The folder src_control includes motor drive and PFC control files that call motor and PFC control core algorithm functions within the interrupt service routines and background tasks.
The F28002x, F28003x and F280013x projects share all of the control algorithm files. Board-specific, motor-specific and device-specific files are in the folder of src_board, these files consist of device specific drivers to run the solution. The F28002x, F28003x and F280013x have a dedicated hal.c, hal.h, user_mtr1.h, user_mtr2.h, and user_pfc.h separately. So the user only needs to make some changes in these header files, hal.c, hal.h, user_mtr1.h, user_mtr2.h, and user_pfc.h based on the usage of device peripherals for the board if the user wants to migrate the project into a different board or device.
Figure 3-8 shows the project software flow diagram of the firmware that includes three ISRs for PFC and motor control, a main loop for PFC and motor control parameters update in background loop.
The project consists of three interrupt service routines, which are called every PWM cycle or every two PWM cycles. A few background tasks are called in a polling fashion and can be used to run slow tasks for which absolute timing accuracy is not required, such as PFC control parameters update, motor control parameters update and so on. A CPU timer is used to trigger slow background tasks.
motor1CtrlISR is reserved for calling the motor drive control algorithms to spin the motor 1 (Compressor) that is periodically triggered at USER_M1_ISR_FREQ_Hz.
motor2CtrlISR is reserved for calling the motor drive control algorithms to spin the motor 2 (Fan) that is periodically triggered at USER_M2_ISR_FREQ_Hz.
pfcCtrlISR is reserved for calling the digital power control algorithms to implement PFC that is periodically triggered at USER_PFC_ISR_FREQ_Hz.
To simplify the system bring up and design the software of this reference design is organized in four labs with incremental builds (PFC_BUILDLEVEL and DMC_BUILDLEVEL), which makes learning and getting familiar with the board and software easier. This approach is also good for debugging and testing boards. The detailed incremental build options is shown as in Table 3-1. To select a particular build option, select the corresponding BUILDLEVEL option in sys_settings.h. Once the build option is selected, compile the project by selecting rebuild all compiler option. Section 3.3 provides more details to run each of the build level options.
OPERATION | BUILD OPTION | DESCRIPTION |
---|---|---|
PFC | PFC_LEVEL_1 | 50% PWM duty output, verify ADC offset calibration, PWM output and phase shift |
PFC_LEVEL_2 | Open loop control to check current and voltage sensing signals for PFC | |
PFC_LEVEL_3 | Closed current loop | |
PFC_LEVEL_4 | Closed current and voltage loop | |
MOTOR DRIVE | DMC_LEVEL_1 | 50% PWM duty, verify ADC offset calibration, PWM output and phase shift |
DMC_LEVEL_2 | Open loop control to check current and voltage sensing signals for motor 1 and 2 | |
DMC_LEVEL_3 | Closed current loop to check the hardware settings | |
DMC_LEVEL_4 | Motor parameters identify and run with InstaSPIN-FOC/eSMO |