Part Number: LAUNCHXL-CC1352R1
Tool/software: Code Composer Studio
this is what i have to do for excuting command like suspend,etc ,,.
For every write to the Command register, the following sequence is required:
1. Write 0x00 to Command register to clear the Response register.
2. Read Response register and verify contents are 0x00.
3. Write Command value from Table 5 into Command register.
4. Read the Response register and verify contents are now non-zero. If contents are still 0x00, repeat this step.
The Response register will be incremented upon the successful completion of a Command. If the Response
register remains 0x00 for over 25 ms after the Command write, the entire Command process should be repeated
from Step 1.
and this is my code (sensor is si1132,and i excute ALS_AUTO command)
I2C_init();
I2C_Handle i2cHandle;
I2C_Params i2cParams;
I2C_Params_init(&i2cParams);
i2cParams.transferMode = I2C_MODE_BLOCKING;
i2cParams.bitRate = I2C_100kHz;
i2cHandle = I2C_open(Board_I2C0, &i2cParams);
if (i2cHandle == NULL) {
while (1);
}
uint8_t rxBuffer[2];
uint8_t txBuffer[2];
/*read chipID*/
txBuffer[0]=0x00;
I2C_Transaction i2cTransaction;
i2cTransaction.slaveAddress = Si1132_ADDR;
i2cTransaction.writeBuf =txBuffer;
i2cTransaction.writeCount =NULL;
i2cTransaction.readBuf = rxBuffer;
i2cTransaction.readCount = 1;
bool status = I2C_transfer(i2cHandle, &i2cTransaction); --->read successful
if (status == false) {
while (1);
}
/*write 0x00 to Si1132_REG_COMMAND */
txBuffer[0]= Si1132_REG_COMMAND;
txBuffer[1]=0x00;
I2C_Transaction i2cTransaction1;
i2cTransaction1.slaveAddress = Si1132_ADDR ;
i2cTransaction1.writeBuf =txBuffer;
i2cTransaction1.writeCount =1;
sleep(1);
i2cTransaction1.readBuf = rxBuffer;
i2cTransaction1.readCount = NULL;
status = I2C_transfer(i2cHandle, &i2cTransaction1);
/*read Si1132_REG_RESPONSE*/
I2C_Transaction i2cTransaction2;
txBuffer[0]= Si1132_REG_RESPONSE;
i2cTransaction2.slaveAddress = Si1132_ADDR ;
i2cTransaction2.writeBuf =txBuffer;
i2cTransaction2.writeCount =NULL;
sleep(1);
i2cTransaction2.readBuf = rxBuffer;
i2cTransaction2.readCount = 1;
status = I2C_transfer(i2cHandle, &i2cTransaction2); --> confrim rxBuffer[0]=0x00
if (status == false) {
while (1);
}
/*write Si1132_ALS_AUTO command to Si1132_REG_COMMAND */
I2C_Transaction i2cTransaction3;
txBuffer[0]= Si1132_REG_COMMAND;
txBuffer[1]=Si1132_ALS_AUTO;
//I2C_Transaction i2cTransaction;
i2cTransaction3.slaveAddress = Si1132_ADDR;
i2cTransaction3.writeBuf =txBuffer;
i2cTransaction3.writeCount =1;
sleep(1);
i2cTransaction3.readBuf = rxBuffer;
i2cTransaction3.readCount = NULL;
status = I2C_transfer(i2cHandle, &i2cTransaction3);
sleep(1);
/*read*/
I2C_Transaction i2cTransaction4;
txBuffer[0]= Si1132_REG_RESPONSE;
i2cTransaction4.slaveAddress = Si1132_ADDR ;
i2cTransaction4.writeBuf =txBuffer;
i2cTransaction4.writeCount =NULL;
sleep(1);
i2cTransaction4.readBuf = rxBuffer;
i2cTransaction4.readCount = 1;
status = I2C_transfer(i2cHandle, &i2cTransaction4);
--->Response register will be incremented upon the successful completion of a Command.
but its still 0x00
i dont know what's the problem.
i also saw oscilloscope but its zero