Open NiopTres opened 1 year ago
Strange. I haven't used this library in a long time, so it's likely out of date and may not behave well with the latest ESP IDF.
Any way to know how to fix it or find out how to get it to work again?
The i2c.c files where the error appears looks like this
`esp_err_t i2c_param_config(i2c_port_t i2c_num, const i2c_config_t *i2c_conf) { I2C_CHECK((i2c_num >= 0) && (i2c_num < I2C_NUM_MAX), I2C_NUM_ERROR_STR, ESP_ERR_INVALID_ARG); I2C_CHECK(i2c_conf != NULL, I2C_ADDR_ERROR_STR, ESP_ERR_INVALID_ARG); I2C_CHECK(i2c_conf->mode < I2C_MODE_MAX, I2C_MODE_ERR_STR, ESP_ERR_INVALID_ARG);
esp_err_t ret = i2c_set_pin(i2c_num, i2c_conf->sda_io_num, i2c_conf->scl_io_num,
i2c_conf->sda_pullup_en, i2c_conf->scl_pullup_en, i2c_conf->mode);
if (ret != ESP_OK) {
return ret;
}
memcpy((i2c_config_t *)(i2c_config[i2c_num]), (i2c_config_t *)i2c_conf, sizeof(i2c_config_t));
return ESP_OK;
}`
And the change i made to i2c.h so it would compile looks like this
i2c_mode_t mode; /*!< I2C mode */
gpio_num_t sda_io_num; /*!< GPIO number for I2C sda signal */
gpio_pullup_t sda_pullup_en; /*!< Internal GPIO pull mode for I2C sda signal*/
gpio_num_t scl_io_num; /*!< GPIO number for I2C scl signal */
gpio_pullup_t scl_pullup_en; /*!< Internal GPIO pull mode for I2C scl signal*/
uint32_t clk_stretch_tick; /*!< Clock Stretch time, depending on CPU frequency*/
/* new lines added to file */
union {
struct {
uint32_t clk_speed; /*!< I2C clock frequency for master mode, (no higher than 1MHz for now) */
} master;
struct {
uint8_t addr_10bit_en; /*!< I2C 10bit address mode enable for slave mode */
uint16_t slave_addr; /*!< I2C address for slave mode */
} slave;
};
/* end of new lines */
} i2c_config_t;```
Maybe you still have an older version of the i2c files from the IDF that could give an idea to what could be different?
Or maybe do you know of any other more up to date IDF library for the ESP and MPU combo?
Sorry, I can't help. The only think I suggest is to put println
statements everywhere and see where it crashes.
The repository has been updated to run on ESP IDF 5.1. It has been tested on the ESP32, I still need to test it on the ESP8266.
Having issues with the code. At first I had some issues with the i2c part of the code ( Changed the following in i2c-easy.c:
ESP_ERROR_CHECK(i2c_param_config(i2c_master_port, &conf)); ESP_ERROR_CHECK(i2c_driver_install(i2c_master_port, conf.mode));
I also found that at least in the newest version of the Esp8266 SDK i downloaded, the i2c.c file does not use ".master.clk_speed" as part of the "i2c_config_t" struct's file... I tried adding some code back into it, but that may be part of the issue. It did help compile. But I do not believe that should have caused many issues
) . I am fairly new to dealing with ESP coding and flashing, i mostly dealt with Arduino boards and Arduino IDE for projects. But given my current project requires this ESP with MPU module for testing (we plan on switching to the newer non deprecated 10 DOF circuits), i am learning ESP.
The issue is now that I am compiling and flashing the code as said in the readme... I am getting the error as seen in the title, the debug looks the following in the msys32 Mingw32 :