AnsweredAssumed Answered

ADAU1701 read problem with I2C (including pictures)

Question asked by dzingoni on May 11, 2011
Latest reply on Jun 4, 2014 by kaeroul

Hi everybody,

I'm working on a project where a board containing a 1701 is to be controlled by an "Arduino" Uno, a board with an Atmega368. The uc is interfaced through I2C to the evaluation board containing the 1701 (and at the same time also the usb interface is connected at the same bus).

I have interfaced the board with the Eval ADAU1701, including solving the problem of having the I2C bus at 3.3V on the evaluation board, and at 5V on the arduino board.

 

After a lot of tests I was able to write some data into the Parameter RAM of  the ADAU1701. The Usbi interface allows me to see that I have successfully written to address 0 my data. This is the arduino code:

 

    Wire.beginTransmission(52);
    // send register address
    Wire.send(0);      // high byte
    Wire.send(0);             // low byte
    Wire.send(0);
    Wire.send(0);
    Wire.send(0);
    Wire.send(0x2A);
    Wire.endTransmission();

 

Please note that we have to use 52 and not 104 (= 0x68) because 0x68 comprises the R/W bit. In the library for I2C that I use the address is 7 bit, and

R/W bit is added at left, while in ADAU1701 documentation they talk about 0x68 or 0x69 address for device, depending of if we write or read ... I took

a lot to realize this, but in any case now I know.

Anyway: writing to the 1701 is not a problem.

Here are the waveforms:

 

TEK0003.BMP

We see 7 bytes: the device address byte with write bit at 0, two bytes for the address, 3 bytes at 0 and 1 at 0x2A. Perfect.

 

 

Now the problem is reading.

I have tried for two days any combination, but I'm unable to get any  data from the 1701, I'm unable to re-read the data that I have written.

Here is the code (I tried almost all the possible variants, and according to the oscilloscope this is the best solution:

 

    Wire.beginTransmission(52);
    // send address of register we want to read , 0x0
    Wire.send(0x0);         // high byte
    Wire.send(0x0);         // low byte
    Wire.endTransmission();

 

    Wire.requestFrom(52, 4);  // 4 byte

 

    while(Wire.available())
    {
      HiByte1 = Wire.receive();
    }
    while(Wire.available())
    {
      LoByte1 = Wire.receive();
    }
    while(Wire.available())
    {
      HiByte = Wire.receive();
    }
    while(Wire.available())
    {
      LoByte = Wire.receive();
    }

 

Due to the I2C protocol oddities we have to write first indicating what memory location or register we want, and then (when the slave knows

what we want) we can ask a set of bytes.

 

The problem seems to be that the 1701 does not send the ACK at bit 9 when a READ is requested.

I tried to understand if I was making mistakes by seeing the sequence produced by sigmastudio when reading the same location:

Location is 0x0. Data is read correctly:

 

TEK0001.BMP

We can recognize the address of the device, 0x68 (or better, the address including the "write" bit at 0), followed by two bytes at 0 (the address of the memory location that I want to read) ... then strangely the clock is held low for some time by the usb interface, then again the device address but with the R/W bit at 1 (we read), the acnowledge by the 1701 at bit 9 and after that the bytes of data .... everything OK with USBi.

 

Now what happens with my code (writing with the microcontroller):

TEK0002.BMP

The first part is the same, OK.  No delay here, I don't really know how to maintain the clock at 0 .... I have tried also with delays but nothing.

After that ... we see the address of device repeated again, with read bit (bit 8) at 1, that's OK  .... but at bit 9 no acknowledge!

The 1701 refuses to understand the read command. So nothing happens.

 

If I compare all the images we see that: there's some delay between each byte when Sigmastudio is reading. But as writing works in my case ... this should not be an issue.

There's a large delay between the initial part of the read command, when we tell the device the address that we want, and when

the byte with read bit at 1 is sent .... moreover the clock is held low by the usb interface.

Is this neccessary? The documentation of the 1701 makes no reference to this, as well as to delays between bytes ...

 

Can anybody help me?

Thank you!

Outcomes