Part Number:DRV10987
Hello Ti team,
I am using DRV10987 for my smart car application.And now I can spun my motor successfully.But i find a serious problem is that DRV10987 can't work after writing EEPROM(Writing SPEED command into EEPROM after Motor configration). And few second ago motor with spun up...(Power on and Motor didn't spun)
I measured Kt value of motor is about to 10mv/hz(average) , Rph is 3.5R , No IPD , ISD enabled , No break .I set registers as following code , could you please help me find where the problem is?
void DRV_init(void)
{
i2c_init(i2c0,100*1000);
i2c_init(i2c1,100*1000);
systick_delay_ms(1); //Wait for set up 1ms
do
{
i2c_write_reg(i2c0,DRV10987_Address,EECRTL,0x80,0x00); //Setting EEPROM Access permission and DISABLE!!!!!!!! the motor
i2c_write_reg(i2c0,DRV10987_Address,EEPROM1,0x00,0x00); //clearer EEPROM Access code
i2c_write_reg(i2c0,DRV10987_Address,EEPROM1,0xC0,0xDE); //Setting EEPROM Access code
gpio_init(G0,GPO,0);
//
// systick_delay_ms(1); //Wait for set up 1ms
}while(i2c_read_reg(i2c0,DRV10987_Address,EEPROM2) != 0x0001); //Setting EEPROM able to read
gpio_init(G0,GPO,1);
i2c_write_reg(i2c0,DRV10987_Address,CONFIG1,0
| NO_SpectrumControl_MASK
| FG_both_open_and_close
| FG_Only_Close
| FG_POLES(16),
0
| CLK_ADJ_SELECT(0) //0:FULL 1:HALF
| 0x5B ); //Setting to 3.5R
i2c_write_reg(i2c0,DRV10987_Address,CONFIG2,0
| 0x0F, //Page 24
0
| CommAdvMode(1)
| 0x02 ); //Page 37
i2c_write_reg(i2c0,DRV10987_Address,CONFIG3,0
| ISDThr_160ms
| BrkCurThrSel(0)
| BEMF_HYS(0)
| ISDEn(1)
| RvsDrEn(0)
| RvsDrThr_6P3,
0
| OplCurr_0p4
| OplCurrRt_6
| BrkDoneThr_0 );
i2c_write_reg(i2c0,DRV10987_Address,CONFIG4,0
| AccRangeSec(0)
| StAccel2(0)
| StAccel(0),
0
| Op2ClsThr(1,6)
| AlignTime(6) );
i2c_write_reg(i2c0,DRV10987_Address,CONFIG5,0
| OTWarmingLimit(0)
| CloseLoopStuckLock(0)
| OpenLoopStuckLook(0)
| NoMotorLock(0)
| AbnormalKtLock(0)
| AbnormalSpeedLook(0),
0
| SWiLimitThr(0)
| HWiLinitThr(0)
| IPDasHWlLimit(0) );
i2c_write_reg(i2c0,DRV10987_Address,CONFIG6,0
| SpdCtrlMd(1)
| PWMFreq(1)
| KtLckThr(0)
| AVSIndEn(0)
| AVSMMd(0)
| IPDRIsMd(0),
0
| CLoopDis(0)
| CIsLpAccel(3)
| DutyCycleLimit(3)
| SlewRate(3) );
i2c_write_reg(i2c0,DRV10987_Address,CONFIG7,0
| IPDAdvcAg(0)
| IPDCurrThr(5)
| IPDClk(4),
0
| CtrlCoef(4)
| Deadtime(10) );
i2c_write_reg(i2c0,DRV10987_Address,EEPROM5,0x00,0x06);
while(i2c_read_reg(i2c0,DRV10987_Address,EEPROM2) != 0x0001);
i2c_write_reg(i2c0,DRV10987_Address,EEPROM5,0x00,0x02);
while(i2c_read_reg(i2c0,DRV10987_Address,EEPROM2) != 0x0001);
i2c_write_reg(i2c0,DRV10987_Address,EECRTL,0x00,0x00);
/***********************************************************************************************************************************************/
do
{
i2c_write_reg(i2c1,DRV10987_Address,EECRTL,0x80,0x00); //Setting EEPROM Access permission and DISABLE!!!!!!!! the motor
i2c_write_reg(i2c1,DRV10987_Address,EEPROM1,0x00,0x00); //clearer EEPROM Access code
i2c_write_reg(i2c1,DRV10987_Address,EEPROM1,0xC0,0xDE); //Setting EEPROM Access code
gpio_init(G0,GPO,0);
//
// systick_delay_ms(1); //Wait for set up 1ms
}while(i2c_read_reg(i2c1,DRV10987_Address,EEPROM2) != 0x0001); //Setting EEPROM able to read
gpio_init(G0,GPO,1);
i2c_write_reg(i2c1,DRV10987_Address,CONFIG1,0
| NO_SpectrumControl_MASK
| FG_both_open_and_close
| FG_Only_Close
| FG_POLES(2),
0
| CLK_ADJ_SELECT(0) //0:FULL 1:HALF
| 0x5B ); //Setting to 3.5R
i2c_write_reg(i2c1,DRV10987_Address,CONFIG2,0
| 0x0F, //Page 24
0
| CommAdvMode(1)
| 0x02 ); //Page 37
i2c_write_reg(i2c1,DRV10987_Address,CONFIG3,0
| ISDThr_320ms
| BrkCurThrSel(0)
| BEMF_HYS(0)
| ISDEn(1)
| RvsDrEn(1)
| RvsDrThr_6P3,
0
| OplCurr_0p8
| OplCurrRt_6
| BrkDoneThr_0 );
i2c_write_reg(i2c1,DRV10987_Address,CONFIG4,0
| AccRangeSec(0)
| StAccel2(0)
| StAccel(0),
0
| Op2ClsThr(1,6)
| AlignTime(6) );
i2c_write_reg(i2c1,DRV10987_Address,CONFIG5,0
| OTWarmingLimit(0)
| CloseLoopStuckLock(0)
| OpenLoopStuckLook(0)
| NoMotorLock(0)
| AbnormalKtLock(0)
| AbnormalSpeedLook(0),
0
| SWiLimitThr(0)
| HWiLinitThr(0)
| IPDasHWlLimit(0) );
i2c_write_reg(i2c1,DRV10987_Address,CONFIG6,0
| SpdCtrlMd(1)
| PWMFreq(1)
| KtLckThr(0)
| AVSIndEn(0)
| AVSMMd(0)
| IPDRIsMd(0),
0
| CLoopDis(0)
| CIsLpAccel(3)
| DutyCycleLimit(3)
| SlewRate(3) );
i2c_write_reg(i2c1,DRV10987_Address,CONFIG7,0
| IPDAdvcAg(0)
| IPDCurrThr(5)
| IPDClk(4),
0
| CtrlCoef(4)
| Deadtime(10) );
i2c_write_reg(i2c1,DRV10987_Address,EEPROM5,0x00,0x06);
while(i2c_read_reg(i2c1,DRV10987_Address,EEPROM2) != 0x0001);
i2c_write_reg(i2c1,DRV10987_Address,EEPROM5,0x00,0x02);
while(i2c_read_reg(i2c1,DRV10987_Address,EEPROM2) != 0x0001);
i2c_write_reg(i2c1,DRV10987_Address,EECRTL,0x00,0x00);
systick_delay_ms(50); //Wait for set up
}
void DRV_set_speed(uint8 DRR, uint16 speed)
{
uint8 MSB,LSB;
MSB = (uint8) ( ( (speed >> 8) & 0x0001 ) | 0x80);
LSB = (uint8) ( speed & 0x00ff );
if(DRR==0) i2c_write_reg(i2c0,DRV10987_Address,SpeedCrtl,MSB,LSB);
else if(DRR==1) i2c_write_reg(i2c1,DRV10987_Address,SpeedCrtl,MSB,LSB);
}