TIDUF67 April 2024 – December 2024
Figure 4-5 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 is 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 4-4 lists the framework modules to be used in this 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 | eSMO, ENC, HALL |
collectRMSData, calculateRMSData | Collect sampling values to calculate the RMS value of phase current and voltage | eSMO, ENC, HALL |
DATALOG_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 |
HAL_readMtr1ADCData | 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 | eSMO, ENC, HALL |
PARK_run | Park Transformation | eSMO, ENC, HALL |
PI_run | PI Regulators for current and speed | All Algorithms |
PI_run_series | Runs the series form of the PI controller | SFRA, MPTA |
SPDCALC_run | Speed Measurement based on the angle from encoder signal | ENC |
SPDFR_run | Speed measurement based on the angle from observer | eSMO |
SVGEN_runMin | Space Vector PWM with quadrature control | eSMO, ENC, HALL |
TRAJ_run | Trajectory for setting speed reference | All Algorithms |
VS_FREQ_run | Generate vector voltage with v/f
profile for Vd and Vq calculation in level 2. This can be done manually based on specific motors. |
eSMO, ENC, HALL |
Table 4-5 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 | |
HAL_readMtr1ADCData | √√ | √ | √ | √ |
HAL_writePWMData | √√ | √ | √ | √ |
ANGLE_GEN_run | √√ | √ | √(eSMO, ENC, HALL)* | |
VS_FREQ_run | √√ | |||
CLARKE_run | √ | √ | √ | |
TRAJ_run | √√ | √ | √√ | |
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_runMin | √√ | √ | √ | |
HAL_writePWMDACData | √** | √** | √** | |
DATALOG_update | √ | √ | √ |
The universal project can use one of the FOC algorithms separately for motor control, or use two of the eSMO and encoder FOC algorithms simultaneously. The estimator in use can be switched smoothly on the fly if two algorithms are implemented in the project.