Is it possible to programmatically find out whether the display is connected to I2C or not?

zhukovia
Posts: 7
Joined: Tue Oct 31, 2023 5:25 am

Is it possible to programmatically find out whether the display is connected to I2C or not?

Postby zhukovia » Sun Nov 26, 2023 6:20 am

Is it possible to understand programmatically whether the display is physically connected?
When trying to initialize the display

Code: Select all

    ESP_LOGI(DISPLAY_TAG, "Install SSD1306 panel driver");
    esp_lcd_panel_handle_t panel_handle = NULL;
    esp_lcd_panel_dev_config_t panel_config = {
        .bits_per_pixel = 1,
        .reset_gpio_num = PIN_NUM_RST,
    };
    ESP_ERROR_CHECK(esp_lcd_new_panel_ssd1306(io_handle, &panel_config, &panel_handle));
    ESP_ERROR_CHECK(esp_lcd_panel_reset(panel_handle));
    ESP_ERROR_CHECK(esp_lcd_panel_init(panel_handle));
in the monitor I get the error
E (2319) lcd_panel.io.i2c: panel_io_i2c_tx_buffer(177): i2c transaction failed
but ESP_ERROR_CHECK still outputs ESP_OK
I repeat again, the display itself may or may not be connected to ESP 32 and I need to determine this.

MicroController
Posts: 1708
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Is it possible to programmatically find out whether the display is connected to I2C or not?

Postby MicroController » Sun Nov 26, 2023 10:46 am

Is it possible to understand programmatically whether the display is physically connected?
Yes, it is possible. But apparently, the IDF v5.1's 1306 LCD library functions never check for success of communications and just return ESP_OK no matter what. This seems to have been rectified in ESP-IDF v5.2.

zhukovia
Posts: 7
Joined: Tue Oct 31, 2023 5:25 am

Re: Is it possible to programmatically find out whether the display is connected to I2C or not?

Postby zhukovia » Sun Nov 26, 2023 11:58 am

Yes, it is possible. But apparently, the IDF v5.1's 1306 LCD library functions never check for success of communications and just return ESP_OK no matter what. This seems to have been rectified in ESP-IDF v5.2.
How can I do this? I have ESP-IDF v5.1.

MicroController
Posts: 1708
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Is it possible to programmatically find out whether the display is connected to I2C or not?

Postby MicroController » Sun Nov 26, 2023 1:03 pm

zhukovia wrote:
Sun Nov 26, 2023 11:58 am
How can I do this? I have ESP-IDF v5.1.
a) upgrade to v5.2,
b) modify the respective function in your IDF, or
c) try to manually send a command (e.g. "display off") to the display via the I2C driver and check the result.

zhukovia
Posts: 7
Joined: Tue Oct 31, 2023 5:25 am

Re: Is it possible to programmatically find out whether the display is connected to I2C or not?

Postby zhukovia » Sat Dec 02, 2023 8:21 am

MicroController wrote:
Sun Nov 26, 2023 1:03 pm
zhukovia wrote:
Sun Nov 26, 2023 11:58 am
How can I do this? I have ESP-IDF v5.1.
a) upgrade to v5.2,
I see that the latest version is 5.1.2. Where did you find 5.2?

MicroController
Posts: 1708
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Is it possible to programmatically find out whether the display is connected to I2C or not?

Postby MicroController » Sat Dec 02, 2023 11:01 am

https://github.com/espressif/esp-idf/tree/release/v5.2
Not sure if that's actually a release yet though.
But check out v5.1.2, which probably already includes the fix for issue #11741.

Who is online

Users browsing this forum: akolodner25, Google [Bot] and 110 guests