Tool/software: Code Composer Studio
Hello,
i have problem with my i2c SCL that start on high logic i can see it on oscilloscope.
I2C_transfer(); return always FALSE some times i get TRUE and i have true parameters back.
im always open and close I2C,
//////////////////////////////////////////////////////////////////////////
it's my init to I2C:
I2C_Params i2cParams;
I2C_init();
I2C_Params_init(&i2cParams);
i2cParams.bitRate = I2C_400kHz;
i2cParams.transferMode = I2C_MODE_BLOCKING;
i2cHandle = I2C_open(CC1310_LAUNCHXL_I2C0, &i2cParams);
if (i2cHandle == NULL)
{
while(1);
}
return TRUE;
/* open i2c always open.*/
///////////////////////////////////////////////////////////////////////////
it how it run :
bool PeripheralsShtw2MeasureAndReadTemperatureAndHumidity(float* tempAndHmdt)
{
/*tempAndHmdt[0] is the temperature value and tempAndHmdt[1] is the humidity value */
uint8_t numOfRetries = 0;
bool transactionStatus;
/*uint32_t startTime = Clock_getTicks();
TimersSystemCheckTimeout (startTime, 0x493e0);*/
if (i2cHandle == NULL)
{
//PIN_setOutputValue(handleLedPins, CC1310_LAUNCHXL_PIN_GLED, led_ON);
PeripheralsControlVoltage(etPeripheralsVoltageEnable);
PeripheralsI2cBusInit();
}
do
{
transactionStatus = I2C_transfer(i2cHandle, &i2cShtwStruct);
if (transactionStatus)
{
/* Extract temperature value and CRC check */
if (PeripheralsCalcCrc8(shtwRxBuffer,SHTW_TMP_DATA_BYTES_SIZE) == shtwRxBuffer[2]) /* Check if the CRC value given by SHTW2 is equal to the CRC calculated based on received data*/
{
tempAndHmdt[0] = PeripheralsShtw2CalcTemperature(shtwRxBuffer);
}
else
{
transactionStatus = FALSE;
testResult = 0;
}
if (PeripheralsCalcCrc8((shtwRxBuffer + 3),SHTW_HMDT_DATA_BYTES_SIZE) == shtwRxBuffer[5])
{
tempAndHmdt[1] = PeripheralsShtw2CalcHumidty((shtwRxBuffer + 3));
}
else
{
transactionStatus = FALSE;
testResult = 0;
}
}
if(transactionStatus == FALSE)
{
numOfRetries++;
usleep(SHTW2_MEASURMENT_US_DURATION);
}
}
while( (numOfRetries < NUM_OF_I2C_RETRIES) && (transactionStatus == FALSE) );
if(transactionStatus == FALSE)
{
PIN_setOutputValue(handleLedPins, CC1310_LAUNCHXL_PIN_RLED, led_ON);
PIN_setOutputValue(handleLedPins, CC1310_LAUNCHXL_PIN_GLED, led_OFF);
while(1);
}
/*TimersSystemCheckTimeout (startTime, 0x493e0);*/
if (i2cHandle != NULL)
{
I2C_close(i2cHandle);
PeripheralsControlVoltage(etPeripheralsVoltageDisable);
i2cHandle = NULL;
}
return transactionStatus;
}
//////////////////////////////////////////////////////////////////////////////////////////////
maybe someone has an idea or there is a possibility to control the clock .
thanku for replay..