I have a problem initialising the master i2c on my ESP32wroom32
I have connected I2C lines on Pin33 and Pin36 (I2C_Data, I2C_Clock respectively).
These pins seem to be connected to GPIO8, and GPIO23.
GPIO8 seem to be the problem, since this pin has funciton1 as SD_DATA1, and function2 as GPIO8.
If I remove the GPIO8, and just select some unused GPIO, the initialisation works, but without any communication of course.
Whenever I introduce the GPIO8 in the initialising code, the CPU panics.
I assume that the I2C_MODE_MASTER is either 0 or 1, and I can freely choose this number.
I2C_DATA_GpioPortNr = GPIO_NUM_8
I2C_CLOCK_GpioPortNr= GPIO_NUM_23
Code: Select all
esp_err_t sensorClass::i2c_master_init(void)
{
esp_err_t lv_errorVal;
i2c_config_t conf;
conf.mode = I2C_MODE_MASTER;
conf.sda_io_num = I2C_DATA_GpioPortNr;
conf.sda_pullup_en = GPIO_PULLUP_ENABLE;
conf.scl_io_num = I2C_CLOCK_GpioPortNr;
conf.scl_pullup_en = GPIO_PULLUP_ENABLE;
conf.master.clk_speed = I2C_frequency;
lv_errorVal = i2c_param_config(I2C_Master_Port, &conf);
if (lv_errorVal != 0)
printf("I2C init - %s : Parmeter config error\n", esp_err_to_name(gv_errVal));
lv_errorVal = i2c_driver_install(I2C_Master_Port, conf.mode, I2C_MASTER_RX_BUF_DISABLE,I2C_MASTER_TX_BUF_DISABLE, 0);
if (lv_errorVal != 0)
printf("I2C init - %s : Driver install error\n", esp_err_to_name(gv_errVal));
return lv_errorVal;
}