KrisKasprzak
Well-known member
All,
I realize I'm breaking rules in asking a non Teensy question, but I had communications between 2 ESP32 using I2C working just fine, then I installed the latest Arduino IDE and ESP32 software. Communication fails even with the most basic .inos
I have 4k7 pullups on both SDA and SCL on both boards
I'm really stuck and need some help. I'm using ESP32 dev kit, arduino IDE. I'm using no standard I2C pins on both boards (and cannot be changed)
Per this code, the master will see the slave and return the correct address and uint8_t error = Wire.endTransmission(true); returns 0
Master
Slave
bool error = Wire.begin(I2C_DEV_ADDR, 14, 25, 400000);
Serial.println(error); // no errors, error = 1
while (Wire.available()) { // never gets' anything
Anyone have a clue?
TIA
I realize I'm breaking rules in asking a non Teensy question, but I had communications between 2 ESP32 using I2C working just fine, then I installed the latest Arduino IDE and ESP32 software. Communication fails even with the most basic .inos
I have 4k7 pullups on both SDA and SCL on both boards
I'm really stuck and need some help. I'm using ESP32 dev kit, arduino IDE. I'm using no standard I2C pins on both boards (and cannot be changed)
Per this code, the master will see the slave and return the correct address and uint8_t error = Wire.endTransmission(true); returns 0
Master
Code:
#include "Wire.h"
#define I2C_DEV_ADDR 0x44
void setup() {
Serial.begin(115200);
bool error = Wire.begin(13, 14);
//bool error = Wire.begin(I2C_DEV_ADDR, 13, 14, 400000);
Serial.println(error);
Scanner(); // will find slave at 0x44 (correct)
}
void loop() {
delay(500);
Wire.beginTransmission(I2C_DEV_ADDR); // send to 0x44 (which was found in above)
Wire.write(122); // send something
uint8_t error = Wire.endTransmission(true);
Serial.print("endTransmission = ");
Serial.println(error);
// will alwasy return 0
}
void Scanner() {
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; 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.println(address,HEX);
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);
}
Slave
bool error = Wire.begin(I2C_DEV_ADDR, 14, 25, 400000);
Serial.println(error); // no errors, error = 1
while (Wire.available()) { // never gets' anything
Code:
#include "Wire.h"
#define I2C_DEV_ADDR 0x44
void setup() {
Serial.begin(115200);
bool error = Wire.begin(I2C_DEV_ADDR, 14, 25, 400000);
Serial.println(error); // no errors, error = 1
}
void loop() {
delay(100);
Serial.println("waiting...");
while (Wire.available()) {
Serial.write(Wire.read());
// never gets any data...
}
}
Anyone have a clue?
TIA