SPI Flash AT45DBXXXD
Fork of at45db161d by
at45db161d_commands.h@6:1872f591d604, 2015-03-06 (annotated)
- Committer:
- LeoHsueh
- Date:
- Fri Mar 06 09:42:28 2015 +0800
- Revision:
- 6:1872f591d604
- Parent:
- 0:2e953bbaf3a5
Format code.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
okini3939 | 0:2e953bbaf3a5 | 1 | /** |
okini3939 | 0:2e953bbaf3a5 | 2 | * @file at45db161d_commands.h |
okini3939 | 0:2e953bbaf3a5 | 3 | * @brief AT45DB161D commands opcodes |
okini3939 | 0:2e953bbaf3a5 | 4 | **/ |
okini3939 | 0:2e953bbaf3a5 | 5 | #ifndef AT45DB161D_COMMANDS_H |
okini3939 | 0:2e953bbaf3a5 | 6 | #define AT45DB161D_COMMANDS_H |
okini3939 | 0:2e953bbaf3a5 | 7 | |
okini3939 | 0:2e953bbaf3a5 | 8 | /** |
okini3939 | 0:2e953bbaf3a5 | 9 | * @defgroup AT45DB161D_commands AT45DB161D commands opcodes |
okini3939 | 0:2e953bbaf3a5 | 10 | **/ |
okini3939 | 0:2e953bbaf3a5 | 11 | |
okini3939 | 0:2e953bbaf3a5 | 12 | /** |
okini3939 | 0:2e953bbaf3a5 | 13 | * @defgroup Read_commands Read commands |
okini3939 | 0:2e953bbaf3a5 | 14 | **/ |
okini3939 | 0:2e953bbaf3a5 | 15 | /** Main Memory Page Read */ |
okini3939 | 0:2e953bbaf3a5 | 16 | #define AT45DB161D_PAGE_READ 0xD2 |
okini3939 | 0:2e953bbaf3a5 | 17 | /** Continuous Array Read (Low Frequency) **/ |
okini3939 | 0:2e953bbaf3a5 | 18 | #define AT45DB161D_CONTINUOUS_READ_LOW_FREQ 0x03 |
LeoHsueh |
6:1872f591d604 | 19 | /** Continuous Array Read (High Frequency) **/ |
okini3939 | 0:2e953bbaf3a5 | 20 | #define AT45DB161D_CONTINUOUS_READ_HIGH_FREQ 0x0B |
okini3939 | 0:2e953bbaf3a5 | 21 | /** Buffer 1 Read (Low Frequency) **/ |
okini3939 | 0:2e953bbaf3a5 | 22 | #define AT45DB161D_BUFFER_1_READ_LOW_FREQ 0xD1 |
okini3939 | 0:2e953bbaf3a5 | 23 | /** Buffer 2 Read (Low Frequency) **/ |
okini3939 | 0:2e953bbaf3a5 | 24 | #define AT45DB161D_BUFFER_2_READ_LOW_FREQ 0xD3 |
okini3939 | 0:2e953bbaf3a5 | 25 | /** Buffer 1 Read **/ |
okini3939 | 0:2e953bbaf3a5 | 26 | #define AT45DB161D_BUFFER_1_READ 0xD4 |
okini3939 | 0:2e953bbaf3a5 | 27 | /** Buffer 2 Read **/ |
okini3939 | 0:2e953bbaf3a5 | 28 | #define AT45DB161D_BUFFER_2_READ 0xD6 |
okini3939 | 0:2e953bbaf3a5 | 29 | |
okini3939 | 0:2e953bbaf3a5 | 30 | /** |
okini3939 | 0:2e953bbaf3a5 | 31 | * @defgroup Program_Erase_commands Program and Erase commands |
okini3939 | 0:2e953bbaf3a5 | 32 | **/ |
okini3939 | 0:2e953bbaf3a5 | 33 | /** Buffer 1 Write **/ |
okini3939 | 0:2e953bbaf3a5 | 34 | #define AT45DB161D_BUFFER_1_WRITE 0x84 |
okini3939 | 0:2e953bbaf3a5 | 35 | /** Buffer 2 Write **/ |
okini3939 | 0:2e953bbaf3a5 | 36 | #define AT45DB161D_BUFFER_2_WRITE 0x87 |
okini3939 | 0:2e953bbaf3a5 | 37 | /** Buffer 1 to Main Memory Page Program with Built-in Erase **/ |
okini3939 | 0:2e953bbaf3a5 | 38 | #define AT45DB161D_BUFFER_1_TO_PAGE_WITH_ERASE 0x83 |
okini3939 | 0:2e953bbaf3a5 | 39 | /** Buffer 2 to Main Memory Page Program with Built-in Erase **/ |
okini3939 | 0:2e953bbaf3a5 | 40 | #define AT45DB161D_BUFFER_2_TO_PAGE_WITH_ERASE 0x86 |
okini3939 | 0:2e953bbaf3a5 | 41 | /** Buffer 1 to Main Memory Page Program without Built-in Erase **/ |
okini3939 | 0:2e953bbaf3a5 | 42 | #define AT45DB161D_BUFFER_1_TO_PAGE_WITHOUT_ERASE 0x88 |
okini3939 | 0:2e953bbaf3a5 | 43 | /** Buffer 2 to Main Memory Page Program without Built-in Erase **/ |
okini3939 | 0:2e953bbaf3a5 | 44 | #define AT45DB161D_BUFFER_2_TO_PAGE_WITHOUT_ERASE 0x89 |
okini3939 | 0:2e953bbaf3a5 | 45 | /** Page Erase **/ |
okini3939 | 0:2e953bbaf3a5 | 46 | #define AT45DB161D_PAGE_ERASE 0x81 |
okini3939 | 0:2e953bbaf3a5 | 47 | /** Block Erase **/ |
okini3939 | 0:2e953bbaf3a5 | 48 | #define AT45DB161D_BLOCK_ERASE 0x50 |
okini3939 | 0:2e953bbaf3a5 | 49 | /** Sector Erase **/ |
okini3939 | 0:2e953bbaf3a5 | 50 | #define AT45DB161D_SECTOR_ERASE 0x7C |
okini3939 | 0:2e953bbaf3a5 | 51 | /** Chip Erase Sequence **/ |
okini3939 | 0:2e953bbaf3a5 | 52 | #define AT45DB161D_CHIP_ERASE_0 0xC7 |
okini3939 | 0:2e953bbaf3a5 | 53 | #define AT45DB161D_CHIP_ERASE_1 0x94 |
okini3939 | 0:2e953bbaf3a5 | 54 | #define AT45DB161D_CHIP_ERASE_2 0x80 |
okini3939 | 0:2e953bbaf3a5 | 55 | #define AT45DB161D_CHIP_ERASE_3 0x9A |
okini3939 | 0:2e953bbaf3a5 | 56 | /** Main Memory Page Program Through Buffer 1 **/ |
okini3939 | 0:2e953bbaf3a5 | 57 | #define AT45DB161D_PAGE_THROUGH_BUFFER_1 0x82 |
okini3939 | 0:2e953bbaf3a5 | 58 | /** Main Memory Page Program Through Buffer 2 **/ |
okini3939 | 0:2e953bbaf3a5 | 59 | #define AT45DB161D_PAGE_THROUGH_BUFFER_2 0x85 |
okini3939 | 0:2e953bbaf3a5 | 60 | |
okini3939 | 0:2e953bbaf3a5 | 61 | /** |
okini3939 | 0:2e953bbaf3a5 | 62 | * @defgroup ProtectionSecurity_Commands Protection and Security Commands |
okini3939 | 0:2e953bbaf3a5 | 63 | * @warning UNIMPLEMENTED |
okini3939 | 0:2e953bbaf3a5 | 64 | **/ |
okini3939 | 0:2e953bbaf3a5 | 65 | #ifdef AT45DB161D_EXPERT_MODE |
okini3939 | 0:2e953bbaf3a5 | 66 | /* Use the following commands at your own risk ! */ |
okini3939 | 0:2e953bbaf3a5 | 67 | /** Enable Sector Protection **/ |
okini3939 | 0:2e953bbaf3a5 | 68 | #define AT45DB161D_ENABLE_SECTOR_PROTECTION_0 0x3D |
okini3939 | 0:2e953bbaf3a5 | 69 | #define AT45DB161D_ENABLE_SECTOR_PROTECTION_1 0x2A |
okini3939 | 0:2e953bbaf3a5 | 70 | #define AT45DB161D_ENABLE_SECTOR_PROTECTION_2 0x7F |
okini3939 | 0:2e953bbaf3a5 | 71 | #define AT45DB161D_ENABLE_SECTOR_PROTECTION_3 0xA9 |
okini3939 | 0:2e953bbaf3a5 | 72 | /** Disable Sector Protection **/ |
okini3939 | 0:2e953bbaf3a5 | 73 | #define AT45DB161D_DISABLE_SECTOR_PROTECTION_0 0x3D |
okini3939 | 0:2e953bbaf3a5 | 74 | #define AT45DB161D_DISABLE_SECTOR_PROTECTION_1 0x2A |
okini3939 | 0:2e953bbaf3a5 | 75 | #define AT45DB161D_DISABLE_SECTOR_PROTECTION_2 0x7F |
okini3939 | 0:2e953bbaf3a5 | 76 | #define AT45DB161D_DISABLE_SECTOR_PROTECTION_3 0x9A |
okini3939 | 0:2e953bbaf3a5 | 77 | /** Erase Sector Protection Register **/ |
okini3939 | 0:2e953bbaf3a5 | 78 | #define AT45DB161D_ERASE_SECTOR_PROTECTION_REGISTER_0 0x3D |
okini3939 | 0:2e953bbaf3a5 | 79 | #define AT45DB161D_ERASE_SECTOR_PROTECTION_REGISTER_0 0x2A |
okini3939 | 0:2e953bbaf3a5 | 80 | #define AT45DB161D_ERASE_SECTOR_PROTECTION_REGISTER_0 0x7F |
okini3939 | 0:2e953bbaf3a5 | 81 | #define AT45DB161D_ERASE_SECTOR_PROTECTION_REGISTER_0 0xCF |
okini3939 | 0:2e953bbaf3a5 | 82 | /** Program Sector Protection Register **/ |
okini3939 | 0:2e953bbaf3a5 | 83 | #define AT45DB161D_PROGRAM_SECTOR_PROTECTION_REGISTER_0 0x3D |
okini3939 | 0:2e953bbaf3a5 | 84 | #define AT45DB161D_PROGRAM_SECTOR_PROTECTION_REGISTER_1 0x2A |
okini3939 | 0:2e953bbaf3a5 | 85 | #define AT45DB161D_PROGRAM_SECTOR_PROTECTION_REGISTER_2 0x7F |
okini3939 | 0:2e953bbaf3a5 | 86 | #define AT45DB161D_PROGRAM_SECTOR_PROTECTION_REGISTER_3 0xFC |
okini3939 | 0:2e953bbaf3a5 | 87 | /** Sector Lockdown **/ |
okini3939 | 0:2e953bbaf3a5 | 88 | #define AT45DB161D_SECTOR_LOCKDOWN_0 0X3D |
okini3939 | 0:2e953bbaf3a5 | 89 | #define AT45DB161D_SECTOR_LOCKDOWN_1 0x2A |
okini3939 | 0:2e953bbaf3a5 | 90 | #define AT45DB161D_SECTOR_LOCKDOWN_2 0x7F |
okini3939 | 0:2e953bbaf3a5 | 91 | #define AT45DB161D_SECTOR_LOCKDOWN_3 0x30 |
okini3939 | 0:2e953bbaf3a5 | 92 | /** Program Security Register **/ |
okini3939 | 0:2e953bbaf3a5 | 93 | #define AT45DB161D_PROGRAM_SECURITY_REGISTER_0 0x9B |
okini3939 | 0:2e953bbaf3a5 | 94 | #define AT45DB161D_PROGRAM_SECURITY_REGISTER_1 0x00 |
okini3939 | 0:2e953bbaf3a5 | 95 | #define AT45DB161D_PROGRAM_SECURITY_REGISTER_2 0x00 |
okini3939 | 0:2e953bbaf3a5 | 96 | #define AT45DB161D_PROGRAM_SECURITY_REGISTER_3 0x00 |
okini3939 | 0:2e953bbaf3a5 | 97 | #endif /* AT45DB161D_EXPERT_MODE */ |
okini3939 | 0:2e953bbaf3a5 | 98 | |
okini3939 | 0:2e953bbaf3a5 | 99 | /** Read Sector Protection Register **/ |
okini3939 | 0:2e953bbaf3a5 | 100 | #define AT45DB161D_READ_SECTOR_PROTECTION_REGISTER 0x32 |
okini3939 | 0:2e953bbaf3a5 | 101 | /** Read Sector Lockdown Register **/ |
okini3939 | 0:2e953bbaf3a5 | 102 | #define AT45DB161D_READ_SECTOR_LOCKDOWN_REGISTER 35H |
okini3939 | 0:2e953bbaf3a5 | 103 | /** Read Security Register **/ |
okini3939 | 0:2e953bbaf3a5 | 104 | #define AT45DB161D_READ_SECURITY_REGISTER 0x77 |
okini3939 | 0:2e953bbaf3a5 | 105 | |
okini3939 | 0:2e953bbaf3a5 | 106 | /** |
okini3939 | 0:2e953bbaf3a5 | 107 | * @defgroup Additional_commands Additional Commands |
okini3939 | 0:2e953bbaf3a5 | 108 | **/ |
okini3939 | 0:2e953bbaf3a5 | 109 | /** Main Memory Page to Buffer 1 Transfer **/ |
okini3939 | 0:2e953bbaf3a5 | 110 | #define AT45DB161D_TRANSFER_PAGE_TO_BUFFER_1 0x53 |
okini3939 | 0:2e953bbaf3a5 | 111 | /** Main Memory Page to Buffer 2 Transfer **/ |
okini3939 | 0:2e953bbaf3a5 | 112 | #define AT45DB161D_TRANSFER_PAGE_TO_BUFFER_2 0x55 |
okini3939 | 0:2e953bbaf3a5 | 113 | /** Main Memory Page to Buffer 1 Compare **/ |
okini3939 | 0:2e953bbaf3a5 | 114 | #define AT45DB161D_COMPARE_PAGE_TO_BUFFER_1 0x60 |
okini3939 | 0:2e953bbaf3a5 | 115 | /** Main Memory Page to Buffer 2 Compare **/ |
okini3939 | 0:2e953bbaf3a5 | 116 | #define AT45DB161D_COMPARE_PAGE_TO_BUFFER_2 0x61 |
okini3939 | 0:2e953bbaf3a5 | 117 | /** Auto Page Rewrite through Buffer 1 **/ |
okini3939 | 0:2e953bbaf3a5 | 118 | #define AT45DB161D_AUTO_PAGE_REWRITE_THROUGH_BUFFER_1 0x58 |
okini3939 | 0:2e953bbaf3a5 | 119 | /** Auto Page Rewrite through Buffer 2 **/ |
okini3939 | 0:2e953bbaf3a5 | 120 | #define AT45DB161D_AUTO_PAGE_REWRITE_THROUGH_BUFFER_2 0x59 |
okini3939 | 0:2e953bbaf3a5 | 121 | /** Deep Power-down **/ |
okini3939 | 0:2e953bbaf3a5 | 122 | #define AT45DB161D_DEEP_POWER_DOWN 0xB9 |
okini3939 | 0:2e953bbaf3a5 | 123 | /** Resume from Deep Power-down **/ |
okini3939 | 0:2e953bbaf3a5 | 124 | #define AT45DB161D_RESUME_FROM_DEEP_POWER_DOWN 0xAB |
okini3939 | 0:2e953bbaf3a5 | 125 | /** Status Register Read **/ |
okini3939 | 0:2e953bbaf3a5 | 126 | #define AT45DB161D_STATUS_REGISTER_READ 0xD7 |
okini3939 | 0:2e953bbaf3a5 | 127 | /** Manufacturer and Device ID Read **/ |
okini3939 | 0:2e953bbaf3a5 | 128 | #define AT45DB161D_READ_MANUFACTURER_AND_DEVICE_ID 0x9F |
okini3939 | 0:2e953bbaf3a5 | 129 | |
okini3939 | 0:2e953bbaf3a5 | 130 | /** |
okini3939 | 0:2e953bbaf3a5 | 131 | * @defgroup Legacy_commands Legacy Commands |
okini3939 | 0:2e953bbaf3a5 | 132 | **/ |
okini3939 | 0:2e953bbaf3a5 | 133 | /** Buffer 1 Read **/ |
okini3939 | 0:2e953bbaf3a5 | 134 | #define AT45DB161D_BUFFER_1_READ_LEGACY 0X54 |
okini3939 | 0:2e953bbaf3a5 | 135 | /** Buffer 2 Read **/ |
okini3939 | 0:2e953bbaf3a5 | 136 | #define AT45DB161D_BUFFER_2_READ_LEGACY 0x56 |
okini3939 | 0:2e953bbaf3a5 | 137 | /** Main Memory Page Read **/ |
okini3939 | 0:2e953bbaf3a5 | 138 | #define AT45DB161D_PAGE_READ_LEGACY 0x52 |
okini3939 | 0:2e953bbaf3a5 | 139 | /** Continuous Array Read **/ |
okini3939 | 0:2e953bbaf3a5 | 140 | #define AT45DB161D_CONTINUOUS_READ_LEGACY 0x68 |
okini3939 | 0:2e953bbaf3a5 | 141 | /** Status Register Read **/ |
okini3939 | 0:2e953bbaf3a5 | 142 | #define AT45DB161D_STATUS_REGISTER_READ_LEGACY 0x57 |
okini3939 | 0:2e953bbaf3a5 | 143 | |
okini3939 | 0:2e953bbaf3a5 | 144 | /** |
LeoHsueh |
6:1872f591d604 | 145 | * defgroup STATUS_REGISTER_FORMAT Status register format |
LeoHsueh |
6:1872f591d604 | 146 | * |
LeoHsueh |
6:1872f591d604 | 147 | **/ |
LeoHsueh |
6:1872f591d604 | 148 | /** |
LeoHsueh |
6:1872f591d604 | 149 | * Ready/busy status is indicated using bit 7 of the status register. |
LeoHsueh |
6:1872f591d604 | 150 | * If bit 7 is a 1, then the device is not busy and is ready to accept |
LeoHsueh |
6:1872f591d604 | 151 | * the next command. If bit 7 is a 0, then the device is in a busy |
LeoHsueh |
6:1872f591d604 | 152 | * state. |
LeoHsueh |
6:1872f591d604 | 153 | **/ |
LeoHsueh |
6:1872f591d604 | 154 | #define READY_BUSY 0x80 |
LeoHsueh |
6:1872f591d604 | 155 | /** |
LeoHsueh |
6:1872f591d604 | 156 | * Result of the most recent Memory Page to Buffer Compare operation. |
LeoHsueh |
6:1872f591d604 | 157 | * If this bit is equal to 0, then the data in the main memory page |
LeoHsueh |
6:1872f591d604 | 158 | * matches the data in the buffer. If it's 1 then at least 1 byte in |
LeoHsueh |
6:1872f591d604 | 159 | * the main memory page does not match the data in the buffer. |
okini3939 | 0:2e953bbaf3a5 | 160 | **/ |
LeoHsueh |
6:1872f591d604 | 161 | #define COMPARE 0x40 |
LeoHsueh |
6:1872f591d604 | 162 | /** |
LeoHsueh |
6:1872f591d604 | 163 | * Bit 1 in the Status Register is used to provide information to the |
LeoHsueh |
6:1872f591d604 | 164 | * user whether or not the sector protection has been enabled or |
LeoHsueh |
6:1872f591d604 | 165 | * disabled, either by software-controlled method or |
LeoHsueh |
6:1872f591d604 | 166 | * hardware-controlled method. 1 means that the sector protection has |
LeoHsueh |
6:1872f591d604 | 167 | * been enabled and 0 that it has been disabled. |
LeoHsueh |
6:1872f591d604 | 168 | **/ |
LeoHsueh |
6:1872f591d604 | 169 | #define PROTECT 0x02 |
LeoHsueh |
6:1872f591d604 | 170 | /** |
LeoHsueh |
6:1872f591d604 | 171 | * Bit 0 indicates wether the page size of the main memory array is |
LeoHsueh |
6:1872f591d604 | 172 | * configured for "power of 2" binary page size (512 bytes) (bit=1) or |
LeoHsueh |
6:1872f591d604 | 173 | * standard DataFlash page size (528 bytes) (bit=0). |
LeoHsueh |
6:1872f591d604 | 174 | **/ |
LeoHsueh |
6:1872f591d604 | 175 | //#define PAGE_SIZE 0x01 |
LeoHsueh |
6:1872f591d604 | 176 | /** |
LeoHsueh |
6:1872f591d604 | 177 | * Bits 5, 4, 3 and 2 indicates the device density. The decimal value |
LeoHsueh |
6:1872f591d604 | 178 | * of these four binary bits does not equate to the device density; the |
LeoHsueh |
6:1872f591d604 | 179 | * four bits represent a combinational code relating to differing |
LeoHsueh |
6:1872f591d604 | 180 | * densities of DataFlash devices. The device density is not the same |
LeoHsueh |
6:1872f591d604 | 181 | * as the density code indicated in the JEDEC device ID information. |
LeoHsueh |
6:1872f591d604 | 182 | * The device density is provided only for backward compatibility. |
LeoHsueh |
6:1872f591d604 | 183 | **/ |
LeoHsueh |
6:1872f591d604 | 184 | #define DEVICE_DENSITY 0x2C |
okini3939 | 0:2e953bbaf3a5 | 185 | |
okini3939 | 0:2e953bbaf3a5 | 186 | #endif /* AT45DB161D_COMMANDS_H */ |