The traditional high-frequency square wave injection method can improve the speed control accuracy by using the saturated saliency effect of the rotor. However, this method also causes distortion in the current containing a large number of harmonics, which has a negative impact on the torque ripple of the motor. In this paper, based on the traditional high-frequency square wave injection method, through the harmonic current suppression algorithm, the 5th and 7th current harmonic components are collected by coordinate transformation and low-pass filter. The collected data is subjected to harmonic voltage compensation. The proposed method can eliminate the harmonic current component in the motor operation and achieve the purpose of suppressing the torque ripple. Simulation and experimental results show that the algorithm can effectively suppress the distortion of stator current, reduce torque ripple, and has high flexibility.