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: Steps for circuit development

Part Number: DRV10987

Hi team,

What should the overall steps be for the DRV10987 to develop software in its own circuit environment without the use of an EVM and GUI?

Step 1: It still need to determine the motor related parameters: Some of the parameters are taken from the manual and the other one needs to be measured in real terms?

Step 2: write the values for the registers 0x90–0x96 EEPROM according to the parameters

Step 3: map the shadow registers

Step 4: Fourth, set 0x30 to set the speed

Step 5: read 0x01 speed feedback

Step 6: the motor spins 

Is it possible to drive the motor by following the above steps? Could you help check this case? Thanks.

Best Regards,

Cherry

  • Hi Cherry,

    I will get back to you tomorrow.

    Regards,

    Vishnu

  • Hi Cherry,

    I didn't quite capture your question. Are you looking to tune the motor with DRV10987 without the EVM and GUI support? 

    Regards,

    Vishnu

  • Hi Vishnu,

    Thanks for your support.

    Are you looking to tune the motor with DRV10987 without the EVM and GUI support? 

    Yes, the DRV10987 is used to tune the motor without EVM and GUI support, then drive the motor smoothly, and it's able to control the speed via IIC. 

    Thanks and regards,

    Cherry

  • I will get back tomorrow. 

  • Hi Vishnu,

    Giving some updates:

    uint16_t reg_data[16] = {0x8000,0x8000,0x0000,0xC0DE,\  
                                0xC04B,0x0049,0x00C0,0x3788,0x3BAF,0x7840,0x007A,0x1006,\  
                                0x1002,0x0000,0xFF}; 
    uint16_t close_reg_data[16] = {0x8000,0x8000,0x0000,0xC0DE,\  
                                0xD04B,0x00BB,0x00C0,0x3788,0x3B0F,0x7840,0x007A,0x1006,\  
                                0x1002,0x0000,0xFF}; 	
    int reg30_data = 0x8000,default_speed = 0x812C,speed = 0,stop_speed = 0,speed_read = 0;
    
    /*Open-loop control parameters*/
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x60,&reg_data[0],2);//Disable motor drive 
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x31,&reg_data[2],2);
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x31,&reg_data[3],2);
                    BSP.bldc.method->read(&BSP.bldc.attribute,0x32,&read_data[2],2);
    
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x90,&reg_data[4],2);   //0x004B
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x91,&reg_data[5],2);   //0x49
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x92,&reg_data[6],2);   
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x93,&reg_data[7],2);
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x94,&reg_data[8],2);
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x95,&reg_data[9],2);
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x96,&reg_data[10],2);
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x35,&reg_data[11],2);
                    BSP.bldc.method->read(&BSP.bldc.attribute,0x32,&read_data[2],2);
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x60,&reg_data[13],2); //Enable the motor 
    
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x30,&reg30_data,2); //The override bit is set to 1 to enable i2c control mode 
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x30,&default_speed,2); //Write default speed 
                    BSP.bldc.method->read(&BSP.bldc.attribute,0x30,&speed_read,2);  //read speed
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x60,&reg_data[13],2); //Enable the motor 
    
    /*Closed loop control */
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x60,&close_reg_data[0],2);//Disable motor drive 
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x31,&close_reg_data[2],2);
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x31,&close_reg_data[3],2);
                    BSP.bldc.method->read(&BSP.bldc.attribute,0x32,&close_reg_data[2],2);
    
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x90,&close_reg_data[4],2);   //0x004B
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x91,&close_reg_data[5],2);   //0x49
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x92,&close_reg_data[6],2);   
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x93,&close_reg_data[7],2);
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x94,&close_reg_data[8],2);
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x95,&close_reg_data[9],2);
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x96,&close_reg_data[10],2);
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x35,&close_reg_data[11],2);
                    BSP.bldc.method->read(&BSP.bldc.attribute,0x32,&close_reg_data[2],2);
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x60,&close_reg_data[13],2); //Enable the motor
    
    /*Lock detection */
                    BSP.bldc.method->read(&BSP.bldc.attribute,0x00,&read_data[7],2);
                    if(read_data[7] != 0x4){
                        BSP.bldc.method->write(&BSP.bldc.attribute,0x00,&reg_data[14],2);//Clear error register 
                        BSP.bldc.method->read(&BSP.bldc.attribute,0x00,&read_data[7],2);
                    }
                    sscanf(optarg,"%x",&speed);
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x30,&reg30_data,2); //The override bit is set to 1 to enable i2c control mode 
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x30,&default_speed,2); //Write default speed 
                    BSP.bldc.method->read(&BSP.bldc.attribute,0x30,&speed_read,2);  //read speed
                    BSP.bldc.method->write(&BSP.bldc.attribute,0x60,&reg_data[13],2); //Enable the motor

    Thanks and regards,

    Cherry

  • Cherry,

    Can you comment each line of code?

    Regards,

    Vishnu

  • Hi Vishnu,

    Can you comment each line of code?

    Please see here:

    BSP.bldc.method->init(&BSP.bldc.attribute); //initialization
    os_msleep(10);
    
    /*open loop control parameters */
    BSP.bldc.method->write(&BSP.bldc.attribute,0x60,&reg_data[0],2);//Disable motor drive 
    BSP.bldc.method->write(&BSP.bldc.attribute,0x31,&reg_data[2],2);//Write 0x0000 to 0x31 
    BSP.bldc.method->write(&BSP.bldc.attribute,0x31,&reg_data[3],2);//Write 0xC0DE to 0x31 
    BSP.bldc.method->read(&BSP.bldc.attribute,0x32,&read_data[2],2);//Read 0x32 for ereadstatus = 1 
    
    BSP.bldc.method->write(&BSP.bldc.attribute,0x90,&reg_data[4],2); //0x90 Write 0xC04B 
    BSP.bldc.method->write(&BSP.bldc.attribute,0x91,&reg_data[5],2); //0x91 write 0x0049
    BSP.bldc.method->write(&BSP.bldc.attribute,0x92,&reg_data[6],2); //0x92 write 0x00C0
    BSP.bldc.method->write(&BSP.bldc.attribute,0x93,&reg_data[7],2); //0x93 write 0x3788
    BSP.bldc.method->write(&BSP.bldc.attribute,0x94,&reg_data[8],2); //0x94 write 0x3BAF
    BSP.bldc.method->write(&BSP.bldc.attribute,0x95,&reg_data[9],2); //0x95 write 0x7840
    BSP.bldc.method->write(&BSP.bldc.attribute,0x96,&reg_data[10],2); //0x96 write 0x007A
    BSP.bldc.method->write(&BSP.bldc.attribute,0x35,&reg_data[11],2); //0x35 write 0x1006
    BSP.bldc.method->read(&BSP.bldc.attribute,0x32,&read_data[2],2); //read 0x32
    BSP.bldc.method->write(&BSP.bldc.attribute,0x60,&reg_data[13],2); //enable motor,0x60 write 0x0000
    
    BSP.bldc.method->write(&BSP.bldc.attribute,0x30,&reg30_data,2); //The override bit is set to 1 to enable i2c control mode 
    BSP.bldc.method->write(&BSP.bldc.attribute,0x30,&default_speed,2); //Write default speed 
    BSP.bldc.method->read(&BSP.bldc.attribute,0x30,&speed_read,2); //read speed
    BSP.bldc.method->write(&BSP.bldc.attribute,0x60,&reg_data[13],2); //enable motor
    
    /*锁检测*/
    // BSP.bldc.method->read(&BSP.bldc.attribute,0x00,&read_data[7],2);
    // while(read_data[7] != 0x4 || read_data[7] != 0x0){
    // BSP.bldc.method->write(&BSP.bldc.attribute,0x00,&reg_data[14],2);//Clear error register 
    // BSP.bldc.method->read(&BSP.bldc.attribute,0x00,&read_data[7],2);
    // }
    BSP.bldc.method->read(&BSP.bldc.attribute,0x00,&read_data[7],2);
    while(read_data[7] == 0x1 || read_data[7] == 0x2 || read_data[7] == 0x4 || read_data[7] == 0x5){
    BSP.bldc.method->write(&BSP.bldc.attribute,0x00,&reg_data[14],2);//Clear error register 
    BSP.bldc.method->read(&BSP.bldc.attribute,0x00,&read_data[7],2);
    }
    
    
    /*闭环控制*/
    BSP.bldc.method->write(&BSP.bldc.attribute,0x60,&close_reg_data[0],2);//disable motor drive
    BSP.bldc.method->write(&BSP.bldc.attribute,0x31,&close_reg_data[2],2);//Write 0x0000 to 0x31 
    BSP.bldc.method->write(&BSP.bldc.attribute,0x31,&close_reg_data[3],2);//Write 0xC0DE to 0x31 
    BSP.bldc.method->read(&BSP.bldc.attribute,0x32,&close_reg_data[2],2);//Read 0x32 for ereadstatus = 1 
    
    BSP.bldc.method->write(&BSP.bldc.attribute,0x90,&close_reg_data[4],2);//0x90 write 0xD04B
    BSP.bldc.method->write(&BSP.bldc.attribute,0x91,&close_reg_data[5],2);//0x91 write 0x00BB
    BSP.bldc.method->write(&BSP.bldc.attribute,0x92,&close_reg_data[6],2);//0x92 write 0x00C0
    BSP.bldc.method->write(&BSP.bldc.attribute,0x93,&close_reg_data[7],2);//0x93 write 0x3788
    BSP.bldc.method->write(&BSP.bldc.attribute,0x94,&close_reg_data[8],2);//0x94 write 0x3B0F
    BSP.bldc.method->write(&BSP.bldc.attribute,0x95,&close_reg_data[9],2);//0x9 write 0x7840
    BSP.bldc.method->write(&BSP.bldc.attribute,0x96,&close_reg_data[10],2);//0x96 write 0x007A
    BSP.bldc.method->write(&BSP.bldc.attribute,0x35,&close_reg_data[11],2);//0x35 write 0x1006
    BSP.bldc.method->read(&BSP.bldc.attribute,0x32,&close_reg_data[2],2);//read 0x32
    BSP.bldc.method->write(&BSP.bldc.attribute,0x60,&close_reg_data[13],2); //enable motor
    
    sscanf(optarg,"%x",&speed);
    BSP.bldc.method->write(&BSP.bldc.attribute,0x30,&reg30_data,2); //The override bit is set to 1 to enable i2c control mode 
    BSP.bldc.method->write(&BSP.bldc.attribute,0x30,&default_speed,2); //Write default speed 
    BSP.bldc.method->read(&BSP.bldc.attribute,0x30,&speed_read,2); //Read speed 
    BSP.bldc.method->write(&BSP.bldc.attribute,0x60,&reg_data[13],2); //enable motor

    Thanks and regards,

    Cherry

  • Hi Cherry,

    I will get back to you tomorrow.

    BR

  • Hi Cherry,

    The procedure that you shared to write to EEPROM and spin the motor looks good. Before running this code, ensure the supply voltage is between 6.2V and 28V. 

    Regards,

    Vishnu

  • Hi Vishnu,

    The motor still doesn't work, and it does not turn in closed loop.

    Thanks and regards,

    Cherry

  • Cherry,

    Mentioning that the "motor doesn't work" does not help us debug the problem. Does the motor spin in open loop? Does the device trigger any fault? Can you read back the fault status register?

    Regards,

    Vishnu 

  • Hi Vishnu ,

    Does the motor spin in open loop? Does the device trigger any fault? Can you read back the fault status register?

    Yes, the motor is able to spin in open loop and the 0x01 register reads a value that can be determined to trigger a fault such as lock. 

    Also, why are the addresses 0x94, 0x95 in the EEPROM register not identical to the parameter register value written? The remaining 5 EEPROM registers read the same values as written. 

    Thanks and regards,

    Cherry

  • Hi Cherry, 

    Vishnu is OOO, returning next week - please anticipate a delayed response and we'll get back to you as soon as our device expert is back in office. 

    Best Regards, 
    Andrew 

  • Cherry,

    0x01 register reads back speed. 0x00 register reads back the fault. I believe you do a mass EEPROM write. In this case, values that you programmed to all the user-configurable registers (0x90 to 0x96) should be saved to EEPROM. Please make sure you follow all the instructions as described in section 8.3.6 in the datasheet. 

    Regards,

    Vishnu