BMM150_HelloWorld Christian Dupaty 03/2021 Library and demo for BMM150 see datasheet here : https://www.bosch-sensortec.com/products/motion-sensors/magnetometers-bmm150/ Adaptation of BOSCH driver https://github.com/BoschSensortec/BMM150-Sensor-API for ARM MBED and tested on NUCLEO-L073RZ and GEOMAGNETIC CLICK https://www.mikroe.com/geomagnetic-click
Dependencies: mbed bmm150GeoMagnetic
BMM150_HelloWorld
Christian Dupaty 03/2021
Library and demo for BMM150 see datasheet here : https://www.bosch-sensortec.com/products/motion-sensors/magnetometers-bmm150/
Adaptation of BOSCH driver https://github.com/BoschSensortec/BMM150-Sensor-API for ARM MBED and tested on NUCLEO-L073RZ and GEOMAGNETIC CLICK https://www.mikroe.com/geomagnetic-click
The BMM150 sensor supports I2C and SPI serial communications. The choice of protocol is made on the PS pin (see datasheet page 32), the default mode is SPI. Unfortunately, MIKROE did not place a configuration micro-switch on the GeoMagnetic-click module, but straps that are difficult to move. By default, the module is configured in SPI mode (all the straps are on the left as in the photo). To place the module in I2C mode, all the straps must be moved to the right.
However, it is possible to implement I2C communications without moving all the straps:
- Move only the strap at the bottom on the photo to the right. - On the left connector we have now :
- CS is connected to CSB-BMM150
- SCK is connected to SCL-I2C-BMM150
- MISO is linked to SDO-BMM150
- MOSI is connected to SDA-I2C-BMM150
BMM150 DataSheet page 36, CSB and SDO are used to define the I2C address. In the program, this address is chosen in BMM150_defs.h line 37 (here address 0x13, therefore CSB = 1 and SDO = 1) define BMM150_I2C_Address (0x13 << 1)
SCL and SDA lines must be connected to 3.3v by pullup resistor (4.4K to 10K) to comply with the I2C standard
Supply with the NUCLEO card in 3.3v and GND
The heading is given periocally by UART over USB in an ASCII terminal (ex TeraTerm)
Video here ... https://photos.app.goo.gl/zqKQNfw5694xbMZCA
Revision 8:a268ea639af1, committed 2021-05-20
- Comitter:
- cdupaty
- Date:
- Thu May 20 07:36:32 2021 +0000
- Parent:
- 7:82dd77013b34
- Commit message:
- OK with library updated
Changed in this revision
bmm150.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 82dd77013b34 -r a268ea639af1 bmm150.lib --- a/bmm150.lib Thu May 20 07:33:10 2021 +0000 +++ b/bmm150.lib Thu May 20 07:36:32 2021 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/cdupaty/code/bmm150demo/#9651fd7ee8f6 +https://os.mbed.com/users/cdupaty/code/bmm150GeoMagnetic/#9651fd7ee8f6
diff -r 82dd77013b34 -r a268ea639af1 main.cpp --- a/main.cpp Thu May 20 07:33:10 2021 +0000 +++ b/main.cpp Thu May 20 07:36:32 2021 +0000 @@ -7,6 +7,7 @@ */ #include "mbed.h" + // libraries #include "bmm150.h" #include "bmm150_defs.h"