spi_flash: fix cs line setup to make the flash driver more stable

This commit is contained in:
Cao Sen Miao 2021-05-20 20:51:38 +08:00 committed by Michael (XIAO Xufeng)
parent b7c8288056
commit a212d866f4
2 changed files with 7 additions and 0 deletions

View File

@ -340,3 +340,9 @@ static inline void spi_flash_ll_set_dummy(spi_dev_t *dev, uint32_t dummy_n)
dev->user.usr_dummy = dummy_n ? 1 : 0; dev->user.usr_dummy = dummy_n ? 1 : 0;
dev->user1.usr_dummy_cyclelen = dummy_n - 1; dev->user1.usr_dummy_cyclelen = dummy_n - 1;
} }
static inline void spi_flash_ll_set_cs_setup(spi_dev_t *dev, uint32_t cs_setup_time)
{
dev->user.cs_setup = (cs_setup_time > 0 ? 1 : 0);
dev->ctrl2.setup_time = cs_setup_time - 1;
}

View File

@ -38,6 +38,7 @@ esp_err_t spi_flash_hal_device_config(spi_flash_host_driver_t *host)
spi_flash_ll_reset(dev); spi_flash_ll_reset(dev);
spi_flash_ll_set_cs_pin(dev, drv_data->cs_num); spi_flash_ll_set_cs_pin(dev, drv_data->cs_num);
spi_flash_ll_set_clock(dev, &drv_data->clock_conf); spi_flash_ll_set_clock(dev, &drv_data->clock_conf);
spi_flash_ll_set_cs_setup(dev, 1);
/* /*
* workaround for the ROM: the ROM, as well as the OpenOCD, don't know the * workaround for the ROM: the ROM, as well as the OpenOCD, don't know the