1

I am completely new to this topic so please excuse my mistakes. I have this: https://www.mikroe.com/geomagnetic-click geomagnetic click with a BMM150 sensor with this datasheet: https://download.mikroe.com/documents/datasheets/BMM150.pdf.

I connected it to the raspberry pi via the SPI pins and I'm trying to read the registers which give me the x y z values. I tried using the library Spidev and xfer to communicate however never got anything to work correctly. I tried sending the bits which are specified in the datasheet to read the registers but I just got zeros. Also in the datasheet, it is stated that the CSB pin has to be pulled low to communicate how would I do that?.

Can someone maybe give an example of how to send the correct information to read the registers?

5
  • 1
    You need to show what you have done. Software and wiring.
    – joan
    Sep 18 '21 at 11:48
  • 1
    If you are not pulling CSB low then there is no point thrashing about with software. Use a GPIO pin. Connect it to CSB and set it low when communicating with your SPI device. Have you set the communication jumpers for SPI? Sep 18 '21 at 13:03
  • (1) Is CSB pin for Chip Select the SPI device? Usually you just connect the CS pin to Ground (or to play safe, use a 10k current limiting protecting resistor, just in case you connect the wrong pin).
    – tlfong01
    Sep 18 '21 at 13:48
  • (2) Usually I try to read the ID register. Section 5.3 (a) Enable power control bit (register 0x4b bit 0), (b) read 0x40 for chip id 0x32.
    – tlfong01
    Sep 18 '21 at 13:55
  • (3) It is not clear if you are using the CLI commends Spidev and xfer. I usually do (a) python SPI loopback (MISO direct read back (MOSI). (b) do read Chip ID as in Section 5.3. (4) Usually I use SPI freq 400kHz or even lower. (5) Usually I keep SPI wires shorter than 30cm.
    – tlfong01
    Sep 18 '21 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.