I am currently using STM32F401 blackpill, MP6540HA and a cubemars GL40.
In openloop everything is fine. But when I start to use close loop everything goes bad.
My current Q and D values do not stable, they are so unstable that in powersource, current is also osilating (You can check in video). power source - YouTube
Since current is bad; motor shaking in torque mode, or any other mode unless it is openloop, and I really couldn’t solve it. You can also check the output of the debugger: (red current q, blue current d)
I tried with both dc-current and foc-current modes.Things that I tried:
- Changing encoder(the data comes from encoder is fine I am using AS5048A).
-Tuning PID (I tried many things but none of them affect the situation).
-Changing power source.(Seems like power source is okey).
My default PID:
// velocity loop PID motor.PID_velocity.P = 1.0; motor.PID_velocity.I = 10.0; motor.PID_velocity.D = 0.0; motor.PID_velocity.output_ramp = 100.0; motor.PID_velocity.limit = 0.3; // Low pass filtering time constant motor.LPF_velocity.Tf = 0.1; // angle loop PID motor.P_angle.P = 20.0; motor.P_angle.I = 0.0; motor.P_angle.D = 0.0; motor.P_angle.output_ramp = 0.0; motor.P_angle.limit = 1000.0; // Low pass filtering time constant motor.LPF_angle.Tf = 0.0; // current q loop PID motor.PID_current_q.P = 3.0; motor.PID_current_q.I = 100.0; motor.PID_current_q.D = 0.0; motor.PID_current_q.output_ramp = 0.0; motor.PID_current_q.limit = 7.0; // Low pass filtering time constant motor.LPF_current_q.Tf = 0.02; // current d loop PID motor.PID_current_d.P = 3.0; motor.PID_current_d.I = 100.0; motor.PID_current_d.D = 0.0; motor.PID_current_d.output_ramp = 0.0; motor.PID_current_d.limit = 7.0; // Low pass filtering time constant motor.LPF_current_d.Tf = 0.02;
i am trying to solve this problem, if you have any advice i would love to hear it. Thnaks