mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
spi_flash: fix cs line setup to make the flash driver more stable
This commit is contained in:
parent
b7c8288056
commit
a212d866f4
@ -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;
|
||||||
|
}
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user