Skip to main content
Visitor II
June 11, 2018
Solved

Wrong answer to LSM6DS3 Who-Am-I register

  • June 11, 2018
  • 1 reply
  • 1441 views
Posted on June 11, 2018 at 14:40

I have a weird problem with LSM6DS3.

Right after power on I try to read the Who Am I register, via SPI. The return value is 0xFF, if I read it again it will send the correct value 0x69.

In other words, in order to get the correct response for 

Who Am I, I must read the register twice, why is that?

#lsm6ds3
    This topic has been closed for replies.
    Best answer by Clonimus74
    Posted on June 11, 2018 at 17:02

    Well, your comment made me think of something, thanks :)

    I found the problem, during startup the CS line is low and so the IC probably gets into some unknown state, as you said.

    If I set the CS line before reading the register it is all fine (the read function sets the CS line at the end and so the second time was successful)

    The reason the CS line was low is that I saw large current consumption (about 10mA), when the system loads while I set the CS line, but that is another problem.

    1 reply

    Graduate II
    June 11, 2018
    Posted on June 11, 2018 at 14:44

    Would suggest the CS doesn't transition in a way the chip recognizes in the first transaction.

    Visitor II
    June 11, 2018
    Posted on June 11, 2018 at 14:53

    CS line functions fine, I use the same exact function twice (first it fails [receives 0xFF] and then succeed)

    Graduate II
    June 11, 2018
    Posted on June 11, 2018 at 15:32

    Yeah, I took that from your initial question, but the device has an internal state machine and the states of the pins after reset (power cycle, it has no async reset pin), and transitions on them, will impact the initial state and perhaps the register it thinks are being requested. Or it just starts in some indeterminate state.