DRV10983 i2c NIGHTMARE

Good morning guys,

So, I have a DRV10983 on a custom board, hardware follows all of the layout guidance as per the SLVSCP6H.

I can read the registers and used some code on this forum to test if the i2c comms works, and it does all that is should, and so long as the VCC > 22VDC I get the correct info from the registers also.

The issue I have is writing to the registers.... which is for me a head scratching moment.

Just so you know, I scan the i2c bus and get the 0x52 as I would expect, that is the address I am trying to write the data to, but on the sequence there is a reference to and address 0xA4 to enable writing, this has thrown me a bit, and I am sure it is something obvious.... just not to me.

I understand that this is for the Sidata, I am just not sure how to handle it in the code.

As I have direct access to headers on the i2c bus, I am purchased a usb2any as a backstop, but I feel like that is giving in!

Any help towards my sanity would be appreciated.

The motor giggles then turns maybe 1.5 rotations or reaches about 25mA then stops which I assume are the motor parameters not being set... this is at the very least something.

Graciously

Björn

Please understand the I2C addresses. Each standard device has a 7 bit address (0x52) which is transmitted left shifted by 1 (0xA4) and the lowest bit indicating read or write operation.

Using the Arduino Wire library you don't have to bother with such protocol details. Simply use address 0x52 and Wire.beginTransmission() for writing to and Wire.requestFrom() for reading from your slave. See the Wire library examples in the IDE for more details.

Hej Diettrich,

Having now done some further investigation I understand that to be the case also, for the avoidance of doubt I have over 20 years hardware and software dev under my belt, I just could not fathom what was going on, so I examined the wire-lib and now I completely understand what it is doing.

I am also very aware of the i2c protocol and 7 bit addressing, I think however it is the fact that when I write to the register and then read the register the default value is still loaded, that is what I think lead me on a wild goose chase.

I am new to Arduino, I am also new to the many libraries that includes, it is interesting.

Still, I was really looking for someone who has experience directly with the IC, and see how they got around the issues or offer an insight.

With my scope and LP I can see that what I want to send is being sent... I just think I am missing something so obvious and I have a confirmation bias..

Tack

Björn

Hi, @bjorntocreate
Welcome to the forum.

Have you Googled;

DRV10983 arduino

I see in the Google listing that there may be a library to do the work for you.

Can you please post your code and schematic so we can see how you are processing the data?

Thanks.. Tom... :smiley: :+1: :coffee: :australia: :santa:

Hej Tom,

Thanks for the response.

That is the Schematic, code is PRETTY fluid..

I will post my latest iteration to poke the fault register, with the motor on I get '0' with it off I get '8', the '8' does not scare me, the '0' is acceleration over current, I know why it is the resistance and the BEMF setting are not set.

#include

void setup()
{
Serial.begin(115200);
Wire.begin(39, 38); // SDA and SCL PINS defined inline
//-----------------
Wire.beginTransmission (0x52); //Address pre appended bit with WIRE
Wire.write (0x1E); // Register currently set to FAULT register
// Wire.write (0x4C) // Data to write
byte busStatus = Wire.endTransmission();
//--------------------
if(busStatus !=0)
{
Serial.print("I2C Bus Communication Problem...!");
while(1); //wait for ever
}
Serial.println("I2C device is found.");
//------------------------
Wire.requestFrom (0x52, 1);
byte data = Wire.read();
//---------------------
Serial.print(data, HEX); //Serial Monitor will show: 0x0C
}

void loop()
{

}

The library on GIT is for the DRV10987... which is apparently different so I am told now, I could not make it get anywhere.

busStatus return 0 and I get the value in the register, HOWEVER I think that I messed up, on the data sheet it shows address 0x20 as EEPROM and NOT REGISTER, there is a sequence I think I need to follow to write it to EEPROM and then I can read the data bit like LDI then MOV I assume.

I shall return with news sir!

DUMP from SM

READ AND THEE SHALL FIND BROTHERS!

So after being a complete idiot for a few hours, I trusted my knowledge, I did not want to be one of those Dunning-Kruger guys, so I doubted myself.

Anyway worked out the Rm and Kt, FOLLOWED the block diagram and..... it is now running.

It was actually really simple (he says smugly after many hours of tail chasing) and I think that is what made me look for a more complicated answer.

You have to write the register to the EEPROM... that is it

For example :

Wire.beginTransmission (0x52); //Address pre appended bit with WIRE Wire.write (0x21); // Kt Register Wire.write (0x48); // SET Kt Parameter

byte busStatus = Wire.endTransmission();

Wire.beginTransmission (0x52); //Address pre appended bit with WIRE
Wire.write (0x02); // Device Control Register
Wire.write (0xB6); // Program Key

Wire.endTransmission();

Wire.beginTransmission (0x52); //Address pre appended bit with WIRE
Wire.write (0x03); // EEPROM Control Register
Wire.write (0x50); // eeWrite BIT

Wire.endTransmission();

The code above is just test code, I will create a function that will pull this together for all parameters.... but ut VORKS!

Thank you so much guys for responding to this Nordic mad man, I really appreciate you taking the time to do so.

For the future, if anyone is crazy enough to use one of these driver ic, then hit me up if you run into issues, I will make a library/driver at some point and post it to my GIT then link it on here.

Again, I thank the community!

Björn

Hi,
Glad to see you have found the solution. :+1: :+1:

Tom... :smiley: :+1: :coffee: :australia: :santa: :santa:

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.