nimaltd / spif

W25qxx, N25Qxx and other SPI FLASH driver for stm32 HAL
GNU General Public License v3.0
594 stars 173 forks source link

Judgment of w25q512 #12

Closed nopnop2002 closed 3 years ago

nopnop2002 commented 4 years ago

Hello.

W25qxx_ReadID() issues a 0x9f command to read the JEDEC ID.

The judgment of w25q512 is based on JEDEC ID.

        case 0x401A:    //  w25q512
            w25qxx.ID=W25Q512;
            w25qxx.BlockCount=1024;
            #if (_W25QXX_DEBUG==1)
            printf("w25qxx Chip: w25q512\r\n");
            #endif
        break;

There is W25Q512JV datasheet. https://www.winbond.com/resource-files/W25Q512JV%20SPI%20RevB%2006252019%20KMS.pdf

In page24, JEDEC ID of W25Q512JV is 4020h.

Is this a datasheet mistake?

Is it not necessary to issue B7H (Enter 4-byte address mode) for W25Q256 and W25Q512?

W25Q512 datasheet description:

Upon power up, the W25Q512JV can operate in either 3-Byte Address Mode or 4-Byte Address Mode, depending on the Non-Volatile Status Register Bit ADP (S17) setting. 
If ADP=0, the device will operate in 3-Byte Address Mode; if ADP=1, the device will operate in 4-Byte Address Mode. 
The factory default value for ADP is 0. 
To switch between the 3-Byte or 4-Byte Address Modes, “Enter 4-Byte Mode (B7h)” or “Exit 4-Byte Mode (E9h)” instructions must be used. 
The current address mode is indicated by the Status Register Bit ADS (S16). 
jong950715 commented 3 years ago

I have same issue with w25q128. ID0-15 of w25q128 is 0x7018 in datasheet. so I changed code like:

case 0x4018: // w25q128 --> case 0x7018: // w25q128

And it works properly.

nimaltd commented 3 years ago

Hello. thank you for mention it. I edited files.

nopnop2002 commented 3 years ago

@nimaltd

W25 has several variations.

w25q128jv is 0x7018

https://datasheet.lcsc.com/szlcsc/Winbond-Elec-W25Q128JVFIQ_C111478.pdf

w25q128fv is 0x4018

https://www.pjrc.com/teensy/W25Q128FV.pdf