Other Parts Discussed in Thread: DRV8711
Hello team,
I'm using a BOOST-DRV8711 to control a stepper motor. In the very beginning, everything is ok, the register values are normal and the motor worked well. But the driver and motor failed suddenly when I tried to write the register one by one to verify the values, which will be a feedback status to a new task in the future. So, nothing changed to the current version. The initialization code of DRV8711 is similar to the ti example, which the only difference is that I designed the register classes to make the initialization easier.
/* Write all registers' value into DRV8711 */ void Driver::WriteAllReg() { uint16_t data = 0; CTRLreg.R_NW = 0; CTRLreg.Encode((uint8_t*)&data); SPI_RW(data); TORQUEreg.R_NW = 0; TORQUEreg.Encode((uint8_t*)&data); SPI_RW(data); OFFreg.R_NW = 0; OFFreg.Encode((uint8_t*)&data); SPI_RW(data); BLANKreg.R_NW = 0; BLANKreg.Encode((uint8_t*)&data); SPI_RW(data); DECAYreg.R_NW = 0; DECAYreg.Encode((uint8_t*)&data); SPI_RW(data); STALLreg.R_NW = 0; STALLreg.Encode((uint8_t*)&data); SPI_RW(data); DRIVEreg.R_NW = 0; DRIVEreg.Encode((uint8_t*)&data); SPI_RW(data); STATUSreg.R_NW = 0; STATUSreg.Encode((uint8_t*)&data); SPI_RW(data); }
Then I read carefully the datasheet of DRV8711, I think the reason is most likely the TORQUE register goes back to the rest value after power on. My idea is that the CTRL register is written first, and the ENABLE bit had been set. But the rest value of the TORQUE was 0xFF at that moment. Unfortunately, I was debugging the feedback value of another program related to SPI for a while. The current should be very large during that time which leads to the failure of the motor. But, I'm not sure if my idea is right.
Best regards,
Li.