ESP32 i2c_driver_install error
Posted: Thu Jun 13, 2019 1:31 pm
Hello there,
I'm trying to use ESP32 I2C to communicate with an external RTC (DS1337). I get an error with this line of code i2c_driver_install(I2C_MASTER_PORT, conf.mode, 0, 0, 0);
The code for i2c init
I2C_MASTER_PORT is used as port 1
I2C_MASTER_SDA_GPIO is GPIO16
I2C_MASTER_SCL_GPIO is GPIO17
IDF version is 3.3
The error I get is:
I have some printf's as 'starting...' in the beginning and they tend not to show up. It seems as the main isn't even called.
Also, when commented the line i2c_driver_install or I'm setting the device as a slave and not as a master the crash isn't there anymore and the messages are shown but the I2C is not usable.
Is there a way to fix this issue? I might have left something obvious behind, but after a few days I cannot see where the problem is. Could use a couple of fresh eyes!
Thank you
I'm trying to use ESP32 I2C to communicate with an external RTC (DS1337). I get an error with this line of code i2c_driver_install(I2C_MASTER_PORT, conf.mode, 0, 0, 0);
The code for i2c init
- i2c_config_t conf;
- conf.mode = I2C_MODE_MASTER;
- conf.sda_io_num = I2C_MASTER_SDA_GPIO;
- conf.sda_pullup_en = GPIO_PULLUP_DISABLE;
- conf.scl_io_num = I2C_MASTER_SCL_GPIO;
- conf.scl_pullup_en = GPIO_PULLUP_DISABLE;
- conf.master.clk_speed = I2C_MASTER_FREQ_HZ;
- i2c_param_config(I2C_MASTER_PORT, &conf);
- ESP_ERROR_CHECK(i2c_driver_install(I2C_MASTER_PORT, conf.mode, 0, 0, 0)); //problem here
- rtcIsResponding = setup_registers();
- rtcIsValidOnStart = false;
- if (rtcIsResponding)
- {
- rtcIsValidOnStart = set_default_rtc_state();
- }
I2C_MASTER_SDA_GPIO is GPIO16
I2C_MASTER_SCL_GPIO is GPIO17
IDF version is 3.3
The error I get is:
- Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
- Core 0 register dump:
- PC : 0x40096f9b PS : 0x00060730 A0 : 0x80095783 A1 : 0x3ffe3a60
- A2 : 0x3ffb64ec A3 : 0x0000001c A4 : 0x00060720 A5 : 0x00000000
- A6 : 0x00000000 A7 : 0x00000000 A8 : 0x000000fe A9 : 0x00000001
- A10 : 0x00000001 A11 : 0x00000000 A12 : 0x00000000 A13 : 0x00000000
- A14 : 0x00000000 A15 : 0x3ffb654d SAR : 0x0000001b EXCCAUSE: 0x0000001c
- EXCVADDR: 0x0000001c LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
- ELF file SHA256: 1138d6f2018262c1e3dba836115ecc3f7c91ab06acc22b4646dae7bb256ca631
- Backtrace: 0x40096f9b:0x3ffe3a60 0x40095780:0x3ffe3a80 0x40096a2b:0x3ffe3aa0 0x40175712:0x3ffe3ae0 0x4010843f:0x3ffe3b20 0x40108903:0x3ffe3b40 0x400d220d:0x3ffe3b80 0x40080fb4:0x3ffe3bc0 0x40081319:0x3ffe3bf0 0x400792f7:0x3ffe3c30 0x400793a9:0x3ffe3c60 0x400793c7:0x3ffe3ca0 0x400796ad:0x3ffe3cc0 0x40080796:0x3ffe3df0 0x40007c31:0x3ffe3eb0 0x4000073d:0x3ffe3f20
- Rebooting...
Also, when commented the line i2c_driver_install or I'm setting the device as a slave and not as a master the crash isn't there anymore and the messages are shown but the I2C is not usable.
Is there a way to fix this issue? I might have left something obvious behind, but after a few days I cannot see where the problem is. Could use a couple of fresh eyes!
Thank you