Page 1 of 1

esp32 读取flash id函数

Posted: Fri Oct 06, 2023 8:55 am
by kalok_2022
esp32 读取flash id函数是哪个,有没有相关例子程序?

Re: esp32 读取flash id函数

Posted: Sat Oct 07, 2023 2:46 am
by ESP_Penguin_Helper
你可以参考这篇帖子:https://esp32.com/viewtopic.php?t=1481#p6739

Re: esp32 读取flash id函数

Posted: Wed Oct 11, 2023 7:23 am
by kalok_2022
ESP_Penguin_Helper wrote:
Sat Oct 07, 2023 2:46 am
你可以参考这篇帖子:https://esp32.com/viewtopic.php?t=1481#p6739
按照以上帖子添加了,编译显示以下错误:
../../../components/soc/esp32c3/include/soc/spi_reg.h:23:34: error: implicit declaration of function 'REG_SPI_BASE'; did you mean 'REG_I2S_BASE'? [-Werror=implicit-function-declaration]
23 | #define SPI_CMD_REG(i) (REG_SPI_BASE(i) + 0x0)
| ^~~~~~~~~~~~
../../../components/soc/esp32c3/include/soc/soc.h:29:34: note: in definition of macro 'ETS_UNCACHED_ADDR'
29 | #define ETS_UNCACHED_ADDR(addr) (addr)
| ^~~~
/home/esp/esp-idf/components/spi_flash/flash_ops.c:350:24: note: in expansion of macro 'READ_PERI_REG'
350 | while (READ_PERI_REG(SPI_CMD_REG(unit))&SPI_USR);
| ^~~~~~~~~~~~~
/home/esp/esp-idf/components/spi_flash/flash_ops.c:350:38: note: in expansion of macro 'SPI_CMD_REG'
350 | while (READ_PERI_REG(SPI_CMD_REG(unit))&SPI_USR);
| ^~~~~~~~~~~
/home/esp/esp-idf/components/spi_flash/flash_ops.c:353:31: error: implicit declaration of function 'SPI_MOSI_DLEN_REG'; did you mean 'SPI_MS_DLEN_REG'? [-Werror=implicit-function-declaration]
353 | SET_PERI_REG_BITS(SPI_MOSI_DLEN_REG(unit), SPI_USR_MOSI_DBITLEN, bits - 1, SPI_USR_MOSI_DBITLEN_S);
| ^~~~~~~~~~~~~~~~~
../../../components/soc/esp32c3/include/soc/soc.h:29:34: note: in definition of macro 'ETS_UNCACHED_ADDR'
29 | #define ETS_UNCACHED_ADDR(addr) (addr)
| ^~~~
../../../components/soc/esp32c3/include/soc/soc.h:124:13: note: in expansion of macro 'WRITE_PERI_REG'
124 | WRITE_PERI_REG((reg),(READ_PERI_REG(reg)&(~((bit_map)<<(shift))))|(((value) & (bit_map))<<(shift)) ); \
| ^~~~~~~~~~~~~~
/home/esp/esp-idf/components/spi_flash/flash_ops.c:353:13: note: in expansion of macro 'SET_PERI_REG_BITS'
353 | SET_PERI_REG_BITS(SPI_MOSI_DLEN_REG(unit), SPI_USR_MOSI_DBITLEN, bits - 1, SPI_USR_MOSI_DBITLEN_S);
| ^~~~~~~~~~~~~~~~~
/home/esp/esp-idf/components/spi_flash/flash_ops.c:353:56: error: 'SPI_USR_MOSI_DBITLEN' undeclared (first use in this function); did you mean 'SPI_MEM_USR_MOSI_DBITLEN'?
353 | SET_PERI_REG_BITS(SPI_MOSI_DLEN_REG(unit), SPI_USR_MOSI_DBITLEN, bits - 1, SPI_USR_MOSI_DBITLEN_S);
| ^~~~~~~~~~~~~~~~~~~~
../../../components/soc/esp32c3/include/soc/soc.h:99:76: note: in definition of macro 'WRITE_PERI_REG'
99 | (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val); \
| ^~~
/home/esp/esp-idf/components/spi_flash/flash_ops.c:353:13: note: in expansion of macro 'SET_PERI_REG_BITS'
353 | SET_PERI_REG_BITS(SPI_MOSI_DLEN_REG(unit), SPI_USR_MOSI_DBITLEN, bits - 1, SPI_USR_MOSI_DBITLEN_S);
| ^~~~~~~~~~~~~~~~~
/home/esp/esp-idf/components/spi_flash/flash_ops.c:353:56: note: each undeclared identifier is reported only once for each function it appears in
353 | SET_PERI_REG_BITS(SPI_MOSI_DLEN_REG(unit), SPI_USR_MOSI_DBITLEN, bits - 1, SPI_USR_MOSI_DBITLEN_S);
| ^~~~~~~~~~~~~~~~~~~~
../../../components/soc/esp32c3/include/soc/soc.h:99:76: note: in definition of macro 'WRITE_PERI_REG'
99 | (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val); \
| ^~~
/home/esp/esp-idf/components/spi_flash/flash_ops.c:353:13: note: in expansion of macro 'SET_PERI_REG_BITS'
353 | SET_PERI_REG_BITS(SPI_MOSI_DLEN_REG(unit), SPI_USR_MOSI_DBITLEN, bits - 1, SPI_USR_MOSI_DBITLEN_S);
| ^~~~~~~~~~~~~~~~~
/home/esp/esp-idf/components/spi_flash/flash_ops.c:353:88: error: 'SPI_USR_MOSI_DBITLEN_S' undeclared (first use in this function); did you mean 'SPI_MEM_USR_MOSI_DBITLEN_S'?
353 | SET_PERI_REG_BITS(SPI_MOSI_DLEN_REG(unit), SPI_USR_MOSI_DBITLEN, bits - 1, SPI_USR_MOSI_DBITLEN_S);
| ^~~~~~~~~~~~~~~~~~~~~~
../../../components/soc/esp32c3/include/soc/soc.h:99:76: note: in definition of macro 'WRITE_PERI_REG'
99 | (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val); \
| ^~~
/home/esp/esp-idf/components/spi_flash/flash_ops.c:353:13: note: in expansion of macro 'SET_PERI_REG_BITS'
353 | SET_PERI_REG_BITS(SPI_MOSI_DLEN_REG(unit), SPI_USR_MOSI_DBITLEN, bits - 1, SPI_USR_MOSI_DBITLEN_S);
| ^~~~~~~~~~~~~~~~~
/home/esp/esp-idf/components/spi_flash/flash_ops.c:354:31: error: implicit declaration of function 'SPI_MISO_DLEN_REG'; did you mean 'SPI_MS_DLEN_REG'? [-Werror=implicit-function-declaration]
354 | SET_PERI_REG_BITS(SPI_MISO_DLEN_REG(unit), SPI_USR_MISO_DBITLEN, bits - 1, SPI_USR_MISO_DBITLEN_S);
| ^~~~~~~~~~~~~~~~~
../../../components/soc/esp32c3/include/soc/soc.h:29:34: note: in definition of macro 'ETS_UNCACHED_ADDR'
29 | #define ETS_UNCACHED_ADDR(addr) (addr)
| ^~~~
../../../components/soc/esp32c3/include/soc/soc.h:124:13: note: in expansion of macro 'WRITE_PERI_REG'
124 | WRITE_PERI_REG((reg),(READ_PERI_REG(reg)&(~((bit_map)<<(shift))))|(((value) & (bit_map))<<(shift)) ); \
| ^~~~~~~~~~~~~~
/home/esp/esp-idf/components/spi_flash/flash_ops.c:354:13: note: in expansion of macro 'SET_PERI_REG_BITS'
354 | SET_PERI_REG_BITS(SPI_MISO_DLEN_REG(unit), SPI_USR_MISO_DBITLEN, bits - 1, SPI_USR_MISO_DBITLEN_S);
| ^~~~~~~~~~~~~~~~~
/home/esp/esp-idf/components/spi_flash/flash_ops.c:354:56: error: 'SPI_USR_MISO_DBITLEN' undeclared (first use in this function); did you mean 'SPI_MEM_USR_MISO_DBITLEN'?
354 | SET_PERI_REG_BITS(SPI_MISO_DLEN_REG(unit), SPI_USR_MISO_DBITLEN, bits - 1, SPI_USR_MISO_DBITLEN_S);
| ^~~~~~~~~~~~~~~~~~~~
../../../components/soc/esp32c3/include/soc/soc.h:99:76: note: in definition of macro 'WRITE_PERI_REG'
99 | (*((volatile uint32_t *)ETS_UNCACHED_ADDR(addr))) = (uint32_t)(val); \
| ^~~