2020-05-02 10:04 PM
I use FOC+Hall and try to start in forward direction by speed mode as below:
MC_ProgramSpeedRampMotor1(200/6, 200)
MC_StartMotor1()
but the motor become backward direction
I found at STC_CalcTorqueReference() function, the return value SPD_GetAvrgMecSpeed01Hz() is very big such 3630
hMeasuredSpeed = SPD_GetAvrgMecSpeed01Hz( pHandle->SPD );
hence, the value of hTorqueReference is negative
hTorqueReference = PI_Controller( pHandle->PISpeed, ( int32_t )hError );
I found that the value of HALL_M1.CurrentSpeed become 32767(0x7FFF) at HALL_TIMx_CC_IRQHandler() when motor is not in rotation status.
since the value of HALL_M1.CurrentSpeed 32767, the hall direciton become negative, then the motor ration become backward direction.
anyone know the reason?
Thanks
2020-05-03 03:14 AM
I never tried the hall sensors until now... But yesterday i found a horrible bug while experimenting with a quad encoder for position control. Maybe in your case, it´s something similar...