Forums - I2C with Accelerometer on CSR8670

2 posts / 0 new
Last post
I2C with Accelerometer on CSR8670
RSus
Join Date: 22 Nov 16
Posts: 2
Posted: Tue, 2016-11-22 08:49

I'm sorry if this is the wrong forum, but I could not find one designated specifically for the CSR8670.

I am attempting to connect an IMU sensor (the MPU6050 on a GY-521 breakout board) to the CSR8670 on a BC127 discovery board. Using the PSTool application in the ADK4.0.1 package, I set the PSKEYs I2C_SCL_PIO to 0x0007 and I2C_SDA_PIO to 0x0006. With an oscilloscope, I can see activity on both lines at three different voltage levels (0, ~1.8, and 3.3V). When I attempt to write or read from the device registers, it fails. Here are some excerpts from the code:

 

Code:
#include <message.h> 
#include <stdlib.h> 
#include <i2c.h> 
#include <panic.h> 

#define I2C_DEVICE_ADDRESS     0x68 //presumably, this is supposed to be the i2c address on the MPU6050 
#define I2C_A_DEVICE_REGISTER  0x6B //this is the power management register, used to wake the device from sleep

int main(void){
    uint8 data = 0;
    uint8 i2c_data[2];
    i2c_data[0] = I2C_A_DEVICE_REGISTER;
    i2c_data[1] = data;
    PanicZero(I2cTransfer(I2C_DEVICE_ADDRESS, i2c_data, 2, NULL, 0)); //this is where the error occurs - I2cTransfer returns 0, which means that 0 bytes were successfully transferred
}

 


The exact error message printed to the console is "VM has panicked! Reason: Pointer is NULL (Context: 0x0)."

What am I doing wrong with regard to setup? Other than setting the PS Keys, are there any prerequisites for using the PIO pins for I2C?

Thanks!

  • Up0
  • Down0
balu902
Join Date: 31 Jan 17
Posts: 2
Posted: Tue, 2017-01-31 01:24
 
*/ */

Can you try this

PanicZero(I2cTransfer(I2C_DEVICE_ADDRESS<<1, i2c_data, 2, NULL, 0))

 

 

 

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.