Are there any elegant and simple solution to problems below?
1. There is a small motor movement accompanied by a knocking noise at the moment PWM outputs are enabled using HAL_enablePwm(halHandle). The movement and noise can be reduced following last post from here, but not totally. Current waveform shows a spike when this happens.
2. When disabling speed control when motor is running, current changes to 0 (IqRef_A) immediately. What can I do so that it will continue the wave shape until the next zero crossing?
I tried setting IqRef_A to the instantaneous current before turning off speed mode, using the codes below:
_iq currentIq = _IQmpy(CTRL_getIq_in_pu(ctrlHandle), _IQ(USER_IQ_FULL_SCALE_CURRENT_A));
gMotorVars.IqRef_A = currentIq;
CTRL_setFlag_enableSpeedCtrl(ctrlHandle, false);
Current waveform shows a glitch where current still fall back to 0 immediately, before changing to IqRef_A afterwards. The suddenly current drop to 0 and the glitch causes a faint knocking sound, which I need to get rid off.