Can anyone tell me where I can find an example of an I2C driver for ADT7411 ?
As I mentioned earlier, the address pointer register is an internal register that stores the address of the register you want to read or write. It needs ot be specified for all read write operations.
A write operation begins with a start condition folowed by the device I2C address and the write bit, then the address pointer byte and ends with the data you want to write to the register followed by a stop condition.
To read from a register, you need to tell the part first which regsiter you want to read. To do this you need to perform a write operation(this is the write operation that the datasheet reffers to) but you don't provide any data to be written to the device. Instead, after the register address pointer byte(including the master ACK), you need to transmit a restart condition followed by the I2C address of the device(again) plus the read bit. After this byte, the ADT7411 will respond with the content of the register that needs to be acknowledged by the master and followed by a stop condition.
I am not sure I understand what are you trying to do. Are you looking for code examples?
Yes, I am looking for code examples. I'm trying write I2C driver to read VDD values, Internal/External temperature values, AIN3 - 8 values from ADT7411.
One more thing in case it helps. I'm using ADSP-21489 and a ADT7411. Is there an example available?
I am not familiar with the ADSP-21489, so I recommend posting a question about the implementation of I2C protocol on the "Processors and DSP" community.
Thanks for your previous post about how to get the communication working. It was very helpful.
I looked at the section and figures that you suggested and have a question:
On page 30, it talks about Writing to the ADT7411. In particular the section "Writing to the Address Pointer Register for a Subsequent Read " .
Is the Address Pointer Register referenced in the document the *pTWIMADDR or TWIMADDR ? Or is it referring to something else ?
I am not sure I understand your question. What are the *pTWIMADDR and TWIMADDR?Can you please explain?
TWIMADDR is the master mode address (TWI/I2C). When transmitting data via TWI/I2C the first step is to program the TWIMADDR register (based on ADSP-214xx SHARC Processor Hardware Reference). This defines the address transmitted during the address phase of the transfer.
I'm trying to figure what is meant by the "Address Pointer Register" referenced in the ADT7411 manual. For clarification: Is page 30, section "Writing to the Address Pointer Register for a Subsequent Read ", saying that I should set the device address (address to ADT7411) and then set address of register I want to read from by writing to TWIMADDR (writing twice, one for device address and two for reg address) ? If I'm off track here, could you explain "Address Pointer Register" and where is that defined ?
The "Address Pointer Register" is an internal register that stores the address of the register you wan to red from or write to. On page 20 of the data sheet, table 7 lists all ADT7411 registers and their address listed on the first column. For example, if you want to read the device ID resister, table 7 states the address of 4Dh. This means that the "Address Pointer Register" value that you need to use in your I2C transactions when you want to read the content of this register is 4Dh.
I hope this helps.
Thanks for your response. Yes, I'm was already aware of page 20, table 7 and the addresses to all ADT7411. I'm trying to map the wording in page 30, section "Writing to the Address Pointer Register for a Subsequent Read ", to I2C registers.
In the following statement "To read data from a particular register, the address pointer register must contain the address of that register." What you mentioned is the address of the register I want to read from (which is fine). What is confusing is "address pointer register" as it sounds to be another register I need to set with the actual register address I want to read from. Also, the following statement "The write operation consists of the serial bus address followed by the address pointer byte." Two different writes. Can't write both addresses at the same time since there it is not possible to do a block write on the ADT7411. Is this assumption correct?
Thanks for your all input!
Thanks for your help FEB.
There aren't any code examples available, but I'll try to explain what you need to do to get the communication working.
In order to communicate with the device using the I2C interface, you need to make sure that the ADT7411 has the I2C enabled. To avoid switching to the SPI interface you need to tie the /CS pin to either VDD or GND as stated in the data sheet.
A read operation from any register consists of two stages: a write command followed by a read command. Figures 34 and 36 from the data sheet(page 31) show the two stages. for correct operation, you need to merge the two figures and use a re-start condition instead of the stop after the write stage followed by the start of the read stage.
To get the data from the registers you want, you need to repeat this two stage read command for every register.
Retrieving data ...