Hi Experts,
I'm using the LaunchPad CC2642R/CC2652R with the I2C protocol and ATECC608A accelerometer. I have a issue with the status:
Could you please give me a recommendation to solve it?
Question: START and STOP Conditions are changed in I2C (Library)? I was trying to comply with the command: GPIO_setConfig(CONFIG_GPIO_I2C_SDA, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
My code:
/* Create I2C for usage */
I2C_Params_init(&i2cParams);
i2cParams.bitRate = I2C_100kHz;
i2c = I2C_open(CONFIG_I2C, &i2cParams);
if (i2c == NULL) {
//Display_print0(display, 0, 0, "Error Initializing I2C\n");
while (1);
}
else {
//Display_print0(display, 0, 0, "I2C Initialized!\n");
}
/*Awake*/
txBuffer[0] = 0x00;
txBuffer[1] = 0x00;
txBuffer[2] = 0x00;
txBuffer[3] = 0x00;
txBuffer[4] = 0x00;
i2cTransaction.slaveAddress = 0x60;
i2cTransaction.writeBuf = txBuffer;
i2cTransaction.writeCount = 5;
i2cTransaction.readBuf = NULL;
i2cTransaction.readCount = 0;
GPIO_setConfig(CONFIG_GPIO_I2C_SDA, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
if (I2C_transfer(i2c, &i2cTransaction))
{
GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
}else
{
}
GPIO_setConfig(CONFIG_GPIO_I2C_SDA, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_HIGH);
/*Test -> To into the low power sleep mode*/
txBuffer[0]=0x60;
txBuffer[1]=0x01; //Command //Sleep
txBuffer[2]=0x60;
txBuffer[3]=0x00;
i2cTransaction.writeBuf = txBuffer;
i2cTransaction.writeCount = 5;
i2cTransaction.readBuf = rxBuffer;
i2cTransaction.readCount = 5;
GPIO_setConfig(CONFIG_GPIO_I2C_SDA, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW);
if(I2C_transfer(i2c, &i2cTransaction))
{
GPIO_write(CONFIG_GPIO_LED_0, CONFIG_GPIO_LED_ON);
}else{
}
GPIO_setConfig(CONFIG_GPIO_I2C_SDA, GPIO_CFG_OUT_STD | GPIO_CFG_OUT_HIGH);
I2C_close(i2c);
Thank you in advance.
Best regards,
Tania