Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Arduino I2C to ZSSC3123

Status
Not open for further replies.

nanana_1011

Member level 2
Joined
Nov 9, 2014
Messages
50
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,636
Hello!

I want to retrieve the value of C_Config.

My code:

Wire.begin();
Wire.beginTransmission(0x50);
Wire.write(0xA0); // Enter the command mode
Wire.endTransmission();
Wire.requestFrom(0x06, 3); // Retrieve the value of C_Config
byte a = Wire.read();
byte b = Wire.read();
byte c = Wire.read();

But what I get is 255, not the default value.
What is the problem?

https://datasheet.octopart.com/ZSSC3123AA2-T-ZMDI-datasheet-10989346.pdf
 

I think you need to call beginTransmission (send i2c start and device address) again before requesting for the bytes.
 

ernpao is right.

Code:
Wire.endTransmission();
will Stop I2C Comm. So, you have to issue Start I2C again before reading the bytes.
 

Now I add 1 more.
Wire.beginTransmission(0x50);

But all are 255. I see that the IC will send something called slave ACK which is 1 bit.
Do I wait for that ACK before sending requestFrom?

Is my address of the device wrong?
I see that it is set 0101000 as default.
Then is it 0x50?
 
Last edited:

I think the first bit (bit 0) of the address byte is read/write bit. So it you are writing to device then bit 0 of address byte will be 0 and the other address field has to be shifted 1 bit to left to form the address byte.
 

I find that Arduino only needs first high 7 bits. I think it does not need to write last bit.
But I still do not know how to enter command mode and retrieve the value of register.

- - - Updated - - -

Anyone help?
 

Just read about using wire.requestFrom, apparently you have to use the address device as the argument which as you stated is 0x50. I am assuming the 3 registers starting from 0x06 are the registers you want to read? With the arduino wire library i dont think you can read starting from that address and you have to start from 0x00. So maybe use

Code:
byte buffer[10];// just use a large buffer
int ii = 0;
wire.requestFrom(0x50, 10);//request 10 bytes from device
for(ii =0; ii <10; ii++){
buffer[ii] = wire.read();
}
//register 0x06 is in buffer[0x06] and so on
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top