Part Number: CC2640
Other Parts Discussed in Thread: CC2650STK
Tool/software: Code Composer Studio
Hi,
I am trying to interface MCP7940N RTC chip with CC2640 via I2C.
I am using Latest BLE stack and CCS v7.
I have modified the I2C example in BLE stack for sensortag and changed the I2C pins in CC2650STK.h .
I can get a true response from I2C_open(Board_I2C, &i2cParams);
But I2C_transfer(i2c, &i2cTransaction) always fails.
Am I missing something?
I have pasted the code below.
/***************************************************************/
/* Create I2C for usage */
I2C_Params_init(&i2cParams);
i2cParams.bitRate = I2C_400kHz;
i2c = I2C_open(Board_I2C, &i2cParams);
if (i2c == NULL) {
UART_write(uart, "\n\rError Initializing I2C", sizeof("\n\rError Initializing I2C"));
}
else {
UART_write(uart, "\n\rInitialized I2C Successfully", sizeof("\n\rInitialized I2C Successfully"));
}
uint8_t txBuffer[1];
uint8_t rxBuffer[2];
txBuffer[0]=0x80;
i2cTransaction.slaveAddress = 0x6f;
i2cTransaction.writeBuf = txBuffer;
i2cTransaction.writeCount = 1;
i2cTransaction.readBuf = rxBuffer;
i2cTransaction.readCount = 1;
if (I2C_transfer(i2c, &i2cTransaction)) {
UART_write(uart,"Received data is", sizeof("Received data is"));
UART_write(uart,rxBuffer, sizeof(rxBuffer));
}
else {
UART_write(uart, "\n\rI2C Read Failed", sizeof("\n\rI2C Read Failed"));
}
/***************************************************************/
Can any one guide me?
