Creating a new Wire with SAMD21 SERCOM doesn't work

Hi to all,
For my new project I need to reconfigure the SERCOMs to get three UART and three I2C buses.

I have been following these guides:

The three UART work, however I cannot get the secondary Wire to work.
The hardware is a Sparkfun SAMD21 Mini and three BME280 sensors, connected to pins as follows, with 4k7 pullups (SDA, SCL): (A4, A5), (4, 3), (11, 13)
I carefully selected the pins out of the table in the SAMD21 datasheet, they should be correct.
The first bus is default and works, the 2nd is on SERCOM0 and the 3rd on SERCOM1.

This is the test code for a single Wire:

#include "wiring_private.h" // pinPeripheral() function
#include <Wire.h>
#include <SparkFunBME280.h>

TwoWire myWire(&sercom0, 4, 3);

BME280 bme1; // I2C

void SERCOM0_Handler(void);

void SERCOM0_Handler(void) {
    myWire.onService();
}

void setup() {
  // put your setup code here, to run once:
 SerialUSB.begin(115200);
  while (!SerialUSB) {
    ; // wait for serial port to connect
  }

  SerialUSB.println("SAMD21 Test Initialization");
  SerialUSB.println();

   SerialUSB.println("Initializing I2C on pin 4, 3");

  
  myWire.begin();
  pinPeripheral(3, PIO_SERCOM);
  pinPeripheral(4, PIO_SERCOM);
  SerialUSB.println("Inizialized, looking for sensor");
   if(bme1.beginI2C(myWire) == false) {
    SerialUSB.println("Sensor NOT found!");
  } else {
    SerialUSB.println("Sensor found");
  }
}

void loop() {
  // put your main code here, to run repeatedly:
    SerialUSB.print("Sensor 2 temp: ");
    SerialUSB.println(bme1.readTempC(), 2);
    delay(5000);
}

The sketch will be stuck at "Inizialized, looking for sensor".
Tried to do the same with Adafrult BME280 library, still stuck.
If I run the I2C scanner code, the device is correctly found at address 0x77 so at least something is clicking.

Any advice?

Thank you!

Nick

My (unproven) spreadsheet says sercom0 would be on pins 2&3 of an Arduino Zero, not 3&4.
Or is that one of the zero/m0 incompatibilities?

Dear Westfw,
Thank you for your feedback.

According to the Arduino Zero schematic:

https://www.arduino.cc/en/uploads/Main/ArduinoZero-schematic.pdf

PA08 is connected through PA14_TCC0-W4 net to PIN 3
PA09 is connected through PA09_TCC0-W4 net to PIN 4

So on Arduino Zero SDA on SERCOM0 would be on PIN3, SCL on PIN4.

However I'm using a Sparkfun SAMD21 Mini Breakout board, which has the following schematic:

https://cdn.sparkfun.com/datasheets/Dev/Arduino/Boards/sparkfun-samd21-mini-breakout-v10.pdf

Here we can see that PIN3 is connected to PA09 and PIN4 to PA08, thus the I2C pins are inverted.

The code I posted work beautifully on SERCOM1 set up on pins 11, 13 (PA16, PA17)
I swapped sensors, libraries, and even the Sparkfun unit with the same result.

Is there anyone who could try to reproduce the issue with a SAMD21 board?

Thank you
Nick