Cannot initialize IMU on Xiao Sense nRF52840

Hello,
Note that I’ve cross-posted this on the Seeed forums, but I’m not sure which place is best.

I’m programming a Seeed Xiao Sense using GitHub - maxgerhardt/platform-nordicnrf52: Nordic nRF52: development platform for PlatformIO

I cannot get the IMU to work and I am wondering if this has to do with the PIO support or something else…

#include <Arduino_LSM6DS3.h>
...
IMU.begin(); // Returns 0
IMU.readAcceleration(..); // Returns bogus values

I checked that I’m testing on a Xiao Sense and not Xiao BLE classic.
Note that I’m using I2C for other peripherals (EEPROM for instance) but IMU.begin() returns 0 even if it’s initialized before them.
I’ve read somewhere that IMU uses an internal I2C bus different from the one that is exposed on the Xiao to avoid conflicts, but I couldn’t find where this is set.

This is my ini:


[env]
monitor_speed = 115200
upload_speed = 115200
build_flags = 
	-Wno-psabi
	-std=c++1z
	-std=gnu++1z
	-O2

framework = arduino
lib_deps = 
	adafruit/Adafruit MCP23017 Arduino Library@2.3.0
	robtillaart/I2C_EEPROM@1.7.4
	arduino-libraries/Arduino_LSM6DS3@^1.0.3


[env:xiao]
platform = https://github.com/maxgerhardt/platform-nordicnrf52
board = xiaoblesense_adafruit
1 Like

Maybe it needs a platform update first. Let me work on that, I’m the maintainer after all.

Okay I managed to get IMU to work using :

instead of :

I haven’t looked at how the libraries are different but it goes in the direction of the I2C bus being the wrong one (as in both cases the address is 0x6A).
Thanks !

1 Like