We use DSPBIOS to build our application with. I'm having difficulty getting a Freescale MMA8451Q Accelerometer running on one of theC6748's I2C buses. Specifically, I can't get it to read any of its internal registers. No matter which register I pick, I receive nothing but 0's.The research I've done indicates that the device requires a repeated start condition. Freescale mentions this in their data sheet - they refer to it as a repeated start condition (SR). Since the driver I'm creating needs to run with and I2C bus driver that is supported by DSPBIOS, I have to follow the conventions of TI's PSP IOM. The problem is, I haven't been able to figure out how to get the PSP I2C driver to send a repeated start condition. The device-level code I've created does generate the proper sequences but it generates a Stop in between the register selection and write command and the register read command instead of the required SR.
There are a set of macros available for controlling various flags listed int the PSP I2C.h file, here are a few:
/** Default read flag */
#define I2c_DEFAULT_READ (I2c_READ | I2c_MASTER | I2c_START | I2c_STOP)
/** Default write flag */
#define I2c_DEFAULT_WRITE (I2c_WRITE | I2c_MASTER | I2c_START | I2c_STOP)
There are a couple that I though might be of use but I tried them and they didn't work:
/** Repeat mode as per TI I2C specs */
#define I2c_REPEAT 0x2000u
/** Re-Start is generated by Master */
#define I2c_RESTART 0x400u
I know that the C6748 I2C hardware supports this mode of operation because I located it in one of the datasheets for the chip. I've also seen some bae metal driver code that shows how to setup the internal registers to get repeated start condition working. I'm reluctant to go down this path because we are running DSPBIOS and I read a warning that stated one should not drill down into the hardware and change register values outside of the RTOS environment as it can cause problems.