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:
#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!
Can you try this
PanicZero(I2cTransfer(I2C_DEVICE_ADDRESS<<1, i2c_data, 2, NULL, 0))