Tool/software: Code Composer Studio
Hi,
Do I need to modify the default code to enable the system and connect the throttle to use as a stand alone circuit?
To start the motor in CCS, I have to click in enable system and set it to 1, then click on run and set it to one, then click on SpeedRef_krpm and set it to a value to control speed.
When I cycle power however, the board is not controlling any speed nor does the throttle have any effect. My thought is that enable and run have to be hard-coded to 1 in order to use this board outside of CCS. Is that so? Also, there appears to be no link in the code between throttle.result and gMotorVars.SpeedRef_krpm. Is this a line I will need to add?
Thank you in advance and best regards,
Sean
P.S., here is where I expected this link, around line 400 in TIDM-1003.c
// set the speed reference
CTRL_setSpd_ref_krpm(ctrlHandle,gMotorVars.SpeedRef_krpm);
// set the speed acceleration
CTRL_setMaxAccel_pu(ctrlHandle,_IQmpy(MAX_ACCEL_KRPMPS_SF,gMotorVars.MaxAccel_krpmps));
if(Flag_Latch_softwareUpdate)
{
Flag_Latch_softwareUpdate = false;
USER_calcPIgains(ctrlHandle);
// initialize the watch window kp and ki current values with pre-calculated values
gMotorVars.Kp_Idq = CTRL_getKp(ctrlHandle,CTRL_Type_PID_Id);
gMotorVars.Ki_Idq = CTRL_getKi(ctrlHandle,CTRL_Type_PID_Id);
// initialize the watch window kp and ki values with pre-calculated values
gMotorVars.Kp_spd = CTRL_getKp(ctrlHandle,CTRL_Type_PID_spd);
gMotorVars.Ki_spd = CTRL_getKi(ctrlHandle,CTRL_Type_PID_spd);
}
}
else
{
Flag_Latch_softwareUpdate = true;
// the estimator sets the maximum current slope during identification
gMaxCurrentSlope = EST_getMaxCurrentSlope_pu(obj->estHandle);
}
// when appropriate, update the global variables
if(gCounter_updateGlobals >= NUM_MAIN_TICKS_FOR_GLOBAL_VARIABLE_UPDATE)
{
// reset the counter
gCounter_updateGlobals = 0;
updateGlobalVariables_motor(ctrlHandle);
}
{
THROTTLE_setup(throttleHandle,
gAdcData.Throttle,
false,
false);
THROTTLE_runState(throttleHandle);
}