Change register to DRV8711

Hi!
I am working with arduino mega connect to DRV8871 driver. The driver is connected to stepper motor and to dc motor. every time with differeny motor.
I read that I need to set the OFF bit as 1 to use the driver in pwm moe for the ds motor.
I am trying to do it with the writeReg() function in DRV8711SPI class.
It is not working.
can anyone please tell me what is my mistake?

(I added 2 Serial.prints to show the OFF bit before and after the write and I always get the same value)

#include <HighPowerStepperDriver.h>
#include <SPI.h>

HighPowerStepperDriver stepper;
DRV8711SPI driver;

void setup()
{
Serial.begin(9600);
  SPI.begin();
  stepper.setChipSelectPin(SC_PIN);
  delay(1); // Give the driver some time to power up.
  stepper.resetSettings();
  stepper.clearStatus();
  stepper.setDecayMode(HPSDDecayMode::AutoMixed);
  stepper.setCurrentMilliamps36v4(4000);
  stepper.setStepMode(HPSDStepMode::MicroStep1);//1
}

//------------------------------------------------------------

void loop()
{
// ... some code run the stepper motor

 driver.writeReg(HPSDRegAddr::OFF, 0);
    Serial.println(driver.readReg(HPSDRegAddr::OFF));
    driver.writeReg(HPSDRegAddr::OFF, 0X80);
    Serial.println(driver.readReg(HPSDRegAddr::OFF));
   digitalWrite(MOTOR_TYPE, 1);
   digitalWrite(MOTOR0_DIR_PIN,1);
   analogWrite(MOTOR0_PWM_PIN, 125);
      delay(1000);
      analogWrite(MOTOR0_PWM_PIN, 0);
}

Thank

I think it's interesting that you read the datasheet in the driver DRV8871, as I understand it doesn't have SPI communication, so the SPI port must be being used in another way, just to generate pulses.

But the driver DRV8711, this one shows SPI communication in the datasheet.

MOTOR and MOTOR0?

1 Like

Yes, that was mt typing mistake. the driver is 8711.
I am able now to set the register, but I dont know how to use this driver as pwm mode.
Please help me.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.