Forums - i2c Interface with accelerometer

3 posts / 0 new
Last post
i2c Interface with accelerometer
Join Date: 8 Jun 16
Posts: 43
Posted: Sun, 2016-06-19 06:58

Hi all,

I am trying to interface a BMA255 acceleromter with the CSR1010. I have the i2c communication setup properly and I can send command to write and read the registers of the BMA255 via I2C.

I am using the i2c_comms.c and i2c_comms.h files as provided in the software examples. The sequence of i2c communication is as follows:

/* Acquire I2C bus */



      /* Initialise I2C communication. */


     success = I2CWriteRegister(BMA250_I2C_ADDRESS, REG_BANDWIDTH,0x0F);   // this works!





All the commands to configure the accelerometer works well except that I am unable to set the accelerometer to low power mode 1 by writing a value of 0x56 to register location 0x11.


     success = I2CWriteRegister(BMA250_I2C_ADDRESS, 0x11,0x65);   // this does not work


In the data sheet of the BMA255, there is a note on i2c access restrictions:

An interface idle time of at least 2us is required following a write operation when the device operates in normal mode (or standby mode, or low-power mode 2). In suspend mode (or low-power mode 1) an interface idle time of least 450us is required.


I am pretty sure its due to this 450us restriction. But I have no idea where to set the 450us idle time.


This is inside the I2CWriteRegister function:


 success = ( (I2cRawStart(TRUE) == sys_status_success) &&

(I2cRawWriteByte(base_address) == sys_status_success) &&

(I2cRawWaitAck(TRUE) == sys_status_success) &&

(I2cRawWriteByte(reg) == sys_status_success) &&

(I2cRawWaitAck(TRUE) == sys_status_success) &&

(I2cRawWriteByte(register_value) == sys_status_success) &&

(I2cRawWaitAck(TRUE) == sys_status_success) &&

(I2cRawStop(TRUE) == sys_status_success));


I2cRawComplete(1 * MILLISECOND);




Do I have to have a 450us delay between each I2CRaw command? If so, how do I implement this?


  • Up0
  • Down0
Dr. Nissim Zur
Profile picture
Join Date: 6 Jun 16
Location: Skype: nissim.test CSR1010 External design house
Posts: 235
Posted: Sun, 2016-06-19 09:19

See Bosch Sensortec MEMS accelerometer sensor driver source code

  • Up0
  • Down0
Join Date: 8 Jun 16
Posts: 43
Posted: Sun, 2016-06-19 20:32

Hi all,

I found the problem finally. Its actually not a software problem and has nothing to do with the 450us delay.

I had configured the i2c with strong pull up

    /* Configure the I2C controller */






I had connected external i2c pull up resistors to my circuit. When i2c is released, the PIO is set to strong pull down. I think this cause current to flow through the external i2c pull up resistors hence consuming current.


Everything works fine now after I removed the external pull up resistors.


Hope it helps someone with the same problem in the future.

  • 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.