c2000ware_motorcontrol_sdk_5_xx/ ├── solutions/ # Complete motor drive projects │ ├── universal_motor_control_lab/ # FOC labs (most important) │ └── boostxl_drv8320rs/ # Hardware-specific examples ├── libraries/ # Core libraries (IQmath, DCL, observers) ├── docs/ # API guides + Hardware guides └── tools/ # SysConfig, GUI composer, flash tools | Lab | Focus | File location | |-----|-------|----------------| | lab1 | Basic PWM, ADC, GPIO | solutions/universal_motor_control_lab/lab1_basic | | lab2 | Open-loop current control | lab2_current_control | | lab3 | Rotor alignment + open-loop voltage | lab3_rotor_alignment | | lab4 | Sensorless FAST observer (InstaSPIN) | lab4_fast_observer | | lab5 | Speed control + tuning | lab5_speed_control | | lab6 | Field weakening & MTPA | lab6_field_weakening | Pro tip: Start with lab5 if you already have a spinning motor. The FAST observer is pre-tuned for generic PMSM. 4. Essential Source Files to Modify # User configuration (always your first edit) user_j1.h # Motor parameters (Rs, Ld, Lq, flux, poles, current limits) user_j2.h # Hardware setup (ADC pins, PWM frequency, protection) Control logic (understand these) motor_control.c # Main state machine (OFF, ALIGN, OPEN_LOOP, CLOSED_LOOP) speed_control.c # PID for speed loop current_control.c # DQ PI controllers + decoupling Observer (sensorless) fast_observer.c # Estimator gains, flux angle, speed 5. Debugging & Tuning Workflow Step 1 – Real-time variables (watch expressions) Add to CCS Expressions view:
1. Core Architecture Understanding | Component | Description | |-----------|-------------| | Library Layers | IQmath (fast fractional math), DCL (PID controllers), FPU / TMU (hardware trig/divide) | | Key Modules | SDFM (sigma-delta), ePWM (HRPWM for high resolution), eQEP (encoder), ADC (simultaneous sampling) | | Control Flow | ISR based (typically 10–50 kHz) → Dual-sampling (current at PWM sync, voltage/speed at low rate) | 2. Installation & Setup (Critical Path) # Required installs (in order) 1. Code Composer Studio (v12+) 2. C2000Ware_MotorControl_SDK (latest from TI's MySecureSoftware) 3. SysConfig (included in CCS or standalone) Folder structure you must know: c2000ware motor control sdk
#define DEBUG_PRINT_ENABLE 1 #define DEBUG_FAST_OBSERVER 1 // log angle/speed error #define FAULT_RECOVERY_ENABLE 0 // disable to trap faults | Task | Function | File | |------|----------|------| | Set speed reference | MOTOR_setSpeedRef_Hz(handle, value) | motor_control.c | | Force angle for testing | FAST_setAngle_pu(observer, angle) | fast_observer.c | | Override PWM duty | HAL_setPwmDuty(handle, a, b, c) | hal.c | | Read DC bus voltage | HAL_readAdcBusVoltage_V(handle) | adc.c | Final advice: The SDK is massive, but 90% of what you need is inside universal_motor_control_lab/ . Focus on user_j1.h , motor_control.c , and the FAST observer . Use the provided motor_control_gui.exe (in tools/ ) for interactive tuning before writing your own host interface. Essential Source Files to Modify # User configuration