feat(dsi): add timeout check for lp cmd rx

This commit is contained in:
Chen Jichang
2026-08-18 09:25:43 +08:00
parent 062a6949ad
commit 9c06cfcbcf
7 changed files with 47 additions and 20 deletions
@@ -11,6 +11,7 @@
#define MIPI_DSI_DEFAULT_TIMEOUT_CLOCK_FREQ_MHZ 10
// TxClkEsc frequency must be configured between 2 and 20 MHz
#define MIPI_DSI_DEFAULT_ESCAPE_CLOCK_FREQ_MHZ 18
#define MIPI_DSI_DEFAULT_HOST_LP_RX_TIMEOUT_COUNT 0x7FFF
esp_err_t esp_lcd_new_dsi_bus(const esp_lcd_dsi_bus_config_t *bus_config, esp_lcd_dsi_bus_handle_t *ret_bus)
{
@@ -122,9 +123,11 @@ esp_err_t esp_lcd_new_dsi_bus(const esp_lcd_dsi_bus_config_t *bus_config, esp_lc
mipi_dsi_host_ll_set_timeout_clock_division(hal->host, (uint32_t)roundf(bus_config->lane_bit_rate_mbps / 8.0f / MIPI_DSI_DEFAULT_TIMEOUT_CLOCK_FREQ_MHZ));
// Set the divider to get the TX Escape clock, clock source is the high-speed byte clock
mipi_dsi_host_ll_set_escape_clock_division(hal->host, (uint32_t)roundf(bus_config->lane_bit_rate_mbps / 8.0f / MIPI_DSI_DEFAULT_ESCAPE_CLOCK_FREQ_MHZ));
// set the timeout intervals to zero, means to disable the timeout mechanism
mipi_dsi_host_ll_set_timeout_count(hal->host, 0, 0, 0, 0, 0, 0, 0);
// DSI host will wait indefinitely for a read response from the DSI device
// Enable host timeout detection for command mode transactions.
mipi_dsi_host_ll_set_timeout_count(hal->host, 0,
MIPI_DSI_DEFAULT_HOST_LP_RX_TIMEOUT_COUNT,
0, 0, 0, 0, 0);
// Set the maximum time required to perform a read command, measured in lane byte clock cycles.
mipi_dsi_phy_ll_set_max_read_time(hal->host, 6000);
// set how long the DSI host will wait before sending the next transmission
mipi_dsi_phy_ll_set_stop_wait_time(hal->host, 0x3F);
@@ -83,7 +83,8 @@ static esp_err_t panel_io_dbi_rx_param(esp_lcd_panel_io_t *io, int lcd_cmd, void
esp_lcd_dsi_bus_handle_t bus = dbi_io->bus;
mipi_dsi_hal_context_t *hal = &bus->hal;
mipi_dsi_hal_host_gen_read_dcs_command(hal, dbi_io->virtual_channel, lcd_cmd, dbi_io->lcd_cmd_bits / 8, param, param_size);
ESP_RETURN_ON_FALSE(mipi_dsi_hal_host_gen_read_dcs_command(hal, dbi_io->virtual_channel, lcd_cmd, dbi_io->lcd_cmd_bits / 8, param, param_size),
ESP_ERR_TIMEOUT, TAG, "DSI read command timeout");
return ESP_OK;
}
@@ -29,10 +29,6 @@ components/esp_lcd/test_apps/mipi_dsi_lcd:
- soc
disable:
- if: SOC_MIPI_DSI_SUPPORTED != 1
disable_test:
- if: IDF_TARGET == "esp32p4"
temporary: true
reason: lack of runners, DSI can't work without an LCD connected
components/esp_lcd/test_apps/parlio_lcd:
depends_components:
@@ -16,7 +16,6 @@ from pytest_embedded_idf.utils import soc_filtered_targets
indirect=True,
)
@idf_parametrize('target', ['esp32p4'], indirect=['target'])
@pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='no runner')
def test_dsi_lcd(dut: Dut) -> None:
dut.run_all_single_board_cases()
@@ -34,7 +33,6 @@ def test_dsi_lcd(dut: Dut) -> None:
soc_filtered_targets('SOC_MIPI_DSI_SUPPORTED == 1 and SOC_FLASH_ENC_SUPPORTED == 1'),
indirect=['target'],
)
@pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='no runner')
def test_dsi_lcd_with_flash_encryption(dut: Dut) -> None:
dut.run_all_single_board_cases()
@@ -49,6 +47,5 @@ def test_dsi_lcd_with_flash_encryption(dut: Dut) -> None:
indirect=True,
)
@idf_parametrize('target', ['esp32p4'], indirect=['target'])
@pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='no runner')
def test_dsi_lcd_esp32p4_rev1(dut: Dut) -> None:
dut.run_all_single_board_cases()