cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong answer to LSM6DS3 Who-Am-I register

Clonimus74
Senior II
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
1 ACCEPTED SOLUTION

Accepted Solutions
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.

View solution in original post

6 REPLIES 6
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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
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)

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
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.

Posted on June 11, 2018 at 18:16

Might want a weak pull-up on the pin

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 12, 2018 at 09:58

I don't think an output port can have a pull-up, it doesn't make any sense.