Whistling when stepper motor stops

Hi, I have a problem when I run my stepper motor 17HS4001 12v,1.7A by DRV8825 ( vref = 0.85v), everything is fine when he turns but after stopping I hear a whistle from the motor, I don't know why, and if there is any method to reduce it

Note: When I reduce vref to 0.5v the whistle disappear, but this is not a good method because the necessary current is 1.7A so vref = 0.85v

/* stepper motor control code for DRV8825
 * 
 */

 // define pin used
 const int stepPin = 8;
 const int dirPin = 9;
 
 void setup() {
 // set the two pins as outputs
  pinMode(stepPin,OUTPUT);
  pinMode(dirPin,OUTPUT);

}

void loop() {
digitalWrite(dirPin,HIGH); //Enables the motor to move in a perticular direction
// for one full rotation required 200 pulses
for(int x = 0; x < 900; x++){
  digitalWrite(stepPin,HIGH);
  delayMicroseconds(500);
  digitalWrite(stepPin,LOW);
  delayMicroseconds(500);
}
delay(2000); // delay for one second



}

Hello there!

It could be that the motor is moving at a very very slow speed that is not discernible, and could cause this sound.

Do you have the logic supply and motor supply grounds connected? Or are they connected internally on the board?

The "whistling" is due to the current limiting action of the motor driver, and there is nothing you can do about it.

The current limit must be adjusted according to the motor specifications and the required torque.

bos1714:
Hello there!

It could be that the motor is moving at a very very slow speed that is not discernible, and could cause this sound.

Do you have the logic supply and motor supply grounds connected? Or are they connected internally on the board?

The motor run at high speed and the GNDs are connected on the board

jremington:
The "whistling" is due to the current limiting action of the motor driver, and there is nothing you can do about it.

The current limit must be adjusted according to the motor specifications and the required torque.

So there is no solution, but why when i reduce the vref to 0.5V the whistle disappear?

You are reducing the motor current to the point that the whistle is inaudible.

If that amount of current produces sufficient torque for your project, problem solved!

jremington:
You are reducing the motor current to the point that the whistle is inaudible.

If that amount of current produces sufficient torque for your project, problem solved!

it's no a problem if i set the vref less than the required vref proportional to the rated current 1.7A (0.85v) ??

The "rated current" for the motor is the maximum allowed steady state current per winding.

Different stepper drivers will have different chopping frequencies and different degrees of audible whining,
but they all have it at some level. Different motors will have different mechanical resonances too.