ArduinoCore-samd icon indicating copy to clipboard operation
ArduinoCore-samd copied to clipboard

Alternate SERCOM I2C Not Working On Pins PA08 and PA09 (4 and 3)

Open DeltaAerospace opened this issue 2 years ago • 2 comments

I2C is not working using PA08 and PA09 on the ATSAMD21G18A-AU with an Arduino Zero bootloader on a custom PCB. -Tried Modified I2C Scanner -Normal I2C on PA22 and PA23 still work

DeltaAerospace avatar Oct 19 '23 01:10 DeltaAerospace

Works for me. Problems could be init in the library I had a lot of issues with external libraries if != Wire'0', If the library tries to init the Wire remove the line (.begin) and add it manually in your setup.

Try manualy, this works:

`#include <arduino.h> #include "wiring_private.h" // for pinPeripheral() function #include <Wire.h>

TwoWire Wire1(&sercom2, // &PERIPH_WIRE 4, // PIN_WIRE_SDA 3); // PIN_WIRE_SCL

void setup() {

// Init Wire1 Wire1.begin(); Wire1.setClock(100000); pinPeripheral(4, PIO_SERCOM_ALT); pinPeripheral(3, PIO_SERCOM_ALT);

Serial1.begin(115200); }

void loop() {

Wire1.beginTransmission(0x40);

Wire1.write(0b101010); // Sends value byte Wire1.endTransmission(); // Stop transmitting

delay(500); } ` (set the parameters according to your i2c chip connected)

wltue avatar May 21 '24 07:05 wltue

Since I posted this, I’ve got it working. Thanks for the help.

On Mon, May 20, 2024 at 9:06 PM tse @.***> wrote:

Works for me. Problems could be init in the library I had a lot of issues with external libraries if != Wire'0', If the library tries to init the Wire remove the line (.begin) and add it manually in your setup.

Try manualy, this works:

`#include <arduino.h> #include "wiring_private.h" // for pinPeripheral() function #include <Wire.h>

TwoWire Wire1(&sercom2, // &PERIPH_WIRE 4, // PIN_WIRE_SDA 3); // PIN_WIRE_SCL

void setup() {

// Init Wire1 Wire1.begin(); Wire1.setClock(100000); pinPeripheral(4, PIO_SERCOM_ALT); pinPeripheral(3, PIO_SERCOM_ALT);

Serial1.begin(115200); }

void loop() {

Wire1.beginTransmission(0x40);

Wire1.write(0b101010); // Sends value byte Wire1.endTransmission(); // Stop transmitting

delay(500); } ` (set the parameters according to your i2c chip connected)

— Reply to this email directly, view it on GitHub https://github.com/arduino/ArduinoCore-samd/issues/711#issuecomment-2121905190, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBIOT7A4OPSUBFTENMY57VLZDLXANAVCNFSM6AAAAAA6GMLEM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRRHEYDKMJZGA . You are receiving this because you authored the thread.Message ID: @.***>

DeltaAerospace avatar May 26 '24 02:05 DeltaAerospace