Copying/pasting answer from other topic:
Can you post your full code? What you have in the beginning looks OK for the most part, however you don’t need to use the “#define AP3_Wire3_IOM 1” – if that were defined in “variant.h” and you had defined there to be 4 Wire interfaces then You’d see “Wire3” attached to IOMaster 1.
But that’s not what you want. Instead you want a custom Wire port on SCL3/SDA3 (I think the pin names are a little confusing… It makes it seem like Wire3 is available by default. I can change that in future releases.)
Your line “TwoWire myWire(3)” is good - that will create the correct port. Are you using “myWire” for interfacing in the rest of the code?
I did some testing with a BlackBoard ATP and an ICM-20948 breakout board:
Test 1 - Using the default sketch and using the Qwiic connector:
Output:
Scanning...
Unknown error at address 0x01
... (all addresses in between)
Unknown error at address 0x68
I2C device found at address 0x69 !
Unknown error at address 0x6A
... (all addresses in between)
Unknown error at address 0x7E
done
Test 2 - Trying to use IOMaster 3 as “myWire” on pads 42 and 43 (corresponding to pins 7 and 6 respectively on the Nano)
Code:
/* Author: Owen Lyke
Created: May 13 2019
License: MIT. See SparkFun Arduino Apollo3 Project for more information
This example demonstrates how to use Arduino Wire (I2C) by scanning all
possible I2C addresses and indicating which have responding devices
The Variant you use may have one or more TwoWire objects declared.
For example on the Edge board 'Wire' corresponds to the I2C bus that connects to the
Qwiic connector (and you can also use 'WireQwiic' to access it) while Wire1 (also
'WireAccel') is connected to the onboard LIS2DH accelerometer.
'Wire' should be used to scan devices on the Qwiic connector on all Artemis carrier boards.
The I2C scan code comes from here: https://playground.arduino.cc/Main/I2cScanner/
*/
#include "Wire.h"
#define Wire myWire
TwoWire myWire(3);
void setup()
{
Serial.begin(9600);
while (!Serial)
{
}; //Wait for user to open terminal window
Serial.println("SparkFun Arduino Apollo3 Wire Example (I2C Scanner)");
Serial.printf("Compiled on %s, %s\n\n", __DATE__, __TIME__);
Wire.begin();
}
void loop()
{
uint8_t 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.
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(1000); // wait 1 second for next scan
}
Output:
Scanning...
Unknown error at address 0x01
... (all addresses in between)
Unknown error at address 0x68
I2C device found at address 0x69 !
Unknown error at address 0x6A
... (all addresses in between)
Unknown error at address 0x7E
done
So I was able to get IOMaster 3 working…
One last note: the “unknown error at address ADR” is caused by default handling of unknown errors. Chances are high that that error is simply a NAK on the I2C bus. This will be handled properly soon.