Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加两个大容量Flash配置信息:[W25Q512JV、W25Q01JV] #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
|[W25Q64CV](http://www.winbond.com/resource-files/w25q64cv_revh_052214[2].pdf)|Winbond|64Mb|80Mhz|支持|四线||
|[W25Q128BV](http://www.winbond.com/resource-files/w25q128bv_revh_100313_wo_automotive.pdf)|Winbond|128Mb|104Mhz|支持|四线||
|[W25Q256FV](http://www.winbond.com/resource-files/w25q256fv%20revi%2002262016%20kms.pdf)|Winbond|256Mb|104Mhz|支持|四线||
|[W25Q512JV](https://www.winbond.com/resource-files/W25Q512JV%20SPI%20RevG%2001122022Plus.pdf)|Winbond|512Mb|133Mhz|支持|四线| 似乎不支持SFUD 请不要开启|
|[W25Q01JV](https://www.winbond.com/resource-files/W25Q01JV%20SPI%20RevC%2005032021%20Plus%20dummy.pdf)|Winbond|1024Mb|133Mhz|支持|四线|似乎不支持SFUD 请不要开启|
|[MX25L3206E](http://www.macronix.com/Lists/DataSheet/Attachments/3199/MX25L3206E,%203V,%2032Mb,%20v1.5.pdf)|Macronix|32Mb|86MHz|支持|双线||
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • 这里的备注是不是改为 SFDP?
  • 我看下这些 Flash 是支持 SFDP 的
    image

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果用sfdp的话,默认读到的instruction是spi 3byte模式的

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那需要再深入查下手册的,你先把备注改好?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

备注这块 我就写 暂未验证sfdp咯,可能会有问题 如何?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

似乎不支持SFUD 请不要开启

是不是改为 "似乎不支持SFDP 请不要开启"

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

手册:
image
所以问题就是SFDP默认读到的命令会和这个寄存器的设置相关吗?

前边W25Q256FV与W25Q256/512/01/02JV都有相似的设计,既然Q256xV能够支持SFDP,后续这些型号没有道理不支持。

后面我有条件可能会做下测试。

|[KH25L4006E](http://www.macronix.com.hk/Lists/Datasheet/Attachments/117/KH25L4006E.pdf)|Macronix|4Mb|86Mhz|支持|未测试| by [JiapengLi](https://github.com/JiapengLi)|
|[KH25L3206E](http://www.macronix.com.hk/Lists/Datasheet/Attachments/131/KH25L3206E.pdf)|Macronix|32Mb|86Mhz|支持|双线||
Expand Down
20 changes: 20 additions & 0 deletions sfud/inc/sfud_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ if (!(EXPR)) \
#define SFUD_CMD_PAGE_PROGRAM 0x02
#endif

#ifndef SFUD_CMD_PAGE_PROGRAM_4_BYTES_MODE
#define SFUD_CMD_PAGE_PROGRAM_4_BYTES_MODE 0x12
#endif

#ifndef SFUD_CMD_AAI_WORD_PROGRAM
#define SFUD_CMD_AAI_WORD_PROGRAM 0xAD
#endif
Expand All @@ -122,18 +126,34 @@ if (!(EXPR)) \
#define SFUD_CMD_DUAL_OUTPUT_READ_DATA 0x3B
#endif

#ifndef SFUD_CMD_DUAL_OUTPUT_READ_DATA_4_BYTES_MODE
#define SFUD_CMD_DUAL_OUTPUT_READ_DATA_4_BYTES_MODE 0x3C
#endif

#ifndef SFUD_CMD_DUAL_IO_READ_DATA
#define SFUD_CMD_DUAL_IO_READ_DATA 0xBB
#endif

#ifndef SFUD_CMD_DUAL_IO_READ_DATA_4_BYTES_MODE
#define SFUD_CMD_DUAL_IO_READ_DATA_4_BYTES_MODE 0xBC
#endif

#ifndef SFUD_CMD_QUAD_IO_READ_DATA
#define SFUD_CMD_QUAD_IO_READ_DATA 0xEB
#endif

#ifndef SFUD_CMD_QUAD_IO_READ_DATA_4_BYTES_MODE
#define SFUD_CMD_QUAD_IO_READ_DATA_4_BYTES_MODE 0xEC
#endif

#ifndef SFUD_CMD_QUAD_OUTPUT_READ_DATA
#define SFUD_CMD_QUAD_OUTPUT_READ_DATA 0x6B
#endif

#ifndef SFUD_CMD_QUAD_OUTPUT_READ_DATA_4_BYTES_MODE
#define SFUD_CMD_QUAD_OUTPUT_READ_DATA_4_BYTES_MODE 0x6C
#endif

#ifndef SFUD_CMD_MANUFACTURER_DEVICE_ID
#define SFUD_CMD_MANUFACTURER_DEVICE_ID 0x90
#endif
Expand Down
6 changes: 6 additions & 0 deletions sfud/inc/sfud_flash_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ typedef struct {
{"W25Q64DW", SFUD_MF_ID_WINBOND, 0x60, 0x17, 8L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
{"W25Q128BV", SFUD_MF_ID_WINBOND, 0x40, 0x18, 16L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
{"W25Q256FV", SFUD_MF_ID_WINBOND, 0x40, 0x19, 32L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
{"W25Q512JV", SFUD_MF_ID_WINBOND, 0x40, 0x20, 64L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
{"W25Q01JV", SFUD_MF_ID_WINBOND, 0x40, 0x21, 128L*1024L*1024L, SFUD_WM_PAGE_256B, 4096, 0x20}, \
{"SST25VF080B", SFUD_MF_ID_SST, 0x25, 0x8E, 1L*1024L*1024L, SFUD_WM_BYTE|SFUD_WM_AAI, 4096, 0x20}, \
{"SST25VF016B", SFUD_MF_ID_SST, 0x25, 0x41, 2L*1024L*1024L, SFUD_WM_BYTE|SFUD_WM_AAI, 4096, 0x20}, \
{"M25P32", SFUD_MF_ID_MICRON, 0x20, 0x16, 4L*1024L*1024L, SFUD_WM_PAGE_256B, 64L*1024L, 0xD8}, \
Expand Down Expand Up @@ -170,6 +172,10 @@ typedef struct {
{SFUD_MF_ID_WINBOND, 0x40, 0x18, NORMAL_SPI_READ|DUAL_OUTPUT|DUAL_IO|QUAD_OUTPUT|QUAD_IO}, \
/* W25Q256FV */ \
{SFUD_MF_ID_WINBOND, 0x40, 0x19, NORMAL_SPI_READ|DUAL_OUTPUT|DUAL_IO|QUAD_OUTPUT|QUAD_IO}, \
/* W25Q512JV */ \
{SFUD_MF_ID_WINBOND, 0x40, 0x20, NORMAL_SPI_READ|DUAL_OUTPUT|DUAL_IO|QUAD_OUTPUT|QUAD_IO}, \
/* W25Q01JV */ \
{SFUD_MF_ID_WINBOND, 0x40, 0x21, NORMAL_SPI_READ|DUAL_OUTPUT|DUAL_IO|QUAD_OUTPUT|QUAD_IO}, \
/* EN25Q32B */ \
{SFUD_MF_ID_EON, 0x30, 0x16, NORMAL_SPI_READ|DUAL_OUTPUT|QUAD_IO}, \
/* S25FL216K */ \
Expand Down
85 changes: 70 additions & 15 deletions sfud/src/sfud.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,23 @@ const sfud_flash *sfud_get_device_table(void) {
}

#ifdef SFUD_USING_QSPI
/***
* QSPI Set Read Command Format
* @param flash
* @param ins
* @param ins_lines
* @param addr_lines
* @param dummy_cycles
* @param data_lines
*/
static void qspi_set_read_cmd_format(sfud_flash *flash, uint8_t ins, uint8_t ins_lines, uint8_t addr_lines,
uint8_t dummy_cycles, uint8_t data_lines) {
/* if medium size greater than 16Mb, use 4-Byte address, instruction should be added one */

flash->read_cmd_format.instruction = ins;
/* if medium size greater than 16MB(128Mbit), use 4-Byte address, instruction should be added one */
if (flash->chip.capacity <= 0x1000000) {
flash->read_cmd_format.instruction = ins;
flash->read_cmd_format.address_size = 24;
} else {
flash->read_cmd_format.instruction = ins + 1;
flash->read_cmd_format.address_size = 32;
}

Expand Down Expand Up @@ -217,21 +226,67 @@ sfud_err sfud_qspi_fast_read_enable(sfud_flash *flash, uint8_t data_line_width)
qspi_set_read_cmd_format(flash, SFUD_CMD_READ_DATA, 1, 1, 0, 1);
break;
case 2:
if (read_mode & DUAL_IO) {
qspi_set_read_cmd_format(flash, SFUD_CMD_DUAL_IO_READ_DATA, 1, 2, 8, 2);
} else if (read_mode & DUAL_OUTPUT) {
qspi_set_read_cmd_format(flash, SFUD_CMD_DUAL_OUTPUT_READ_DATA, 1, 1, 8, 2);
} else {
qspi_set_read_cmd_format(flash, SFUD_CMD_READ_DATA, 1, 1, 0, 1);
if (flash->addr_in_4_byte)
{
if (read_mode & DUAL_IO)
{
qspi_set_read_cmd_format(flash, SFUD_CMD_DUAL_IO_READ_DATA_4_BYTES_MODE, 1, 2, 4, 2);
}
else if (read_mode & DUAL_OUTPUT)
{
qspi_set_read_cmd_format(flash, SFUD_CMD_DUAL_OUTPUT_READ_DATA_4_BYTES_MODE, 1, 1, 8, 2);
}
else
{
qspi_set_read_cmd_format(flash, SFUD_CMD_READ_DATA, 1, 1, 0, 1);
}
}
else
{
if (read_mode & DUAL_IO)
{
qspi_set_read_cmd_format(flash, SFUD_CMD_DUAL_IO_READ_DATA, 1, 2, 4, 2);
}
else if (read_mode & DUAL_OUTPUT)
{
qspi_set_read_cmd_format(flash, SFUD_CMD_DUAL_OUTPUT_READ_DATA, 1, 1, 8, 2);
}
else
{
qspi_set_read_cmd_format(flash, SFUD_CMD_READ_DATA, 1, 1, 0, 1);
}
}
break;
case 4:
if (read_mode & QUAD_IO) {
qspi_set_read_cmd_format(flash, SFUD_CMD_QUAD_IO_READ_DATA, 1, 4, 6, 4);
} else if (read_mode & QUAD_OUTPUT) {
qspi_set_read_cmd_format(flash, SFUD_CMD_QUAD_OUTPUT_READ_DATA, 1, 1, 8, 4);
} else {
qspi_set_read_cmd_format(flash, SFUD_CMD_READ_DATA, 1, 1, 0, 1);
if (flash->addr_in_4_byte)
{
if (read_mode & QUAD_IO)
{
qspi_set_read_cmd_format(flash, SFUD_CMD_QUAD_IO_READ_DATA_4_BYTES_MODE, 1, 4, 6, 4);
}
else if (read_mode & QUAD_OUTPUT)
{
qspi_set_read_cmd_format(flash, SFUD_CMD_QUAD_OUTPUT_READ_DATA_4_BYTES_MODE, 1, 1, 8, 4);
}
else
{
qspi_set_read_cmd_format(flash, SFUD_CMD_READ_DATA, 1, 1, 0, 1);
}
}
else
{
if (read_mode & QUAD_IO)
{
qspi_set_read_cmd_format(flash, SFUD_CMD_QUAD_IO_READ_DATA, 1, 4, 6, 4);
}
else if (read_mode & QUAD_OUTPUT)
{
qspi_set_read_cmd_format(flash, SFUD_CMD_QUAD_OUTPUT_READ_DATA, 1, 1, 8, 4);
}
else
{
qspi_set_read_cmd_format(flash, SFUD_CMD_READ_DATA, 1, 1, 0, 1);
}
}
break;
}
Expand Down