Skip to content

Commit 4f22a10

Browse files
committed
Add MX25LM51245G Serial Flash test config file
1 parent ac08592 commit 4f22a10

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2018-2018 ARM Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#ifndef MBED_QSPI_FLASH_MX25LM51245G_H
17+
#define MBED_QSPI_FLASH_MX25LM51245G_H
18+
19+
20+
#define QSPI_FLASH_CHIP_STRING "macronix MX25LM51245G"
21+
22+
// Command for reading status register
23+
#define QSPI_CMD_RDSR 0x05
24+
// Command for reading configuration register
25+
#define QSPI_CMD_RDCR0 0x15
26+
#define QSPI_CMD_RDCR1 0x71
27+
// Command for writing status/configuration register
28+
#define QSPI_CMD_WRSR 0x01
29+
// Command for reading security register
30+
#define QSPI_CMD_RDSCUR 0x2B
31+
32+
// Command for setting Reset Enable
33+
#define QSPI_CMD_RSTEN 0x66
34+
// Command for setting Reset
35+
#define QSPI_CMD_RST 0x99
36+
37+
// Command for setting write enable
38+
#define QSPI_CMD_WREN 0x06
39+
// Command for setting write disable
40+
#define QSPI_CMD_WRDI 0x04
41+
42+
// WRSR operations max time [us] (datasheet max time + 15%)
43+
#define QSPI_WRSR_MAX_TIME 34500 // 30ms
44+
// general wait max time [us]
45+
#define QSPI_WAIT_MAX_TIME 100000 // 100ms
46+
47+
48+
// Commands for writing (page programming)
49+
#define QSPI_CMD_WRITE_1IO 0x02 // 1-1-1 mode
50+
//#define QSPI_CMD_WRITE_4IO 0x02 // Only single/octal mode supported
51+
// write operations max time [us] (datasheet max time + 15%)
52+
#define QSPI_PAGE_PROG_MAX_TIME 11500 // 10ms
53+
54+
#define QSPI_PAGE_SIZE 256 // 256B
55+
#define QSPI_SECTOR_SIZE 4096 // 4kB
56+
#define QSPI_SECTOR_COUNT 2048
57+
58+
// Commands for reading
59+
#define QSPI_CMD_READ_1IO_FAST 0x0B // 1-1-1 mode
60+
#define QSPI_CMD_READ_1IO 0x03 /// Only single/octal mode supported
61+
//#define QSPI_CMD_READ_2IO 0x03 // Only single/octal mode supported
62+
//#define QSPI_CMD_READ_1I2O 0x03 // Only single/octal mode supported
63+
//#define QSPI_CMD_READ_4IO 0x03 // Only single/octal mode supported
64+
//#define QSPI_CMD_READ_1I4O 0x03 // Only single/octal mode supported
65+
66+
#define QSPI_READ_1IO_DUMMY_CYCLE 0
67+
#define QSPI_READ_FAST_DUMMY_CYCLE 8
68+
//#define QSPI_READ_2IO_DUMMY_CYCLE 0 // Only single/octal mode supported
69+
//#define QSPI_READ_1I2O_DUMMY_CYCLE 0 // Only single/octal mode supported
70+
//#define QSPI_READ_4IO_DUMMY_CYCLE 0 // Only single/octal mode supported
71+
//#define QSPI_READ_1I4O_DUMMY_CYCLE 0 // Only single/octal mode supported
72+
73+
// Commands for erasing
74+
#define QSPI_CMD_ERASE_SECTOR 0x20 // 4kB
75+
//#define QSPI_CMD_ERASE_BLOCK_32 // not supported, only ersae block 64
76+
#define QSPI_CMD_ERASE_BLOCK_64 0xD8 // 64kB
77+
#define QSPI_CMD_ERASE_CHIP 0x60 // or 0xC7
78+
79+
// erase operations max time [us] (datasheet max time + 15%)
80+
#define QSPI_ERASE_SECTOR_MAX_TIME 480000 // 400 ms
81+
#define QSPI_ERASE_BLOCK_64_MAX_TIME 2400000 // 2s
82+
83+
// max frequency for basic rw operation (for fast mode)
84+
#define QSPI_COMMON_MAX_FREQUENCY 1000000
85+
86+
#define QSPI_STATUS_REG_SIZE 1 //2 ??
87+
#define QSPI_CONFIG_REG_0_SIZE 1
88+
#define QSPI_CONFIG_REG_1_SIZE 1
89+
#define QSPI_SECURITY_REG_SIZE 1
90+
#define QSPI_MAX_REG_SIZE 2
91+
92+
// status register
93+
#define STATUS_BIT_WIP (1 << 0) // write in progress bit
94+
#define STATUS_BIT_WEL (1 << 1) // write enable latch
95+
#define STATUS_BIT_BP0 (1 << 2) //
96+
#define STATUS_BIT_BP1 (1 << 3) //
97+
#define STATUS_BIT_BP2 (1 << 4) //
98+
#define STATUS_BIT_BP3 (1 << 5) //
99+
//#define STATUS_BIT_QE (1 << 6) // Not supported
100+
//#define STATUS_BIT_SRWD (1 << 7) // Not supported
101+
102+
// configuration register 0
103+
// bit 0, 1, 2, 4, 5, 7 reserved
104+
#define CONFIG0_BIT_TB (1 << 3) // Top/Bottom area protect
105+
106+
#endif // MBED_QSPI_FLASH_MX25LM51245G_H

0 commit comments

Comments
 (0)