2018-06-11 05:40 AM
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?
#lsm6ds3Solved! Go to Solution.
2018-06-11 10:02 AM
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.
2018-06-11 05:44 AM
Would suggest the CS doesn't transition in a way the chip recognizes in the first transaction.
2018-06-11 07:53 AM
CS line functions fine, I use the same exact function twice (first it fails [receives 0xFF] and then succeed)
2018-06-11 08:32 AM
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.
2018-06-11 10:02 AM
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.
2018-06-11 11:16 AM
Might want a weak pull-up on the pin
2018-06-12 02:58 AM
I don't think an output port can have a pull-up, it doesn't make any sense.