Zumo Robot for Arduino - I2C address issue while porting to MicroPython

HI, I’m porting the Pololu Zumo Robot V1.3 Library to MicroPython.
I’m encountering problem in the detection routine… this related to the various registers tests on a very recent Zumo Robot V1.3 .
While Scanning the I2C bus, it detects the address 30 and 107 (decimal) as used on the bus.
The testRef() calls gives the following results:
__test_reg(29, 0xf) => ERROR # test the WHO_AM_I register on i2c address 29 (decimal)
__test_reg(30, 0xf) => 0x3d
__test_reg(25, 0x20) => ERROR
__test_reg(30, 0xf) => 0x3d

So it detect something at address 30 (decimal) but with a Who_AM_I value 0x3d.
The issue for me is that defined constants in lsm303.cpp ( GitHub - pololu/zumo-shield-arduino-library: Arduino libraries for the Pololu Zumo Shield and Zumo robot kit for Arduino. ) are
#define D_WHO_ID 0x49
#define DLM_WHO_ID 0x3C

So… finally, it results into the following detection:
Zumo I2C scan: [30, 107]
__test_reg(29, 0xf) => ERROR
__test_reg(30, 0xf) => 0x3d
__test_reg(25, 0x20) => ERROR
__test_reg(30, 0xf) => 0x3d
LSM device type: DLH
LSM sa0 state : LOW
Magnetometer @ 30 (0x1e)
Accelerometer @ 24 (0x18)

where accelerometer address is obviously wrong! I checked twice the portage and can’t see what is wrong. Did I miss something obvious about address used or is there a new component on the Zumo Robot board?


As documented in the “Inertial sensors” section of the Zumo Shield user’s guide, the Zumo Shield v1.3 uses an LSM6DS33 accelerometer+gyro and an LIS3MDL magnetometer. These are handled by ZumoIMU.h and ZumoIMU.cpp in the Zumo Shield Arduino library. The LSM6DS33 has a 7-bit address of 0b1101011 (0x6B) and WHO_AM_I ID of 0x69, and the LIS3MDL has an address of 0b0011110 (0x1E) and WHO_AM_I ID of 0x3D, which matches what you are seeing.

Note that the LSM303.cpp file you were looking at, together with LSM303.h, L3G.h, and L3G.cpp, were in the library to support earlier versions of the Zumo Shield hardware. They are no longer used by the current version of the library, but were left there in case any users’ older programs relied on them for advanced use of the inertial sensors. (Instead, the current library uses ZumoIMU.h and ZumoIMU.cpp to interface with and abstract the details of all versions of the IMU hardware.)


1 Like

It was so obvious, it was the library (too much trained with the Pololu Robot v1.2 to read the V1.3 manual). Why didn’t think to the library.

Thanks for your guidance … now it detects the IMU as LSM6DS33_LIS3MDL :slight_smile:

I can now continue porting the code :slight_smile: :slight_smile: