This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

DRV8899-Q1EVM: Issue while controlling the stepper motor operation using an external MCU with SPI commands

Part Number: DRV8899-Q1EVM

Hello TI team,

I have been DRV8899-Q1EVM kit to drive a stepper motor. I tried to operate the stepper motor using the available GUI from TI, and it is working fine. I am able to operate the motor by sending the SPI commands to the motor driver. But the main thing is that, I want to operate this motor driver using an external MCU, so I have removed all the on-board resistors (R3, 4, 6, 7, 9, 11, 12, 14, 15, 16, 17) which connects the motor driver with the on-board TI MCU. Now,, I have connected my own MCU device and connected the following pins to the header (3.3V, VREF=2.0V, nSCS, VSD=3.3V, SDO=MISO, SDI=MOSI, SCK, DRVOFF and nSLEEP and GND).

My MCU is acting as a SPI master device and providing the commands to the motor driver to drive the stepper motor.

The steps which are followed to do the SPI operation with driver:
1. DRVOFF is high. 500ms delay. nSLEEP is high. 500ms delay. nSLEEP is low. 500ms delay. nSLEEP is high. 500ms delay. DRVOFF is low. 500ms delay.
2. To rotate the motor a single step (18 degree, in this stepper motor case). I am sending 0x0A and 0xFA (for CTRL3 register) (sending 1-byte at a time as SPI buffer is of 8 bit for this MCU).

Now the problem is that, the motor is not rotating and the motor is getting heated a lot within 5s. The current consumption reaches up to 500mA. But there is no movement in the motor. I just want to move the motor a single step (18 degree) so a single SPI command for CTRL3 reg and setting the bit 6 for SPI_STEP will cause the motor to move a single step.

But anyhow, the motor is not able to rotate.

During the receiving of the SPI signals from motor driver. I am getting 0xC000, every time. On-board FAULT led is never lit high, which indicates that there is no fault the SDO value show that 0xC0 has fault and SPI error.

For the sake of SPI signals reference, I am attaching the SPI signals that are transmitted from MCU to motor driver.



nSCS pin is not the picture, but before nSCS pin is low when SCLK goes high and SCLK pin is low when nSCS goes high.

Please help me out to solve the issue.

Thanks,
Vivek Karna  

  • Hi,

    Thank you for your question. Our expert will feedback to you in a day or two.

    regards

    Shinya Morita

  • Hi Vivek,

    Thanks for posting in this forum. You mentioned "On-board FAULT led is never lit high". Please see the below snippet from the schematic. Was 3.3V_MCU available at the time of your testing? This supply will be present only when the USB is connected. Otherwise the nFAULT LED will not light even if there is a fault condition. Also for this open drain pin a pullup is required which on the EVM is R18 shown in the snippet.

    Next you mentioned "I have connected my own MCU device and connected the following pins to the header (3.3V, VREF=2.0V, nSCS, VSD=3.3V, SDO=MISO, SDI=MOSI, SCK, DRVOFF and nSLEEP and GND).". This is a valid setup. VREF = 2V, Assuming the TRQ_DAC in the CTRL1 register is the default value then the output IFS (full-scale current) is set to 2/2.2 = 0.909A. When the device is awake and DRVOFF enabled both windings will be energized with 71% of the IFS, see Table 7-3 current values row for 45 degrees. This will be 645mA on both A and B phases. Leaving the stepper energized with this current will definitely heat up the stepper windings. The motor will have a holding torque during this state and the rotor will be rigid.

    You said,

    "The steps which are followed to do the SPI operation with driver:
    1. DRVOFF is high. 500ms delay. nSLEEP is high. 500ms delay. nSLEEP is low. 500ms delay. nSLEEP is high. 500ms delay. DRVOFF is low. 500ms delay.".

    Why do you have to do this sequence. When nSLEEP is LOW the device will be in sleep state. DRVOFF will not have any effect on the outputs when nSLEEP is low. The first step should be waking up the device. For this nSLEEP must be made high and wait for tWAKE time (approz 1ms - see datasheet spec). Only after wake up SPI communication to the device is possible else the device will not respond. To enable the outputs now you can drive DRVOFF to logic LOW. At this point with the default register values the motor will have both windings energized like I mentioned previously.

    "2. To rotate the motor a single step (18 degree, in this stepper motor case). I am sending 0x0A and 0xFA (for CTRL3 register) (sending 1-byte at a time as SPI buffer is of 8 bit for this MCU).".

    You can send one byte at a time but the nSCS pin must not go HIGH until both bytes have been transmitted. See page-40 of the datasheet. 

    0x0A and 0xFA is not the correct sequence. Looks like you are using 1/256 uSteps which means your stepper motor will not move by 1-step it will move by 1/256 step/ To move by single step use full-step mode. CTRL3 address is 0x05. Use the following sequence to move the motor by one full-step:

    1. Wake up the device by nSLEEP = HIGH. Wait for 1ms. Now the device is ready for SPI communication.

    2. Enable output by setting DRVOFF = LOW. 

    3. nSCS = LOW from its default HIGH value. Send two bytes 0x05(CTRL3) and 0x30 to set the initial STEP and DIR SPI inputs to LOW. nSCS = HIGH to complete the register setting.

    4. nSCS = LOW from its default HIGH value. Then send two bytes 0x05(CTRL3) and 0x70 to set the STEP SPI input HIGH and DIR SPI input to LOW. nSCS = HIGH to complete the register setting.

    3. Then send sequence #3 again.

    Now the motor should have moved by one full step, 18 degrees for your motor. Now you can disable output by setting DRVOFF = HIGH. Else the motor will get hot if left energized for extended period of time.

    Regards, Murugavel

  • Hello Murugavel,

    Thanks for this much info.

    This has actually somewhat of my issues with the driver communication over SPI interface.

    But there are slight changes in the data bytes that we are sending to the motor driver to rotate the motor.

    Since, the CTRL3 register address is 0x05, so shouldn't we sent 0x0A in the address down below.


    as, A0=1, A1=0, A2=1, so the A1 byte comes out be 0x0A not 0x05, as B8 is 0.

    But anyhow, I have used 0x0A and 0x30 and again 0x0A and 0x70 to sent to the motor driver to driver the motor.

    But, for fine tuning of the motor, I want to drive the drive the motor in the micro-stepping mode. For that, I changes the values for CTRL3 register to 0x3A for sending SPI=0 low pulse and 0x7A for SPI=1 pulse. So after sending the 256 time, these data bytes (0x0A, 0x3A and 0x0A, 0x7A), the motor did rotate smooth to 18 degree, which is 1 step of the motor, but after that, motor is not rotating. Seems like motor is stalled.

    Can you please help to configure this motor driver to use in micro-stepping mode?

    Can you please help to get any reference manual get I can get any application note to do the calculations for motor speed, torque and etc, for the micro-stepping mode.

    Thanks,
    Vivek Karna

  • Hi Vivek,

    I see. You wrote the final assembled values in your email. So 0x05 address write will be 0x0A (rotate left one position) for the first byte with W0 = 0.. You are correct. The SPI transmission sequence should be 0x0A, 0x30 and 0x0A, 0x70.

    "But, for fine tuning of the motor, I want to drive the drive the motor in the micro-stepping mode. For that, I changes the values for CTRL3 register to 0x3A for sending SPI=0 low pulse and 0x7A for SPI=1 pulse. So after sending the 256 time, these data bytes (0x0A, 0x3A and 0x0A, 0x7A), the motor did rotate smooth to 18 degree, which is 1 step of the motor". This is the correct method for running with 256 uSteps.

    "but after that, motor is not rotating. Seems like motor is stalled.". This should not happen. Can you verify output is enabled by setting DRVOFF = LOW. If you provide continuous STEP pulses the motor will keep rotating as long as DRVOFF = LOW, also the DIS_OUT must be zero and device awake.  

    "Can you please help to get any reference manual get I can get any application note to do the calculations for motor speed, torque and etc, for the micro-stepping mode.". Motor speed vs torque depends on the type of motor and usually provided by the stepper motor manufacturer. One full-step input (number of microsteps x STEP input for microsteps) will move the motor by one step. Usually the stepper specification is angle/step. In this example 18 degrees per step. So for one revolution 360/18 =  20 full-steps or equivalent microsteps pulses will be required at the STEP input. Assuming you are running in 256 uSteps and you'd want to run one revolution per second, the STEP input frequency should 256 x 20 pulses per second or 5120 pulses per second = 5.12 kHz. I hope this helps you calculate desired input STEP frequency for the target speed required.

    Regards, Murugavel