SPRUJ26A September 2021 – April 2024
Figure 3-22 shows the project software flow diagram of the firmware that includes one ISR for real time motor control and the main loop for motor control parameters that updates in a background loop. The ISR will be triggered by ADC End of Conversion (EOC).
To simplify the system bring up and design, the software is organized in four incremental builds, which makes learning and getting familiar with the board and software easier. This approach is also good for debugging and testing boards.
Table 3-5 lists the framework modules to be used in this lab project.
Module Names | Explanation | Algorithm |
---|---|---|
ANGLE_GEN_run | Ramp angle generator for open-loop running | eSMO, ENC, HALL |
CLARKE_run | Clarke transformation for current or voltage | FAST, eSMO, ENC, HALL |
collectRMSData, calculateRMSData | Collect sampling values to calculate the RMS value of phase current and voltage | FAST, eSMO, ENC, HALL |
DAC128S_writeData | Converts and send software variables to external DAC with SPI | All Algorithms |
DATALOGIF_update | Stores the real-time values into for displaying with graph tool | All Algorithms |
ENC_run | Calculate rotor angle based on encoder | ENC |
ESMO_run | Enhance Sliding Mode Observer (eSMO) for sensorless-FOC | eSMO |
EST_run | FAST estimator for sensorless-FOC | FAST |
EST_runTraj | Trajectory generator for current and speed for motor identification | FAST |
EST_setupTrajState | Trajectory generator setup for current and speed for motor identification | FAST |
HAL_readADCData | Returns ADC conversion values with floating-point format | All Algorithms |
HAL_writePWMDACData | Converts software variables into the PWM signals | All Algorithms |
HAL_writePWMData | PWM drives for motor | All Algorithms |
HALL_run | Calculate rotor angle ans speed based on Hall sensors | HALL |
IPARK_run | Inverse Park transformation | FAST, eSMO, ENC, HALL |
PARK_run | Park Transformation | FAST, eSMO, ENC, HALL |
PI_run | PI Regulators for current and speed | All Algorithms |
SPDCALC_run | Speed Measurement based on the angle from encoder signal | ENC |
SPDFR_run | Speed measurement based on the angle from observer | eSMO |
SVGEN_run | Space Vector PWM with quadrature control | FAST, eSMO, ENC, HALL |
TRAJ_run | Trajectory for setting speed reference | All Algorithms |
VS_FREQ_run | Generate vector voltage with v/f profile | FAST, eSMO, ENC, HALL |
Table 3-6 summarizes the modules tested in each incremental system build.
Software Module | DMC_LEVEL_1 | DMC_LEVEL_2 | DMC_LEVEL_3 | DMC_LEVEL_4 | |
---|---|---|---|---|---|
50% PWM duty, verify ADC offset calibration, PWM output, and phase shift | Open loop control to verify the motor current and voltage sensing signals | Closed current loop to validate the current sensing on the board and the current control with the PID | Closed-loop run with estimators/observers | Motor parameters identify with FAST estimators | |
HAL_readADCData | √√ | √ 1 | √ | √ | √ |
HAL_writePWMData | √√ | √ | √ | √ | √ |
ANGLE_GEN_run | √√ | √ | √(eSMO, ENC, HALL)* | ||
VS_FREQ_run | √√ | ||||
CLARKE_run (current) | √ | √ | √ | √ | |
CLARKE_run (voltage) | √ | √ (FAST)* 2 | √ (FAST)* | √ (FAST)* | |
TRAJ_run | √√ | √ | √√ | ||
EST_run | √(FAST)* | √ (FAST)* | √√ (FAST)* | √√ (FAST)* | |
EST_setupTrajState | √√ (FAST)* | ||||
EST_runTraj | √√ (FAST)* | ||||
ESMO_run | √(eSMO)* | √(eSMO)* | √√ (eSMO)* | ||
SPDFR_run | √(eSMO)* | √(eSMO)* | √√ (eSMO)* | ||
ENC_run | √(ENC)* | √(ENC)* | √√(ENC)* | ||
SPDCALC_run | √(ENC)* | √(ENC)* | √√(ENC)* | ||
HALL_run | √(HALL)* | √(HALL)* | √√(HALL)* | ||
PARK_run | √ | √ | √ | √ | |
PI_run (Id) | √√ | √ | √ | ||
PI_run (Iq) | √√ | √ | √ | ||
PI_run (speed) | √√ | √ | |||
IPARK_run | √√ | √ | √ | √ | |
SVGEN_run | √√ | √ | √ | √ | |
HAL_writePWMDACData | √** 3 | √** | √** | √** | |
DATALOGIF_update | √ | √ | √ | √ | |
DAC128S_writeData | √** | √** | √** | √** |
The universal lab project can use one of the FOC algorithms separately for motor control, or use two of the FOC algorithms simultaneously as shown in Table 3-7. The estimator in use can be switched smoothly on the fly if two algorithms are implemented in the lab project.
FAST(MOTOR1_FAST) | eSMO (MOTOR1_ESMO) | ENCODER (MOTOR1_ENC) | HALL (MOTOR1_HALL) | ISBLDC (MOTOR1_ISBLDC) | |
---|---|---|---|---|---|
FAST | √ 1 | √ | √ | √ | ✕ |
eSMO | √ | √ | √ | ✕ | ✕ |
ENCODER | √ | √ | √ | ✕ | ✕ |
HALL | √ | ✕ | ✕ | √ | ✕ |
ISBLDC | ✕ | ✕ | ✕ | ✕ | √ |