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.

DRV8889-Q1: Code methods

Part Number: DRV8889-Q1

hi Team,

my customer use DRV8889-Q1, and have a question on coding.

  • do they need to shift left 9bits(SPI_ADDRESS_POS)? For example, the register address 0x07=(00000111), so they need to send (1000 1110 0000 0000)?
  • the right format is |R/W|A6|A5|A4|A3|A2|A1|A0| D7|D6|D5|D4|D3|D2|D1|D0| OR |R/W|A4|A3|A2|A1|A0|*|*| D7|D6|D5|D4|D3|D2|D1|D0|?

that is to say how about A6|A5 coding?

  • please help check the below code comments are right or not:

 /* Register format |R/W|A4|A3|A2|A1|A0|*|*| D7|D6|D5|D4|D3|D2|D1|D0|

* Ax is address bit, Dx is data bits and R/W is read write bit.

* For read R/W bit should be 1 */

uint16_t SPI_readRegister(uint8_t address)

{

。。。。。。。。

  reg_value |= SPI_RW_BIT_MASK;                                      /*Set R/W bit*/

  reg_value |= ((address << SPI_ADDRESS_POS) & SPI_ADDRESS_MASK);    /* Configure register address value*/

  。。。。。。。。

}

 

/* Register format |R/W|A4|A3|A2|A1|A0|*|*|D7|D6|D5|D4|D3|D2|D1|D0|

* Ax is address bit, Dx is data bits and R/W is read write bit.

* For write R/W bit should 0. */

uint16_t SPI_writeRegister(uint8_t address, uint16_t data)

{

。。。。

  volatile uint16_t reg_value = 0;

 

  reg_value |= ((address << SPI_ADDRESS_POS) & SPI_ADDRESS_MASK);         /* Adding register address value*/

  reg_value |= ((data << SPI_DATA_POS) & SPI_DATA_MASK);                  /*Adding data value */

。。。。

}

 thanks.

  • Kelly,

    In the datasheet, Table 12 gives the command detail.

  • Hi Wang,

    thanks for your answers.

    three more questions:

    • the control mode on the GUI includes "step" and "speed", while only "speed" mode can find stall detection function, so can "step" mode support stall detection? and how to configure in the register?
    • if we want to let the motor move fixed steps(1024 for example) then stop, how can I configure this on the register?
    • customer find when start up, the motor noise is loud, so can they use decay mode for reducing noise during start and stop?

    thanks

  • Kelly,

    1. Yes. Only GUI speed mode supports the stall detection. Torque_Count number is proportional to the motor speed. With limited steps, the motor may not run into target speed.

    2. Go to register map page and enable the stall detection and report to nFault; also set the stall detection threshold.

    3. Only ripple control decay mode supports the stall detection. But, during the startup (before the target speed is reached), customers can use other decay mode to reduce the noise if other decay mode can fix the noise issue.