ESP32-GATEWAY won't accept alternate I2C pins at run time.

Started by tohox, April 24, 2023, 02:49:59 AM

Previous topic - Next topic

tohox

Hi,

I'm trying to use GPIO 39 and 36 as SDC and SCL and although everything compiles without a hitch at run time I get a series of  "E (9) i2c: i2c_set_pin(870): sda gpio number error". Here is a simplified version of my Arduino sketch. I believe it is line #15 "I2CBNO.begin(SDA_PIN, SCL_PIN, 100000);" which triggers the error. I've tried a few different pin combinations but they all result in the same error. I've also tried a few different versions of the Espressif board definitions with the same result.

#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <Wire.h>

#define BAUDRATE 115200
#define SDA_PIN 39
#define SCL_PIN 36

TwoWire I2CBNO = TwoWire(0);
Adafruit_BNO055 bno = Adafruit_BNO055(55, 0x28, &I2CBNO);

void setup() {
  Serial.begin(BAUDRATE);
  Serial.println("_____JUST_STARTED_!_____");
  I2CBNO.begin(SDA_PIN, SCL_PIN);
  if(!bno.begin( ))
  {
    Serial.println("BNO055 connection problem");
    while(1);
  }
  bno.setExtCrystalUse(true);
  Serial.println("BNO055 connection succesful");
  Serial.println("____SETUP_COMPLETE_!_____");
}

void loop() {
  sensors_event_t event;
  bno.getEvent(&event);
  Serial.println( "Heading X" + String(event.orientation.x));
  Serial.println( "Heading X" + String(event.orientation.y));
  Serial.println( "Heading X" + String(event.orientation.z));
  delay(16);
}

Which results in the following:
Quote19:49:20.313 -> ets Jul 29 2019 12:21:46
19:49:20.313 ->
19:49:20.313 -> rst:0x1 (POWERON_RESET),boot:0x1a (SPI_FAST_FLASH_BOOT)
19:49:20.313 -> configsip: 0, SPIWP:0xee
19:49:20.313 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
19:49:20.313 -> mode:DIO, clock div:1
19:49:20.313 -> load:0x3fff0030,len:1184
19:49:20.313 -> load:0x40078000,len:13220
19:49:20.347 -> ho 0 tail 12 room 4
19:49:20.347 -> load:0x40080400,len:3028
19:49:20.347 -> entry 0x400805e4
19:49:20.444 -> _____JUST_STARTED_!_____
19:49:20.444 -> E (9) i2c: i2c_set_pin(870): sda gpio number error
19:49:20.476 -> E (10) i2c: i2c_set_pin(870): sda gpio number error
19:49:20.476 -> E (10) i2c: i2c_set_pin(870): sda gpio number error

Any ideas/comments are welcome.

Thanks!

LubOlimex

Consider that both GPIO36 and GPIO39 are not acutally GPIOs but only GPIs. These are named in the ESP32-GATEWAY as GPI36 and GPI39, the names we used are not a typo or misspelling.
Technical support and documentation manager at Olimex

tohox

Indeed! If I try with pins other than 39,36,34,33 the code now compiles and runs.

Thanks!