1 /**************************************************************************/
4 @author K. Townsend (microBuilder.eu)
8 Software License Agreement (BSD License)
10 Copyright (c) 2010, microBuilder SARL
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 1. Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 2. Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 3. Neither the name of the copyright holders nor the
21 names of its contributors may be used to endorse or promote products
22 derived from this software without specific prior written permission.
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 /**************************************************************************/
40 #include "projectconfig.h"
42 #define W25Q16BV_MAXADDRESS 0x1FFFFF
43 #define W25Q16BV_PAGESIZE 256 // 256 bytes per programmable page
44 #define W25Q16BV_PAGES 8192 // 2,097,152 Bytes / 256 bytes per page
45 #define W25Q16BV_SECTORSIZE 4096 // 1 erase sector = 4096 bytes
46 #define W25Q16BV_SECTORS 512 // 2,097,152 Bytes / 4096 bytes per sector
47 #define W25Q16BV_MANUFACTURERID 0xEF // Used to validate read data
48 #define W25Q16BV_DEVICEID 0x14 // Used to validate read data
50 #define W25Q16BV_STAT1_BUSY 0x01 // Erase/Write in Progress
51 #define W25Q16BV_STAT1_WRTEN 0x02 // Write Enable Latch
52 #define W25Q16BV_STAT2_QUADENBL 0x02 // Quad Enable
53 #define W25Q16BV_STAT2_SSPNDSTAT 0x80 // Suspend Status
55 /**************************************************************************/
59 /**************************************************************************/
62 // Erase/Program Instructions
63 W25Q16BV_CMD_WRITEENABLE
= 0x06, // Write Enabled
64 W25Q16BV_CMD_WRITEDISABLE
= 0x04, // Write Disabled
65 W25Q16BV_CMD_READSTAT1
= 0x05, // Read Status Register 1
66 W25Q16BV_CMD_READSTAT2
= 0x35, // Read Status Register 2
67 W25Q16BV_CMD_WRITESTAT
= 0x01, // Write Status Register
68 W25Q16BV_CMD_PAGEPROG
= 0x02, // Page Program
69 W25Q16BV_CMD_QUADPAGEPROG
= 0x32, // Quad Page Program
70 W25Q16BV_CMD_SECTERASE4
= 0x20, // Sector Erase (4KB)
71 W25Q16BV_CMD_BLOCKERASE32
= 0x52, // Block Erase (32KB)
72 W25Q16BV_CMD_BLOCKERASE64
= 0xD8, // Block Erase (64KB)
73 W25Q16BV_CMD_CHIPERASE
= 0x60, // Chip Erase
74 W25Q16BV_CMD_ERASESUSPEND
= 0x75, // Erase Suspend
75 W25Q16BV_CMD_ERASERESUME
= 0x7A, // Erase Resume
76 W25Q16BV_CMD_POWERDOWN
= 0xB9, // Power Down
77 W25Q16BV_CMD_CRMR
= 0xFF, // Continuous Read Mode Reset
79 W25Q16BV_CMD_READDATA
= 0x03, // Read Data
80 W25Q16BV_CMD_FREAD
= 0x0B, // Fast Read
81 W25Q16BV_CMD_FREADDUALOUT
= 0x3B, // Fast Read Dual Output
82 W25Q16BV_CMD_FREADDUALIO
= 0xBB, // Fast Read Dual I/O
83 W25Q16BV_CMD_FREADQUADOUT
= 0x6B, // Fast Read Quad Output
84 W25Q16BV_CMD_FREADQUADIO
= 0xEB, // Fast Read Quad I/O
85 W25Q16BV_CMD_WREADQUADIO
= 0xE7, // Word Read Quad I/O
86 W25Q16BV_CMD_OWREADQUADIO
= 0xE3, // Octal Word Read Quad I/O
87 // ID/Security Instructions
88 W25Q16BV_CMD_RPWRDDEVID
= 0xAB, // Release Power Down/Device ID
89 W25Q16BV_CMD_MANUFDEVID
= 0x90, // Manufacturer/Device ID
90 W25Q16BV_CMD_MANUFDEVID2
= 0x92, // Manufacturer/Device ID by Dual I/O
91 W25Q16BV_CMD_MANUFDEVID4
= 0x94, // Manufacturer/Device ID by Quad I/O
92 W25Q16BV_CMD_JEDECID
= 0x9F, // JEDEC ID
93 W25Q16BV_CMD_READUNIQUEID
= 0x4B // Read Unique ID
94 } w25q16bv_Commands_e
;