Just received XIAO RP2040 boards. Using with Arduino IDE, basic operations are OK (Blink LED_BUILTIN, Do various examples like reading internal Temperature, NeoPixel stuff, etc.)
Here’s my problem: Can’t get the I2C to work.
This works:
uint8_t dev_addr7 = 0x48;
// This works:
// Scope display of SCL and SDA are nominal
// Return value of zero indicates successful ACK by device
Wire.begin();
Wire.beginTransmission(dev_addr7);
uint8_t err = Wire.endTransmission();
Serial.printf("I2C probe of 0x%02X returned %u at %lu ms\n",
dev_addr7, err, millis());
If I have a device with that address attached to the I2C pins (SDA on D4, SCL on D5), all is good. It prints the proper return value of zero, the I2C pins show the transfer and show the ACK by the device.
On the other hand, the following code does not wiggle the SDA or SCL pins.
// This doesn't work: SDA and SCL pins do not wiggle and
// return value from endTransmission is 4 (Other problem)
uint8_t buff[2] = {0x45, 0x54};
Wire.beginTransmission(dev_addr7);
Wire.write(buff[0]);
Wire.write(buff[1]);
err = Wire.endTransmission();
Serial.printf("After trying to write bytes to 0x%02X: err = %d at %lu ms\n",
dev_addr7, err);
Output looks like this:
I2C Test Compiled on Dec 11 2021 at 16:31:05
D5 = 7, D4 = 6
SCL = 7, SDA = 6
I2C probe of 0x48 returned 0 at 4552 ms
After trying to write bytes to 0x48: err = 4 at 4552 ms
Nothing that involves the I2C hardware Write() function works. Note that the first snippet that I showed invokes a “special case” that doesn’t call the hardware Write() function.
Bottom line: I know the RP2040 I2C module works (I have several other RP2040 boards such as the Arduino Nano 33 BLE and the Arduino Nano RP2040, which I have tested extensively), but am thinking there is something in the SeeedStudio board library that is borked.
Does anyone have any experience with the XIAO RP2040 I2C hardware? Any Suggestions? Anything at all?
My setup:
- Arduino 1.8.16 on Windows 10
- Seeed XIAO RP2040 Board package version1.9.3 installed in Arduino Board Manager
- Board: “Seeed XIAO RP2040” selected in Arduino IDE
Regards,
Dave