From b731bd6a606c117761bb127faa63db174881f412 Mon Sep 17 00:00:00 2001 From: morris Date: Tue, 14 Feb 2023 13:40:39 +0800 Subject: [PATCH] rmt: fix rmt buffer allocation issue --- components/driver/deprecated/rmt_legacy.c | 6 +++--- components/esp_lcd/src/esp_lcd_panel_io_i2s.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/driver/deprecated/rmt_legacy.c b/components/driver/deprecated/rmt_legacy.c index 2045c51607..4f128b51da 100644 --- a/components/driver/deprecated/rmt_legacy.c +++ b/components/driver/deprecated/rmt_legacy.c @@ -1183,12 +1183,12 @@ esp_err_t rmt_translator_init(rmt_channel_t channel, sample_to_rmt_t fn) const uint32_t block_size = mem_blocks * RMT_MEM_ITEM_NUM * sizeof(rmt_item32_t); if (p_rmt_obj[channel]->tx_buf == NULL) { #if !CONFIG_SPIRAM_USE_MALLOC - p_rmt_obj[channel]->tx_buf = (rmt_item32_t *)malloc(block_size); + p_rmt_obj[channel]->tx_buf = (rmt_item32_t *)calloc(1, block_size); #else if (p_rmt_obj[channel]->intr_alloc_flags & ESP_INTR_FLAG_IRAM) { - p_rmt_obj[channel]->tx_buf = (rmt_item32_t *)malloc(block_size); - } else { p_rmt_obj[channel]->tx_buf = (rmt_item32_t *)heap_caps_calloc(1, block_size, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); + } else { + p_rmt_obj[channel]->tx_buf = (rmt_item32_t *)calloc(1, block_size); } #endif if (p_rmt_obj[channel]->tx_buf == NULL) { diff --git a/components/esp_lcd/src/esp_lcd_panel_io_i2s.c b/components/esp_lcd/src/esp_lcd_panel_io_i2s.c index 4550915e13..e372c08b19 100644 --- a/components/esp_lcd/src/esp_lcd_panel_io_i2s.c +++ b/components/esp_lcd/src/esp_lcd_panel_io_i2s.c @@ -609,12 +609,13 @@ static esp_err_t i2s_lcd_select_periph_clock(esp_lcd_i80_bus_handle_t bus, lcd_c switch (src) { case LCD_CLK_SRC_PLL160M: bus->resolution_hz = 160000000 / LCD_PERIPH_CLOCK_PRE_SCALE; - i2s_ll_tx_clk_set_src(bus->hal.dev, I2S_CLK_SRC_PLL_160M); break; default: ESP_RETURN_ON_FALSE(false, ESP_ERR_NOT_SUPPORTED, TAG, "unsupported clock source: %d", src); break; } + // I2S clock source is binary compatible with lcd_clock_source_t + i2s_ll_tx_clk_set_src(bus->hal.dev, (i2s_clock_src_t)src); i2s_ll_set_raw_mclk_div(bus->hal.dev, LCD_PERIPH_CLOCK_PRE_SCALE, 1, 0); #if CONFIG_PM_ENABLE