This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHXL-F28379D: C2000 MOTORCONTROL

Part Number: LAUNCHXL-F28379D
Other Parts Discussed in Thread: C2000WARE

我的开发板是 LaunchXL-F28379D,驱动板是 DEV8301REVB。 同过指南移植了C2000motorcontrol4.0.0 中电机实验室,现在遇到到问题是没有加入编码器的情况下 在MOTOR1_ENC下电机竟然可以运行起来,在MOTOR1_FAST中 上电后设置motorVas_M1.flagRunIdentAndOnLine=1后,电机发热严重,并且电机产生了烟。这种情况是为什么哪? 

void main(void)
{
    // hal.c 初始化驱动器HAL句柄。主要是分配句柄空间等
    halHandle = HAL_init(&hal, sizeof(hal));
    // hal.c 设置驱动器HAL参数。主要对初始化后的句柄进行具体的配置,配置包括中断、定时器、时钟、GPIO、ADC
    HAL_setParams(halHandle);
    // 关联motorHandle_M1和motorVars_M1
    motorHandle_M1 = (MOTOR_Handle)(&motorVars_M1);
    // false - 使能电机参数辨识, true - 禁用电机参数辨识
    userParams_M1.flag_bypassMotorId = false;
    // motor1_drive.c 初始化电机控制句柄。包括电机数量、电机设置参数句柄、用户设置参数句柄、电机HAL层控制句柄以及驱动IC参数句柄
    initMotor1Handles(motorHandle_M1);
    // motor1_drive.c 初始化电机控制参数句柄。主要对电机控制参数句柄、设置参数句柄、用户参数句柄进行具体设置。
    initMotor1CtrlParameters(motorHandle_M1);

    // 初始化CPU使用模块
    cpuTimeHandle = CPU_TIME_init(&cpuTime, sizeof(cpuTime));
    CPU_TIME_reset(cpuTimeHandle);

    //系统使能标志位置位
    systemVars.flagEnableSystem = true;

    // 初始化中断向量表
    HAL_initIntVectorTable(halHandle);

    // 使能用于控制的ADC/PWM中断
    // 使能触发DMA的中断 
    HAL_enableCtrlInts(halHandle);

    // 电机偏移校准标志位使能
    motorVars_M1.flagEnableOffsetCalc = true;

    // motor1_drive.c 使用滤波器运行电机的偏移校准
    runMotor1OffsetsCalculation(motorHandle_M1);

    // 使能全局中断
    HAL_enableGlobalInts(halHandle);

    // 使能调试中断
    HAL_enableDebugInt(halHandle);

    // 设置电源延时等待时间
    systemVars.powerRelayWaitTime_ms = POWER_RELAY_WAIT_TIME_ms;

    // 等待系统使能标志位被置位
    while(systemVars.flagEnableSystem == false)
    {
        if(HAL_getCPUTimerStatus(halHandle, HAL_CPU_TIMER0))
        {
            HAL_clearCPUTimerFlag(halHandle, HAL_CPU_TIMER0);

            systemVars.timerBase_1ms++;

            if(systemVars.timerBase_1ms > systemVars.powerRelayWaitTime_ms)
            {
                systemVars.flagEnableSystem = true;
                systemVars.timerBase_1ms = 0;
            }
        }
    }
    // 如果系统使能标志位被置位,则一直循环本while
    while(systemVars.flagEnableSystem == true)
    {
        // loop while the enable system flag is true
        systemVars.mainLoopCnt++;
        // 1ms time base:1ms运行一次本段代码?
        if(HAL_getCPUTimerStatus(halHandle, HAL_CPU_TIMER0))
        {
            // 清除CPU时钟标志位
            HAL_clearCPUTimerFlag(halHandle, HAL_CPU_TIMER0);

            // 反转LED状态
            systemVars.counterLED++;

            if(systemVars.counterLED > (uint16_t)(LED_BLINK_FREQ_Hz * 1000))
            {
                HAL_toggleLED(halHandle, HAL_GPIO_LED2C);

                systemVars.counterLED = 0;
            }

            systemVars.timerBase_1ms++;

            // 每1ms运行其中的一段代码,5ms循环一次
            switch(systemVars.timerBase_1ms)
            {
                case 1:     
                    // 电机保护检查
                    runMotorMonitor(motorHandle_M1);
                    break;
                case 2:
                    // 计算
                    calculateRMSData(motorHandle_M1);
                    break;
                case 3:
                    break;
                case 4:     
                    // 计算电机保护值:过流保护阈值
                    calcMotorOverCurrentThreshold(motorHandle_M1);
                    break;
                case 5:     
                    // 1ms计数清零
                    systemVars.timerBase_1ms = 0;
                    systemVars.timerCnt_5ms++;
                    break;
            }
        }

        // 运行电机控制函数
        runMotor1Control(motorHandle_M1);
    }

    // 禁用PWM
    HAL_disablePWM(motorHandle_M1->halMtrHandle);
}
r