I working on my implementation of vector control for PMSM. I'm having close loops over speed, current in d axis(flux loop), current in q axis(torque loop). I'm using MATLAB/Simulink for vector control algorithm, X2C makes communication with DSP from Texas Instruments Delphino TMS320F28335. HVPFC KIT is used as a driver or a motor. I'm trying to improve phase currents wave forms. These are also dq currents with they referencies in stacionary state. At rated speed machine is turning at 3000 rpm, where current frequencies are 200Hz. I tried to move moment when currents are sampled, changed max voltage duty cycle. Tried to speed up current regulators. Nothing helps, any suggestions?