I2C communication code -
//PCF85063A_ADDRESS = 0x51
i2c_eeprom_init(PCF85063A_ADDRESS, I2C_STANDARD, I2C_7BIT_ADDR, I2C_1BYTE_ADDR); //initialize the i2c, in I2C address size place the address size of your device
SEND_I2C_COMMAND(0x08 & 0xFF); // the address size that device has is two bytes length, if your device takes one byte length you can use this instruction to read from 0x03 address or whatever address you need.
WAIT_WHILE_I2C_FIFO_IS_FULL(); // Wait if Tx FIFO is full
SEND_I2C_COMMAND(0x0100); // Set read access for
WAIT_UNTIL_I2C_FIFO_IS_EMPTY(); // Wait until I2C Tx FIFO empty
WAIT_UNTIL_NO_MASTER_ACTIVITY();
read_byte = 0xFF & GetWord16(I2C_DATA_CMD_REG);
I do not get a required waveform on initiating the transfer of first command -
SEND_I2C_COMMAND(0x08 & 0xFF);
The signal SDA - transmits slave device address and then does not transmits the slave device's register on the SDA line.
Can I know the possible mistake ?
Also, there has been several post on the I2C interface to sensor not responding.
我累了使用i2c_eeprom API和链接solution -https://support.dialog-semiconductor.com/i2c-driver-lisxdx-sensor
The code seems to end wihout appropriate response.
Request for help ASAP.
Thanks,
Raju
HONEYWELL
Hello Dialog,
I have been experimenting with the signal on SDA and SCL lines.
On observation, the SDA line is high during the ACK clock pulse. And the master (DA14586) invokes a stop command.
Thanks.
May I know on what is wrong in code mentioned in the first post.
Thanks
RAJU
HONEYWELL
Hi rajucoolsuraj,
I would highly recommend to have a look at the I2C EEPROM example of the SDk6. The project is in the SDK directory\projects\target_apps\peripheral_examples\i2c\i2c_eeprom. PIf your sensor's register uses two bytes for addressing the data within the register, you should use 2-bytes addressing (I2C_2BYTES_ADDR). The SEND_I2C_COMMAND(0x08 & 0xFF); will send only one byte, but if I am able to understand correctly form the comments the address size that device has is two bytes length. The SEND_I2C_COMMAND will push the desired data into the I2C bus, since what you need in order to start the I2C communication is the address of the internal register the SEND_I2C_COMMAND((address>>8)&0xFF) will just push the 8 first most significant bit of the 16bit address and then the second SEND_I2C_COMMAND(address & 0xFF); will push the rest 8 bits of the address.
Thanks, PM_Dialog
Hello Dialog,
I am using the code from SDK - 6.0.10
The slave device address (for my RTC) is 1010001 - hence the Master -> Slave initial condition starts with
start - 1010001W - Slave device register(00h - 11h) - Ack
if writing to slave register - I pass Data_Byte after Ack;
if reading from slave - Restart the I2C - 1010001R - receive data_byte - Ack
I had also experimented with another sensor with same I2C interface - The device acknowledged on the ACk clock pulse.
Since RTC does not need to have a clock running to read / write to its registers over I2C; I would like to have assistance in interpreting the address that makes it right for the I2C_TAR_REG to pass it to I2C bus transactions.
0x51(1010001) or 0xA2(1010001W) - W = write bit - 0
Thanks
Raju