2022-06-13 03:19 PM
My ramp cranks current up to my max within 5 pwm cycles. I'm traced it down to STC_CalcTorqueReference, it calculates some increment value. I assume that's the issue. the math works out but something is wrong here.
This is a custom power stage and I have gone over every part of the config, i've tested the current sensors and confirmed they match the configuration calculations. Would appreciate any suggestions where to look next. I understand the shunt / gain is weird, and they will be changed in the next rev but the value does come back correct (if a bit noisy)
#define THREE_SHUNT
#define RSHUNT 0.003
#define AMPLIFICATION_GAIN 200.0
/***************** MOTOR ELECTRICAL PARAMETERS ******************************/
#define POLE_PAIR_NUM 7 /* Number of motor pole pairs */
#define RS 0.63 /* Stator resistance , ohm*/
#define LS 0.000042 /* Stator inductance, H
For I-PMSM it is equal to Lq */
#define NOMINAL_CURRENT 8579
#define MOTOR_MAX_SPEED_RPM 15000 /*!< Maximum rated speed */
#define MOTOR_VOLTAGE_CONSTANT 0.6 /*!< Volts RMS ph-ph /kRPM */
#define ID_DEMAG -8579 /*!< Demagnetization current */
/* Phase 1 */
#define PHASE1_DURATION 1000 /*milliseconds */
#define PHASE1_FINAL_SPEED_UNIT (0*SPEED_UNIT/U_RPM)
#define PHASE1_FINAL_CURRENT 8579
/* Phase 2 */
#define PHASE2_DURATION 6000 /*milliseconds */
#define PHASE2_FINAL_SPEED_UNIT (2814*SPEED_UNIT/U_RPM)
#define PHASE2_FINAL_CURRENT 8579
The plot attached is my phase B low side (yellow) and Bus Current (red).
Appreciate any where i can go to look.
2022-06-14 08:41 AM
Upon looking at it further, it seems my current reference is getting set correctly. Still uncertain why I'm getting such a huge spike at the beginning, then it starts to come down. after a few cycles.
2022-06-14 01:21 PM
More information.
I found i had a current sensor wire swapped, but the current ramp is still very aggressive, it goes from a - out of bonds (<-2.75A to >2.75A) in 100 us @ 15kHz switching freq. (been playing with the sw freq to find a sweet spot as well as the deadtime.
I have the option on this dev driver board to do inline current sense and shunt. Is the algorithm explicity looking for shunt current? Looking at the code it doesn't seem to make any difference.. But i could be wrong.
2022-06-15 06:53 AM
Problem found, documentation was wrong, I miss typed GPIO numbers so my wires were going to the wrong place!
Now I'm fighting speed reference issues. It will spin up but doesn't get up to the correct speed.