Part Number:LAUNCHXL-CC2650
Tool/software:TI-RTOS
Hello everyone,
I'm having a very similar issue like in this post (https://e2e.ti.com/support/embedded/tirtos/f/355/t/538836) except that I'm using CC2650 connects with ADXL345 via I2C interface. My first read/write transaction always fails and I have to send a dummy transaction as a work-around. After my first transaction, my other transactions that write/read to registers works properly. Unfortunately, that post is pretty old, so I don't know if the OP finds out the solution for this or not. Does anyone experience with the same issue or know what cause this?
I ran a couple tests to make sure that my CC2650 and ADXL345 can communicate properly, including a 'read' transaction to get the device id, and it returns the value of 0xE5 (correct as stated in the data sheet).
At this moment, I'm trying to find the solution as I mentioned above and also implement a function to read raw input data of 3 axis x, y ,z and converts it to g,
void ADXL345_GetGxyz(float* x,
float* y,
float* z)
{
System_printf("\t%s IS CALLED\n", __FUNCTION__); System_flush();
unsigned short xData = 0; // X-axis's output data.
unsigned short yData = 0; // Y-axis's output data.
unsigned short zData = 0; // Z-axis's output data.
ADXL345_GetXyz(&xData, &yData, &zData);
*x = (float)(fullResolutionSet ? (xData * ADXL345_SCALE_FACTOR) :
(xData * ADXL345_SCALE_FACTOR * (selectedRange >> 1)));
*y = (float)(fullResolutionSet ? (yData * ADXL345_SCALE_FACTOR) :
(yData * ADXL345_SCALE_FACTOR * (selectedRange >> 1)));
*z = (float)(fullResolutionSet ? (zData * ADXL345_SCALE_FACTOR) :
(zData * ADXL345_SCALE_FACTOR * (selectedRange >> 1)));
}
void ADXL345_GetXyz(unsigned short* x,
unsigned short* y,
unsigned short* z)
{
System_printf("\t%s IS CALLED\n", __FUNCTION__); System_flush();
*x = ADXL345_GetRegisterValue(ADXL345_DATAX1) << 8;
*x += ADXL345_GetRegisterValue(ADXL345_DATAX0);
*y = ADXL345_GetRegisterValue(ADXL345_DATAY1) << 8;
*y += ADXL345_GetRegisterValue(ADXL345_DATAY0);
*z = ADXL345_GetRegisterValue(ADXL345_DATAZ1) << 8;
*z += ADXL345_GetRegisterValue(ADXL345_DATAZ0);
}
But calling ADXL_GetGxyz only give me the same value of X Y Z: c083 9d8b 1759 although I tried to move the accelerometer with different positions? What did I possibly do wrong?
Any help would be greatly appreciated. Thanks,
Henry