kopia lustrzana https://github.com/espressif/esp-idf
esp_psram: fixed 40mhz cs signal glitch issue
rodzic
91e6b5de70
commit
d08be42a53
|
@ -123,6 +123,17 @@ typedef enum {
|
||||||
#define PICO_V3_02_PSRAM_CLK_IO 10
|
#define PICO_V3_02_PSRAM_CLK_IO 10
|
||||||
#define PICO_V3_02_PSRAM_CS_IO 9
|
#define PICO_V3_02_PSRAM_CS_IO 9
|
||||||
|
|
||||||
|
#if CONFIG_SPIRAM_SPEED_40M && CONFIG_ESPTOOLPY_FLASHFREQ_40M
|
||||||
|
#define PSRAM_CS_HOLD_TIME 0
|
||||||
|
#elif CONFIG_SPIRAM_SPEED_40M && CONFIG_ESPTOOLPY_FLASHFREQ_80M
|
||||||
|
#define PSRAM_CS_HOLD_TIME 0
|
||||||
|
#elif CONFIG_SPIRAM_SPEED_80M && CONFIG_ESPTOOLPY_FLASHFREQ_80M
|
||||||
|
#define PSRAM_CS_HOLD_TIME 1
|
||||||
|
#else
|
||||||
|
#error "FLASH speed can only be equal to or higher than SRAM speed while SRAM is enabled!"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint8_t flash_clk_io;
|
uint8_t flash_clk_io;
|
||||||
uint8_t flash_cs_io;
|
uint8_t flash_cs_io;
|
||||||
|
@ -659,7 +670,7 @@ void psram_set_cs_timing(psram_spi_num_t spi_num, psram_clk_mode_t clk_mode)
|
||||||
if (clk_mode == PSRAM_CLK_MODE_NORM) {
|
if (clk_mode == PSRAM_CLK_MODE_NORM) {
|
||||||
SET_PERI_REG_MASK(SPI_USER_REG(spi_num), SPI_CS_HOLD_M | SPI_CS_SETUP_M);
|
SET_PERI_REG_MASK(SPI_USER_REG(spi_num), SPI_CS_HOLD_M | SPI_CS_SETUP_M);
|
||||||
// Set cs time.
|
// Set cs time.
|
||||||
SET_PERI_REG_BITS(SPI_CTRL2_REG(spi_num), SPI_HOLD_TIME_V, 1, SPI_HOLD_TIME_S);
|
SET_PERI_REG_BITS(SPI_CTRL2_REG(spi_num), SPI_HOLD_TIME_V, PSRAM_CS_HOLD_TIME, SPI_HOLD_TIME_S);
|
||||||
SET_PERI_REG_BITS(SPI_CTRL2_REG(spi_num), SPI_SETUP_TIME_V, 0, SPI_SETUP_TIME_S);
|
SET_PERI_REG_BITS(SPI_CTRL2_REG(spi_num), SPI_SETUP_TIME_V, 0, SPI_SETUP_TIME_S);
|
||||||
} else {
|
} else {
|
||||||
CLEAR_PERI_REG_MASK(SPI_USER_REG(spi_num), SPI_CS_HOLD_M | SPI_CS_SETUP_M);
|
CLEAR_PERI_REG_MASK(SPI_USER_REG(spi_num), SPI_CS_HOLD_M | SPI_CS_SETUP_M);
|
||||||
|
|
Ładowanie…
Reference in New Issue