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.

DRV8711: DRV8711 Stepper Drive Reg Read Issue

Part Number: DRV8711
Other Parts Discussed in Thread: TM4C1294NCPDT

Hi,

I'm currently having problems reading from my DRV8711 stepper driver ic. The write sequence seem to work fine since my application. I'm now trying to read the registers from the driver, i am not able to read the data from DRV8711 Register at 1st attempt. every time i able to read data at 5th attempt only.

/***************************SPI_Initialize****************************/

void SPI_Initialize (void)

{


// The SSI0 peripheral must be enabled for use.

SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI2);

SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);

GPIOPinConfigure(GPIO_PD3_SSI2CLK);

//GPIOPinConfigure(GPIO_PD2_SSI2FSS);

GPIOPinConfigure(GPIO_PD1_SSI2XDAT0);

GPIOPinConfigure(GPIO_PD0_SSI2XDAT1);

GPIOPinTypeSSI(GPIO_PORTD_BASE,GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_3);

SSIConfigSetExpClk(SSI2_BASE, g_ui32SysClkFreq, SSI_FRF_MOTO_MODE_0,SSI_MODE_MASTER,1000000,8);

SSIEnable(SSI2_BASE);

}


/***************************SPI_DRV8711_Write_Sequnece****************************/

void SPI_DRV8711_Write(unsigned char dataHi, unsigned char dataLo)

{

unsigned int data;

g_Write_Data01[0] = dataHi;

g_Write_Data01[1] = dataLo;
SPI_Motor_CS_High;

SSIDataPut(SSI2_BASE, dataHi);

while(SSIBusy(SSI2_BASE));

SSIDataPut(SSI2_BASE, dataLo);

while(SSIBusy(SSI2_BASE));

SPI_Motor_CS_Low;


/***************************SPI_DRV8711_Read_Sequnece****************************/

unsigned int SPI_DRV8711_Read(unsigned char dataHi, unsigned char dataLo)


{

SPI_Motor_CS_High;

SSIDataPut(SSI2_BASE, dataHi);

while(SSIBusy(SSI2_BASE));

SSIDataGet(SSI2_BASE, &RxdataHi);

SSIDataPut(SSI2_BASE, dataLo);

while(SSIBusy(SSI2_BASE));

SSIDataGet(SSI2_BASE, &RxdataLo);

g_Read_Data01[0] = 0x80 ^ RxdataLo;
g_Read_Data01[1] = RxdataHi;

SPI_Motor_CS_Low;

}


/***************************Motor_PowerUp_Reset_Sequnece****************************/

void Motor_Powerup_Reset_Sequnece(void)

{

SleepMode_Input_Low;

Reset_Input_High;

SysCtlDelay(10000000);

SysCtlDelay(10000000);

SysCtlDelay(10000000);

SysCtlDelay(10000000);

Reset_Input_Low;

SleepMode_Input_High;

SysCtlDelay(10000000);

SysCtlDelay(10000000);

SleepMode_Input_Low;
}


/***************************Motor_Current_Write_Sequnece****************************/

void Motor_Current_WriteSequenece(void)

{


unsigned char dataHi = 0x00;

unsigned char dataLo = 0x00;


/
dataHi = RegWrite | (Motor_Torque_Register.Address << 4) | (Motor_Torque_Register.SIMPLTH);

dataLo = Motor_Torque_Register.TORQUE;
SPI_DRV8711_Write(dataHi,dataLo);

}


}


/***************************Main Program****************************/

volatile uint8_t Write=0;

volatile uint8_t Read_90=0;

volatile uint8_t Current=0X32;

void main(void)

{


SPI_Initialize();

Motor_Powerup_Reset_Sequnece();


while(1)

{


if(Write==1)

{
 
Motor_Torque_Register.TORQUE = Current;
 
Motor_Current_WriteSequenece();
 
Write = 0;

}

if(Read_90==1)

{

SPI_DRV8711_Read(0x90,0x00);

Read_90 = 0;

}


}

Master MCU - TM4C1294NCPDT

Slave 1 to 4  - DRV8711

  • Hi Suresh,

    Register at 1st attempt. every time i able to read data at 5th attempt only.

    Can you elaborate more on this statement. Do you mean you send 4 spi read commands and nothing is sent back to the controller. But after the 5th read command you read the value?

    Regards,

    Pablo Armet

  • Hi Pablo Armet,

    Thankyou for your support, here with mentioned the DRV8711 Torque Register Write and Read Sequence Values for reference.

    Motor Torque Register Write & Read - Torque -255
    Torque Reg Write Data 0x11 0xFF
    Torque Reg Read Data -1st Attempt 0x05 0x81
    Torque Reg Read Data -2st Attempt 0x05 0x81
    Torque Reg Read Data -3st Attempt 0x05 0x81
    Torque Reg Read Data -4st Attempt 0x05 0xFF
    Torque Reg Read Data -5st Attempt 0xFF 0x81
    Motor Torque Register Write & Read - Torque -005
    Torque Reg Write Data 0x11 0x05
    Torque Reg Read Data -1st Attempt 0xFF 0x81
    Torque Reg Read Data -2st Attempt 0xFF 0x81
    Torque Reg Read Data -3st Attempt 0xFF 0x81
    Torque Reg Read Data -4st Attempt 0xFF 0xFF
    Torque Reg Read Data -5st Attempt 0x05 0x81

    Whenever i am changing the Motor Torque from 255 to 5 means, After the write sequence itself i can able to feel the motor hodling torque update. But during the read sequence upto 3rd attempt of existing torque value will be received from DRV8711. Last Write Torque value will be received on 5th attempt only.    

    Thanks & Regrads,

    Suresh

  • Suresh,

    Let me take a look at the register values and investigate if there is anything wrong with the sequence. I will get back to you within one business day.

    Regards,

    Pablo Armet

  • Hi Suresh,

    Apologies for late reply. 

    Each device has it's own dedicated chip select (CS) signal. Is the correct CS signal is used to read to the desired driver?

    Regards,

    Pablo Armet