Now with LAB_5_B project of motorware_14 I can spin my BLDC HUB MOTOR successfully
I have also interface potentiometer at ADC_A4 pin to control speed of my motor.(ADC gives me values between 0 to 1 in Q-24 format). following is the intermediate value of my potentiometer which stored in gPotentiometer variable.
BLDC HUB MOTR IS AS FOLLOWS:
I have connected two potentiometer as follows
(1) first Potentiometer value stored in variable gPotentiometer and its used to control motor speed.
(2) second Potentiometer value stored in variable gPotentiometer1 and its used to enable or disable the (c2000f28027f & DRV BoostXL 8301 )
the value of first potentiometer is display bellow for having control on motor speed.
Now with this I can make an E-bike But there is problem occurs with the above logic.
lets assume that motor is running on plane road with speed 200 RPM,now there is slope,,,then while going downside motor speed will increase more that 200 rpm ;;but i am applying 200RPM ,,sooo controller may get damage.
To overcome this problem I should able to switch off the controller while going on slope..ORRR I have to apllly other logic so that controller understand its downslope and its automaticallly switch off itself.
To make controller off I have made following changes.
for this I have made changes in the proj_lab05b.c, in main loop which is as follows::
gPotentiometer1 = HAL_readPotentiometerData1(halHandle);//ADC channel at this pin is kept to either 3.3 v or a 0.00 v
gPotentiometer = HAL_readPotentiometerData(halHandle);
if(EST_isMotorIdentified(obj->estHandle))
{
// set the current ramp
EST_setMaxCurrentSlope_pu(obj->estHandle,gMaxCurrentSlope);
gMotorVars.Flag_MotorIdentified = true;
// set the speed reference
if (gPotentiometer1 >=0.5)
{
gMotorVars.SpeedRef_krpm = gPotentiometer;
CTRL_setSpd_ref_krpm(ctrlHandle,gMotorVars.SpeedRef_krpm);
}
else
{
gMotorVars.Flag_enableSys = false;
gMotorVars.Flag_Run_Identify =false;
}
if (gPotentiometer1 >=0)
{
gMotorVars.Flag_enableSys = true;
gMotorVars.Flag_Run_Identify =true;
}
but (( gMotorVars.Flag_enableSys )))flag is not set to true once it gets disable ;;;I have to restart the system again .
what corresponding changes i have to make so that gMotorVars.Flag_enableSys flag can set or reset from gPotentiometer1 variable.???