MicroMod Machine Learning Carrier Board - RP2040 Processor Board - LIS2DH12 accelerometer not detect

I have a MicroMod Machine Learning Carrier Board with an RP2040 Processor Board. I have attempted to replicate the [getting started example for the accelerometer example https://learn.sparkfun.com/tutorials/mi … elerometer but I am stuck. The LIS2DH12 accelerometer is not detected.

My code is shown below, using the Arduino IDE:

#include <Wire.h>

#include "SparkFun_LIS2DH12.h" //Click here to get the library: http://librarymanager/All#SparkFun_LIS2DH12
SPARKFUN_LIS2DH12 accel;       //Create instance
int n = 0;

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
  Serial.begin(115200);
  delay(1000);
  Serial.println("Ready ...");

  Wire.begin();

  if (accel.begin() == false)
  {
    delay(1000);
    Serial.println("Accelerometer not detected. Check address jumper and wiring. Freezing...");
    while (1)
      ;
  }
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
  n++;
  String o = String("Loop " + String(n) + " complete");
  Serial.println(o);
}

I have checked the LIS2DH12 for the I2C address and I even tried passing the address as a parameter to accel.begin() but that didn’t work. I also tried scanning I2C using an example code from Arduino but nothing was detected. I used the code below for that:

// ---------------------------------------------------------------- /
// Arduino I2C Scanner
// Re-writed by Arbi Abdul Jabbaar
// Using Arduino IDE 1.8.7
// Using GY-87 module for the target
// Tested on 10 September 2019
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
// ---------------------------------------------------------------- /

#include <Wire.h> //include Wire.h library

void setup()
{
  Wire.begin(); // Wire communication begin
  Serial.begin(115200); // The baudrate of Serial monitor is set in 9600
  while (!Serial); // Waiting for Serial Monitor
  Serial.println("\nI2C Scanner");
}

void loop()
{
  byte error, address; //variable for error and I2C address
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for (address = 1; address < 127; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address < 16)
        Serial.print("0");
      Serial.print(address, HEX);
      Serial.println("  !");
      nDevices++;
    }
    else if (error == 4)
    {
      Serial.print("Unknown error at address 0x");
      if (address < 16)
        Serial.print("0");
      Serial.println(address, HEX);
    }
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000); // wait 5 seconds for the next I2C scan
}

The code didn’t detect any devices. I, unfortunately, do not have other processor boards, such as the Artemis, to try. I will willing to order those just so I can see whether the issue is with the RP2040 or the carrier board.

I do not know if I am doing anything wrong, or whether the RP2040 doesn’t support the LIS2DH12 accelerometer.

While I don’t have an RP2040 on-hand, I was able to recreate this using the MicroMod Machine Learning Board with an Artemis processor (the accelerometer/LIS2DH12 example; blink and others work as expected)…so I believe the best route is to create an ‘issue’ here https://github.com/sparkfun/MicroMod_Ma … ier/issues and see if we can get the library compatibility updated :wink: