cancel
Showing results for 
Search instead for 
Did you mean: 

LSM9DS1 read from magnetometer problem

echelon2010
Associate II
Posted on October 24, 2016 at 22:38

Hello! I made a custom board with LSM9DS1  module on it. Pins SDO_M and SDO_A/G is tied together. I use SPI to communicate with module. When i write/read to/from accelerometer/gyroscope registers all works fine but when i am trying to read from magnetometer WHO_AM_I register or any other i get only 0xFF. I use separate CS pins for A/G and magnetometer.What may be wrong? As i understand it is not necessary to set up magnetometer registers to be able read from WHO_AM_I register. Don't understand what is the problem.

1 REPLY 1
Bill Burgess
Associate II
Posted on May 10, 2017 at 20:20

I'm using 4-wire SPI to talk with the LSM9DS1 magnetometer.  I found I needed to write a '0' to Bit 2 ('SIM') of magnetometer CTRL_REG3_M (22h) before I could read valid data from any magnetometer register, including WHO_AM_I.

The data sheet says 0 is the default, so one would presume it shouldn't be necessary to write 0 to it explicitly.  But in this case one would apparently presume wrong.  At least, the moment I started writing 0 to that bit, my 4-wire SPI setup was able to read perfectly.  Hope this helps.