diff --git a/components/bootloader_support/src/bootloader_random.c b/components/bootloader_support/src/bootloader_random.c index 3772d7c32d..f28333214d 100644 --- a/components/bootloader_support/src/bootloader_random.c +++ b/components/bootloader_support/src/bootloader_random.c @@ -146,6 +146,16 @@ void bootloader_random_enable(void) void bootloader_random_disable(void) { + /* Reset some i2s configuration (possibly redundant as we reset entire + I2S peripheral further down). */ + CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_START); + SET_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_RESET); + CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_RESET); + CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_CAMERA_EN); + CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_LCD_EN); + CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_DATA_ENABLE_TEST_EN); + CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_DATA_ENABLE); + /* Disable i2s clock */ #ifdef BOOTLOADER_BUILD DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2S0_CLK_EN); @@ -153,14 +163,6 @@ void bootloader_random_disable(void) periph_module_disable(PERIPH_I2S0_MODULE); #endif // BOOTLOADER_BUILD - /* Reset some i2s configuration (possibly redundant as we reset entire - I2S peripheral further down). */ - CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_CAMERA_EN); - CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_LCD_EN); - CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_DATA_ENABLE_TEST_EN); - CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_DATA_ENABLE); - CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_START); - /* Restore SYSCON mode registers */ #if CONFIG_IDF_TARGET_ESP32 CLEAR_PERI_REG_MASK(SENS_SAR_READ_CTRL_REG, SENS_SAR1_DIG_FORCE);