Part Number: DRV10983-Q1
Other Parts Discussed in Thread: DRV10983Q1EVM
I have a similar problem. All data is fine, but writing does not change the registers.
In the branch that I ran, the decision was not publicly published.
I do not have the equipment for testing and testing. I'm working with a self-made PCB:
I get access to the parameters using Arduino.
Code:
#include <Arduino.h>
#include <Wire.h>
#define I2C_DRV10983_Q1_ADR 0x52
#define Fault_Reg 0x00 //
#define MotorSpeed_Reg 0x01 //
#define DeviceIDRevisionID_Reg 0x08
#define EEPROM_Access_Code_Reg 0x31
#define EEPROM_EeReady_Reg 0x32
#define EEPROM_Iindividual_Access_Adr_Reg 0x33
#define EEPROM_Individual_Access_Write_Data_Reg 0x34
#define EEPROM_Access_Reg 0x35
#define EECTRL_Reg 0x60
void setup() {
Serial.begin(9600);
Wire.begin();
}
byte readByAdress(byte reg_adr, unsigned int &result) { //I2C write 2-byte register
byte i = 0, err = 0;
byte bytes[2] = {0, 0};
Wire.beginTransmission(I2C_DRV10983_Q1_ADR);
Wire.write(reg_adr);
err = Wire.endTransmission();
if(err!=0)
return err;
Wire.requestFrom(I2C_DRV10983_Q1_ADR, 2);
while(Wire.available())
{
bytes[i] = Wire.read();
i++;
}
result = ((bytes[0] << 8) | bytes[1]);
return 0;
}
byte writeByAdress(byte reg_adr, unsigned int value) { //I2C read 2-byte register
byte bytes[2];
bytes[1] = value >> 0;
bytes[0] = value >> 8;
Wire.beginTransmission(I2C_DRV10983_Q1_ADR);
Wire.write(reg_adr);
Wire.write(bytes,2);
return Wire.endTransmission();
}
boolean flag = true;
void loop() {
if(flag){
int count = 0;
unsigned int value = 0;
unsigned int onReady = 0;
delay(3000);
writeByAdress(EECTRL_Reg, 0x8000); //Stop motor
writeByAdress(EEPROM_Access_Code_Reg, 0x0000); //Reset EEPROM_Access_Code_Reg
writeByAdress(EEPROM_Access_Code_Reg, 0xC0DE); //Set EEPROM_Access_Code_Reg
while(onReady == 0 && count < 1000){ // Wait EEPROM ready
readByAdress(EEPROM_EeReady_Reg, onReady);
count++;
}
Serial.println("EEPROM_Access. Cycles of expectation: " + String(count));
count = 0;
onReady = 0;
//Write values on shadow registers
writeByAdress(0x90, 0x105A); //new
writeByAdress(0x91, 0x2F2A); //new
writeByAdress(0x92, 0x0050);
writeByAdress(0x93, 0x1B8A);
writeByAdress(0x94, 0x3FAF);
writeByAdress(0x95, 0x3C43);
writeByAdress(0x96, 0x016A);
writeByAdress(EEPROM_Access_Reg, 0x0006); //EEPROM mass access enabled && update from 0x90-0x96
while(onReady == 0 && count < 1000){ // ожидание готовности EEPROM
readByAdress(EEPROM_EeReady_Reg, onReady);
count++;
}
Serial.println("EEPROM_Update. Cycles of expectation: " + String(count));
onReady = 0;
count = 0;
//Reading shadow register values for verification
writeByAdress(EEPROM_Access_Reg, 0x0002); //EEPROM mass access enabled
while(onReady == 0 && count < 1000){ // ожидание готовности EEPROM
readByAdress(EEPROM_EeReady_Reg, onReady);
count++;
}
Serial.println("EEPROM_Read. Cycles of expectation: " + String(count));
count = 0;
onReady = 0;
readByAdress(0x90, value);
Serial.println("0x90: " + String(value, HEX));
readByAdress(0x91, value);
Serial.println("0x91: " + String(value, HEX));
readByAdress(0x92, value);
Serial.println("0x92: " + String(value, HEX));
readByAdress(0x93, value);
Serial.println("0x93: " + String(value, HEX));
readByAdress(0x94, value);
Serial.println("0x94: " + String(value, HEX));
readByAdress(0x95, value);
Serial.println("0x95: " + String(value, HEX));
readByAdress(0x96, value);
Serial.println("0x96: " + String(value, HEX));
writeByAdress(EECTRL_Reg, 0x0000); //Run motor
flag = false;
}
}
Result:
EEPROM_Access. Cycles of expectation: 1
EEPROM_Update. Cycles of expectation: 180
EEPROM_Read. Cycles of expectation: 1
0x90: 1048
0x91: 2f3b
0x92: 50
0x93: 1b8a
0x94: 3faf
0x95: 3c43
0x96: 16a
As can be seen from the results, the registers retain the default values and new data are not applied.
