Hi, first of all congrats on the great work! I've tested your libraries using reading tests and the results were very good.
However, do you have any idea why the write test wouldn't work on a Cypress
S25FL164K ?
The setup that I'm using is:
- ESP32D0WDQ6 chip
- S25FL164K 8MB external flash hooked-up on SPI via GPIO MUX
Code: Select all
#define PIN_SPI_MOSI GPIO_NUM_25 // PIN 5 - IO0 - DI
#define PIN_SPI_MISO GPIO_NUM_26 // PIN 2 - IO1 - DO
#define PIN_SPI_WP GPIO_NUM_13 // PIN 3 - IO2 - /WP
#define PIN_SPI_HD GPIO_NUM_14 // PIN 7 - IO3 - /HOLD - /RESET
#define PIN_SPI_SCK GPIO_NUM_27 // PIN 6 - CLK - CLK
#define PIN_SPI_SS GPIO_NUM_15 // PIN 1 - /CS - /CS
I've tried doing some debugging, but without any success.
I've made sure that I properly mapped the commands lists to my chip by analogy with
Winbond's chip (the majority of them were the same):
Code: Select all
//in extflash.h
#define CMD_WRITE_STATUS_REG1 0x01
#define CMD_PAGE_PROGRAM 0x02
#define CMD_READ_DATA 0x03
#define CMD_READ_STATUS_REG1 0x05
#define CMD_WRITE_ENABLE 0x06
#define CMD_FAST_READ 0x0b
#define CMD_SECTOR_ERASE 0x20
#define CMD_READ_SFDP 0x5a
#define CMD_ENABLE_RESET 0x66
#define CMD_RESET_DEVICE 0x99
#define CMD_READ_JEDEC_ID 0x9f
#define CMD_CHIP_ERASE 0xc7
Code: Select all
//in wb_w25q_base.h
#define CMD_WRITE_STATUS_REG2 0x01
#define CMD_READ_STATUS_REG2 0x35
#define CMD_ENTER_QPI_MODE 0x38
#define CMD_FAST_READ_DUAL_OUTPUT 0x3b
#define CMD_SR_WRITE_ENABLE 0x50
#define CMD_BLOCK_ERASE_32K 0x52
#define CMD_FAST_READ_QUAD_OUTPUT 0x6b
#define CMD_FAST_READ_DUAL_IO 0xbb
#define CMD_SET_READ_PARAMETERS 0xc0
#define CMD_BLOCK_ERASE_64K 0xd8
#define CMD_OCTAL_WORD_READ_QUAD_IO 0xe3
#define CMD_WORD_READ_QUAD_IO 0xe7
#define CMD_FAST_READ_QUAD_IO 0xeb
#define CMD_EXIT_QPI_MODE 0xff
I'm only running the
wb_w25q_dual test, but all of them fail.
While debugging I've printed the error messages to the console and they all return ESP_OK (this being 0):
Code: Select all
printf("Erase error code: %d \n",flash.erase_sector(addr / sector_sz));
printf("Write error code: %d \n",flash.write(addr, wbuf, sector_sz));
printf("Read error code: %d \n",flash.read(addr, rbuf, sector_sz));
Result:
Code: Select all
ERRASE/WRITE/VERIFY Test...
Bus
Proto Cycles
dual 1-1-2
Flash size 83388608
Sector size 4096
Erase error code: 0
Write error code: 0
Read error code: 0
addr = 0
erase/write/verify failed at block 0 offset 0
Done...