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.

DRV10987: speed feedback

Part Number: DRV10987

hi, 

i attached the function here:

int Get_SPD_Feedback()
{
unsigned int Temp;
Temp = DRV10987Q_Read(DRV10987Q_MotorPeriod_Reg) ;
if (Temp == 0) Temp = 40000;
Temp = 10922667/(long)Temp;//2^14*1000*1000/M_CloseMax_Spd
return Temp;
}

1. i didnt understand why temp gets 40000  if temp ==0  ?

2. i saw that you got to this number 10922667 while M_CloseMax_Spd=1500

why  multiply 2^14*1000*1000 what is the meaning of each number?

what is the 2^14 represent?

thanks, liraz

  • Liraz,

    The resolution of the timer used to measure the period is 1 usec (that is where the 1000*1000 comes from).

    The register that holds the count is 14 bits (that is where the 2^14 comes from).

    Thanks,
    Brian
  • 1. you said that The register that holds the count is 14 bits. which register is it? register of the drv? or mcu?

    i didnt find this register. 

    and if the counter is 14 bit why you multiply in 2^14 ? this is not the maimum size of the counter.

    2. in the main i need to implement the flow from the data sheet that i attached? cause you implement a different flow (attached also)

    thank you,

    liraz

    thank you,

    liraz

  • Liraz,

    The code says that it is reading Motor_Period_Reg fromDRV10987 and placing it in register Temp.

    Looking at the comment 2^14 (14 bits) * 1000 * 1000 / 1500 = 10 922 667. Which is the constant that is used as the longest time that the counter can count. It then divides this value by the measured count to get a number between 1 and 1500.

    The flow chart you captured from the datasheet is the process that device does as it starts the motor. You don't have to do any of this control the device does it for you.

    You simply need to provide the input PWM (or I2C) command for the speed you want to run. If that command is generated from a PI loop using the code above to get the measured period then the software will try to maintain a constant speed.

    Thanks,
    Brian
  • great, thank you.
    liraz.