Hi,
I am testing MAX31334 RTC chip connected with I2C.
My code is as follow.
But, stuck in first I2C_transfer (). only 2 bytes(address and 1 byte) is sent.
I did use callback, the first I2C_transfer is returned and sent address and 1 byte also.
But, second transfer is not working.
What is the problem?
uint8_t txBuffer[7];
uint8_t rxBuffer[7];
I2C_Params_init(&i2cParams);
i2cParams.bitRate = I2C_400kHz;
i2c = I2C_open(CONFIG_I2C, &i2cParams);
if (i2c == NULL)
{
DBG ("Error Initializing I2C\n");
while (1) {}
}
/* Common I2C transaction setup */
i2cTransaction.writeBuf = txBuffer;
i2cTransaction.writeCount = 1;
i2cTransaction.readBuf = rxBuffer;
i2cTransaction.readCount = 0;
i2cTransaction.targetAddress = MAX31334_I2C_ADDR;
txBuffer[0] = 0x1; // from INT_EN
I2C_transfer(i2c, &i2cTransaction);
//Task_sleep (_TO_TICK(10));
i2cTransaction.writeBuf = txBuffer;
i2cTransaction.writeCount = 4;
i2cTransaction.readBuf = rxBuffer;
i2cTransaction.readCount = 0;
txBuffer [0] = 0x01; // INT_EN (0x1)
txBuffer [1] = 0; // RTC_RESET (0x2)
txBuffer [2] = 0b00010011; // RTC_CONFIG1 (0x3). Alarm1 auto clear after 100msec, interrupt low active, Enables I2C timeout, osc enable
txBuffer [3] = 0b00000011; // RTC_CONFIG2 (0x4). Alarm1->/INTB pin
if (I2C_transfer(i2c, &i2cTransaction))
{
}
I2C_close(i2c);
