espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.46k stars 7.25k forks source link

Esp32 cam and I2c_lcd #14146

Open IenSignif opened 3 months ago

IenSignif commented 3 months ago

Answers checklist.

General issue report

Hi, I'm creating a project with shrinked opencv with I2c lcd. I use opencv Hough circle to count circle and display it on my I2c lcd, everything was going fine and finished the code. The problem is when i run the flashed device it shows an error of :

Btw I'm using the version ESP-IDF v4.4.8 because it's compatible with the opencv library file Other info about my device: ESP32-CAM (HW-818) I2c LCD 2 x 16 0x27

`I (774) cpu_start: Starting scheduler on PRO CPU. I (0) cpu_start: Starting scheduler on APP CPU. I (778) LCD: I2C initialized successfully

E (1828) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same I (1828) LCD: Error is sending command

E (2828) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same I (2828) LCD: Error is sending command

E (3828) i2c: i2c_set_pin(882): scl and sda gpio numbers are the same I (3828) LCD: Error is sending command`

even though my config in my main.cpp is correct which is :

`static esp_err_t i2c_master_init(void) { int i2c_master_port = I2C_NUM_0;

i2c_config_t conf = {
    .mode = I2C_MODE_MASTER,
    .sda_io_num = GPIO_NUM_13,
    .scl_io_num = GPIO_NUM_16,
    .sda_pullup_en = GPIO_PULLUP_ENABLE,
    .scl_pullup_en = GPIO_PULLUP_ENABLE,
    .master.clk_speed = 100000,
};

i2c_param_config(i2c_master_port, &conf);

return i2c_driver_install(i2c_master_port, conf.mode, 0, 0, 0);

}`

I'm almost finish on my project, or so I thought. can someone help me, or any recommendations?

IenSignif commented 3 months ago

I figured it out, i used an old I2c library which works fine but another problem came when I'm running the flash device:

`W (968) LCD: I2C bus is busy, waiting... W (968) LCD: I2C bus is busy, waiting... W (978) LCD: I2C bus is busy, waiting... W (978) LCD: I2C bus is busy, waiting... W (978) LCD: I2C bus is busy, waiting... W (988) LCD: I2C bus is busy, waiting... W (988) LCD: I2C bus is busy, waiting... W (988) LCD: I2C bus is busy, waiting... W (998) LCD: I2C bus is busy, waiting... W (998) LCD: I2C bus is busy, waiting... ESP_ERROR_CHECK failed: esp_err_t 0xffffffff (ESP_FAIL) at 0x40087700 file: "./main/main.cpp" line 90 func: void LCD_writeNibble(uint8_t, uint8_t) expression: i2c_master_cmd_begin(I2C_NUM_0, cmd, 1000/portTICK_PERIOD_MS)

abort() was called at PC 0x40087703 on core 0`

and the backtrace ( I use addr2line to identify the backtraces ) :

esp/v4.4.8/esp-idf/components/esp_system/esp_err.c:42 esp/v4.4.8/esp-idf/components/esp_system/esp_err.c:43 esp/v4.4.8/esp-idf/components/esp_system/panic.c:408 esp/v4.4.8/esp-idf/components/esp_system/esp_system.c:137 esp/v4.4.8/esp-idf/components/newlib/abort.c:46 esp/v4.4.8/esp-idf/components/esp_system/esp_err.c:43 main/main.cpp:90 (discriminator 1) main/main.cpp:173 main/main.cpp:199 esp/v4.4.8/esp-idf/components/freertos/port/port_common.c:141 (discriminator 2) esp/v4.4.8/esp-idf/components/freertos/port/xtensa/port.c:142

IenSignif commented 3 months ago

I fixed it, I just mistakenly put the SCL in a different pin,

IenSignif commented 3 months ago

everythings fine now, now I'm stuck with this

I (2553) camera: Allocating 1 frame buffers (3750 KB total) I (3063) camera: Allocating 3750 KB frame buffer in OnBoard RAM E (3573) gpio: esp_intr_alloc failed (0x105) E (3573) camera: gpio_install_isr_service failed (105) E (3573) camera: Camera init failed with error 0x105 E (3583) LCD: Camera init failed with error 0x105

suda-morris commented 3 months ago

failed in GPIO interupt allocation, error code 0x105 means #define ESP_ERR_NOT_FOUND 0x105 /*!< Requested resource not found */

So check how your camera driver calls the gpio_install_isr_service function. Can the camera driver initialize on another CPU core?