Why USER_MOTOR_MAX_CURRENT in user.h of lab12b can not be difined greater than 128.0 ?
But The CCS Compile correct when I difine USER_MOTOR_MAX_CURRENT greater than 128.0 in user.h of lab03b .
The maximum current of my motor is 259A .
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.
Why USER_MOTOR_MAX_CURRENT in user.h of lab12b can not be difined greater than 128.0 ?
But The CCS Compile correct when I difine USER_MOTOR_MAX_CURRENT greater than 128.0 in user.h of lab03b .
The maximum current of my motor is 259A .
Stefan,
The reason you get this build error is because in InstaSPIN-MOTION we allow you to run-time modify the output maximum and minimum of the speed regulator. The interaction variable has the unit of Amps and is an IQ24 variable. So when you set USER_MOTOR_MAX_CURRENT to 259.0, the software has a build error because it tries to place a value of 259.0 into an IQ24 variable. The way to fix this is to change the units of these variables from Amps to Scaled Amps. I've included the code changes below:
spintac_velocity.h:
//! \brief Initalization values of SpinTAC global variables #define ST_VARS_DEFAULTS {false, \ ST_VEL_ID_IDLE, \ 0, \ 0, \ 0, \ 0, \ 0, \ true, \ ST_CTL_IDLE, \ _IQ24(USER_SYSTEM_BANDWIDTH_SCALE), \ 0, \ _IQ24(USER_MOTOR_MAX_CURRENT / USER_IQ_FULL_SCALE_CURRENT_A), \ -_IQ24(USER_MOTOR_MAX_CURRENT / USER_IQ_FULL_SCALE_CURRENT_A), \ 0, \ ST_MOVE_IDLE, \ ST_MOVE_CUR_STCRV, \ 0, \ false, \ 0, \ ST_PLAN_STOP, \ ST_PLAN_IDLE, \ false, \ 0, \ 0, \ 0, \ 0}
proj_lab12b.c:
// initialize the watch window with maximum and minimum Iq reference gMotorVars.SpinTAC.VelCtlOutputMax_A = STVELCTL_getOutputMaximum(stObj->velCtlHandle); gMotorVars.SpinTAC.VelCtlOutputMin_A = STVELCTL_getOutputMinimum(stObj->velCtlHandle);
// set the maximum and minimum values for Iq reference STVELCTL_setOutputMaximums(stObj->velCtlHandle, gMotorVars.SpinTAC.VelCtlOutputMax_A, gMotorVars.SpinTAC.VelCtlOutputMin_A);
// get the Iq reference from the speed controller gMotorVars.IqRef_A = STVELCTL_getTorqueReference(stObj->velCtlHandle);
If you make those code changes, then the variables gMotorVars.SpinTAC.VelCtlOutputMax_A, gMotorVars.SpinTAC.VelCtlOutputMin_A, and gMotorVars.IqRef_A will no longer be in the units of Amps. They will be Amps scaled by USER_IQ_FULL_SCALE_CURRENT_A. This will remove the build errors you are seeing.
Adam,
Thanks for your reply. The errors is removed , but you said "the variables gMotorVars.SpinTAC.VelCtlOutputMax_A, gMotorVars.SpinTAC.VelCtlOutputMin_A, and gMotorVars.IqRef_A will no longer be in the units of Amps. They will be Amps scaled by USER_IQ_FULL_SCALE_CURRENT_A." and the value of USER_IQ_FULL_SCALE_CURRENT_A must be larger than the maximum current , so
in user.h
#define USER_IQ_FULL_SCALE_CURRENT_A (250.0) // 41.25 Example for drv8301_revd typical usage #define USER_ADC_FULL_SCALE_CURRENT_A (500.0) // 82.5 drv8301_revd current scaling
but there is two Warnings, I modify the code like you said , Warnings removed .
Adam,
Though the errors and warnings are removed , but when I run the project , the motor doesn't move , and the current is too high that my PCB board is burn out , and ouch ! it break my little heart deeply...
Stefan,
I don't have great advice to give. My background is software. There are some good hardware experts on this forum. I know there have been some posts here about creating high power drives. I've linked one below that might be some help:
There could be another issue in the software, but I'm not sure what it could be.