Skip to main content
Visitor II
August 31, 2020
Question

LIS3DH I2C ADDRESS AUTO INCREASE FOR FIFO

  • August 31, 2020
  • 1 reply
  • 1723 views

I believe there is a unclear statement about FIFO address auto inreasement and 8-bit sub address issue;

here is two explanation from the datasheet;

8bit sub address auto inrease : (page 25 6.1.1 I2C operation)

... 7 LSb represent the actual register address while the MSB enables address auto increment. If the MSb of the SUB field is ‘1’, the SUB (register address) is automatically increased to allow multiple data read/writes...

5.1.5 Retrieving data from FIFO (page 23)

...The address to be read is automatically updated by the device and it rolls back to 0x28 when register 0x2D is reached. In order to read all FIFO levels in a multiple byte read, 192 bytes (6 output registers of 32 levels) have to be read....

Can we say if we read start to read by 0x28 it will automatically rollback once it reaches to 0x2d , but i dont see any info what will happen if i will set the 8th bit of the 0X28 address ?

So what will happen and how it will behave if i will start reading 0xA8 (0x28 | 0x80) ? it will just auto increase until 0xFF or it will rollback once it will reach to 0x2d ?

Best regards.

    This topic has been closed for replies.

    1 reply

    ST Employee
    September 1, 2020

    Hi @mehmetcanbalci​ ,

    when accessing the FIFO, you should perform the read as the datasheet says, otherwise the outcome of the operation can be wrong and data can be lost in the process.

    Do you want to read all registers at once?

    Visitor II
    September 5, 2020

    Hi ,

    i want to read all the registers at once , but as i mentioned above two given information at the different pages of the datasheet makes it unclear.

    what will happen and how does it behave if i will start reading 0xA8 (0x28 | 0x80) ,because this is legal according to (page 25 6.1.1 I2C operation)?

    What is your comment about my first question , because i give two different information from the datasheet.

    i am talking about these two info ,and i need answer what will happen when i read address 0xA8 (msb=1 of 0x28 ); (i already gave the page numbers and sections regarding these two info)

    ... 7 LSb represent the actual register address while the MSB enables address auto increment. If the MSb of the SUB field is ‘1’, the SUB (register address) is automatically increased to allow multiple data read/writes...

    ...The address to be read is automatically updated by the device and it rolls back to 0x28 when register 0x2D is reached. In order to read all FIFO levels in a multiple byte read, 192 bytes (6 output registers of 32 levels) have to be read....

    ST Employee
    September 7, 2020

    Hi @mehmetcanbalci​  ,

    You are right, the datasheet does not explain that in detail.

    I think that if you read the register  OUT_X_L (28h) setting the MSB of SUB to 1 you will read all the FIFO, while setting the MSB of SUB to 0 you just read the first register.

    I don't have access to a LIS3DH right now, but I can have it delivered and I can develop a firmware to test the two situations, I think that in a few weeks I can give you a response.

    If you already have the sensor and the firmware, maybe you can try it and share your results.

    I just did not understood whether you want to

    • read all the sensor registers to check the configuration parameters (in this case you could also do a read until the register 28h and then a read from the 2Eh to complete all registers)
    • read all the FIFO (you should read 192 bytes from 28h putting the MSB of SUB to 1)