Need an I2C Example for the SparkFun Thing Plus RP2040

I'm looking for an I2C Example for the SparkFun Thing Plus RP2040; Googling hasn't helped.

I have a Raspberry Pi 4, latest fully updated 64-Bit Raspberry Pi OS, with latest 64-Bit Arduino stable software v1.8.19, and a SparkFun Thing Plus RP2040. A MS8607 (Altitude, Temperature, Humidity) is connected using Qwiic Connectors, and have also tried with a DS3231 Real Time Clock. As a first test I'm trying to get a simple I2C Address Scanner program to work, but it says" No I2C devices found". I have tried the following program with both "Wire" and "Wire1" with same results.

#include <Wire.h>

void setup() {
  Wire1.begin();
  Serial.begin(9600);
  Serial.println("\nI2C Scanner");
}
 
void loop() {
  byte error, 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.
    Wire1.beginTransmission(address);
    error = Wire1.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("Unknow 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 next scan
}

Any help would be really, really appreciated. Thank you.

Start by believing the results. Next ask why it is not working. Was there a I2C device on the bus when I tested. Have I connected it wrong? Have I installed the correct pull up resistors. If there are resistors on the modules did I compensate for them? Posting a Schematic,not a frizzy picture of how you have it wired including power and ground will help us help you. Be sure to include links to technical information, not sales info such as azon on each of your hardware devices.

Yes, there are 2 I2C devices, both have worked on a standard Arduino - A MS8607 (Altitude, Temperature, Humidity) is connected using Qwiic Connectors, and have also tried with a DS3231 Real Time Clock. It is connected correctly because the SparkFun Thing Plus RP2040 has a Qwiic Connector on it, and I used a Qwiic Cable. PullUp Resistors are on the Thing Plus board.

It appears you do not have it wired correctly. Posting links to technical information on the hardware devices will help. Azon links are generally useless as they are sales. Posting the labeled schematic, not a frizzy picture as you have it wired will help us help you.

The SparkFun Thing Plus - RP2040 has a Hookup Guide that shows that the I2C bus is SDA = GPIO6 and SCL = GPIO7.

Sparkfun uses the Arduino build environment for the Raspberry Pi Pico, which is on top of Mbed. There was some confusion in the past on which pins the default I2C bus for Arduino would be. I think they have landed now on pin GPIO4 and GPIO5.

This is very confusing. The Raspberry Pi Pico chip has pin numbers, the Sparkfun board has pin numbers, and there are the GPIO pin numbers. I think that GPIO4 and GPIO5 are at pin number 6 and 7 for the Raspberry Pi Pico. Did Sparkfun turn those pin numbers into GPIO6 and GPIO7 ? Sparfkun uses I2C1 in the schematic, that is the second I2C bus. It is not clear at this moment of the second I2C bus works. Now I'm totally lost.
Can we talk in GPIO pin numbers from now on ?

I'm not sure if i'm correct. You could ask at Sparkfun. I think you need to redirect the I2C bus to the pins of the qwiic connector.

[UPDATE]
It is GPIO4 and GPIO5 for the first I2C bus with "Wire". I can not find the "Wire1" pins. You can test it with:

// Pico-SDA-SCL.ino
//
// 15 August 2022, it should print 4 and 5 for everything.

#define _SERIAL_ Serial    // Serial for real board, Serial1 for Wokwi

#include <Wire.h>

void setup()
{
  _SERIAL_.begin( 115200);
  while( !_SERIAL_)      // wait for serial port to connect. Needed for native USB
  {
    delay( 10); 
  }

  _SERIAL_.println( "The pins are:");

#if defined(SDA)
  _SERIAL_.print( "SDA = ");
  _SERIAL_.println( SDA);
#endif

#if defined(SCL)
  _SERIAL_.print( "SCL = ");
  _SERIAL_.println( SCL);
#endif

#if defined(PIN_WIRE0_SDA)
  _SERIAL_.print( "PIN_WIRE0_SDA = ");
  _SERIAL_.println( PIN_WIRE0_SDA);
#endif

#if defined(PIN_WIRE0_SCL)
  _SERIAL_.print( "PIN_WIRE0_SCL = ");
  _SERIAL_.println( PIN_WIRE0_SCL);
#endif

#if defined(PIN_WIRE1_SDA)
  _SERIAL_.print( "PIN_WIRE1_SDA = ");
  _SERIAL_.println( PIN_WIRE1_SDA);
#endif

#if defined(PIN_WIRE1_SCL)
  _SERIAL_.print( "PIN_WIRE1_SCL = ");
  _SERIAL_.println( PIN_WIRE1_SCL);
#endif

#if defined(I2C_SDA)
  _SERIAL_.print( "I2C_SDA = ");
  _SERIAL_.println( I2C_SDA);
#endif

#if defined(I2C_SCL)
  _SERIAL_.print( "I2C_SCL = ");
  _SERIAL_.println( I2C_SCL);
#endif
}

void loop() {}

The test in Wokwi (Wokwi has no Serial-over-usb yet): Pico-SDA-SCL.ino - Wokwi Arduino and ESP32 Simulator

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.