Please, expose the programming sequence examples of AD5143 device.
The datasheet is not clear in digital part description. I mean I2C write read protocols/sequences.
Especially how the reading back occurs.
You can extend the last clock, as far as I remember the part decodes the command before last 9th clock (ACK).
Say that, you can try to readback the RDAC register first (which is relatively fast) and you can generate Repeat start condition without any delay.
Please refer to the I2C Serial Data Interface Section of the AD5143 data sheet for the step-by-step operation of the 2-wire serial bus protocol.
If you wouldn't mind, may I ask which part confuses you so that I can provide better aid in your issue?
Even you know the I2C protocol the sequence of command/bytes is not clear in the doc.
Just correct me if I'm wrong. I'm using short command set from Table15.
For write sequence first byte is the device address the next is command and address nibbles then data byte.
Now I want to read back something. Omitting the ACK bits the sequence is: device address with operation bit set to "0", command=0011 (read), DAC address and data, let's say 0x01 (read from memory). So, I've sent 0101011_0__0001_0000__0000_0001. Then I generate a start condition again and send the device address with the operation code "1" (read). Device must reply with the memory content. Is it correct?
0101011_0__0001_0000__0000_0001, START, 0101011_1__memory STOP
Thank you for pointing out the unclear protocol sequence. I'll contact the person (responsible for the data sheet) to be able to clarify your thoughts. In the meantime, try this out first as this might be helpful. Also, be careful for the acknowledge bits as they can be source of errors.
Just to clarify, the part uses standard I2C EEPROM readback sequence (except that teh part does nor implement clock stretching so be aware of timing).
Send command/address pointer about the location you want to readback,
1 byte- Start + Address + W + /ACK/
2 byte- Command 3 + Address bit + /ACK/
3 byte - Data (EEPROM or RDAC) + /ACK/ + STOP
Readback the data, (remeber that the EEPROM takes 30us to be internally read... so wait)
4 byte - Start + Address + R + /ACK/
5 byte - DATA + /NACK/ + STOP
I supposed the same way (first write command then read) except of STOP and so huge wait time for EEPROM.
I'll fix my state machine.
Hope the RDAC readback is immediate, no wait time...
I think the STOP condition between the write (01010110_00110000_00000001) and read (01010111_memory) may be replaced with just repeating START but with ~10us pause before repeat-START. I mean the memory read operation at the moment of receiving read reaches the 20us point for 400kHz interface. So, while it receives the read instruction the memory data must be ready.
Is this correct?
O! Sorry, musach.
Do you mean it is not allowed to extend the last write clock after the last ACK to regenerate the START condition?
Do we need to interrupt the write by STOP and issue START then read command?
Please, confirm this.
Thanks, Miguel !
Now it is more clear.
Retrieving data ...