Skip to content

Commit 84ee55b

Browse files
committed
QSPI tests: update STM32 boards configuration
NB: STM directory removed in flash_configs as there is no STM memory
1 parent dfa902e commit 84ee55b

File tree

4 files changed

+131
-53
lines changed

4 files changed

+131
-53
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_MX25L51245G_H
17+
#define MBED_QSPI_FLASH_MX25L51245G_H
18+
19+
20+
#define QSPI_FLASH_CHIP_STRING "macronix MX25L51245G"
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+
// Command for writing status/configuration register
27+
#define QSPI_CMD_WRSR 0x01
28+
// Command for reading security register
29+
#define QSPI_CMD_RDSCUR 0x2B
30+
31+
// Command for setting Reset Enable
32+
#define QSPI_CMD_RSTEN 0x66
33+
// Command for setting Reset
34+
#define QSPI_CMD_RST 0x99
35+
36+
// Command for setting write enable
37+
#define QSPI_CMD_WREN 0x06
38+
// Command for setting write disable
39+
#define QSPI_CMD_WRDI 0x04
40+
41+
// WRSR operations max time [us] (datasheet max time + 15%)
42+
#define QSPI_WRSR_MAX_TIME 34500 // 30ms
43+
// general wait max time [us]
44+
#define QSPI_WAIT_MAX_TIME 100000 // 100ms
45+
46+
47+
// Commands for writing (page programming)
48+
#define QSPI_CMD_WRITE_1IO 0x02 // 1-1-1 mode
49+
#define QSPI_CMD_WRITE_4IO 0x38 // 1-4-4 mode
50+
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 // 1-1-1 mode
61+
#define QSPI_CMD_READ_2IO 0xBB // 1-2-2 mode
62+
#define QSPI_CMD_READ_1I2O 0x3B // 1-1-2 mode
63+
#define QSPI_CMD_READ_4IO 0xEB // 1-4-4 mode
64+
#define QSPI_CMD_READ_1I4O 0x6B // 1-1-4 mode
65+
66+
#define QSPI_READ_1IO_DUMMY_CYCLE 0
67+
#define QSPI_READ_FAST_DUMMY_CYCLE 8
68+
#define QSPI_READ_2IO_DUMMY_CYCLE 4
69+
#define QSPI_READ_1I2O_DUMMY_CYCLE 8
70+
#define QSPI_READ_4IO_DUMMY_CYCLE 6
71+
#define QSPI_READ_1I4O_DUMMY_CYCLE 8
72+
73+
// Commands for erasing
74+
#define QSPI_CMD_ERASE_SECTOR 0x20 // 4kB
75+
#define QSPI_CMD_ERASE_BLOCK_32 0x52 // 32kB
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_32_MAX_TIME 1200000 // 1s
82+
#define QSPI_ERASE_BLOCK_64_MAX_TIME 2400000 // 2s
83+
84+
// max frequency for basic rw operation (for fast mode)
85+
#define QSPI_COMMON_MAX_FREQUENCY 32000000
86+
87+
#define QSPI_STATUS_REG_SIZE 1
88+
#define QSPI_CONFIG_REG_0_SIZE 2
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) // Quad Enable
100+
#define STATUS_BIT_SRWD (1 << 7) // status register write protect
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_MX25L51245G_H

TESTS/mbed_hal/qspi/flash_configs/STM/DISCO_F413ZH/flash_config.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

TESTS/mbed_hal/qspi/flash_configs/STM/DISCO_L475VG_IOT01A/flash_config.h

Lines changed: 0 additions & 22 deletions
This file was deleted.

TESTS/mbed_hal/qspi/flash_configs/flash_configs.h

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,45 @@
1818
#define MBED_FLASH_CONFIGS_H
1919

2020
#if defined(TARGET_DISCO_L475VG_IOT01A)
21-
#include "STM/DISCO_L475VG_IOT01A/flash_config.h" // MX25R6435F => MX25RXX35F_config.h
22-
#elif defined(TARGET_NRF52840)
23-
#include "NORDIC/NRF52840_DK/flash_config.h"
21+
#include "MX25RXX35F_config.h" // MX25R6435F
22+
2423
#elif defined(TARGET_DISCO_F413ZH)
25-
#include "STM/DISCO_F413ZH/flash_config.h" // N25Q128A_config.h
24+
#include "N25Q128A_config.h" // N25Q128A13EF840F
25+
2626
#elif defined(TARGET_DISCO_F746NG)
27-
#include "N25Q128A_config.h"
27+
#include "N25Q128A_config.h" // N25Q128A13EF840E
28+
2829
#elif defined(TARGET_DISCO_F469NI)
29-
#include "N25Q128A_config.h"
30+
#include "N25Q128A_config.h" // N25Q128A13EF840E
31+
3032
#elif defined(TARGET_DISCO_F769NI)
31-
#include "MX25RXX35F_config.h" // MX25L51245G
33+
#include "MX25L51245G_config.h" // MX25L51245G
34+
3235
#elif defined(TARGET_DISCO_L476VG)
33-
#include "N25Q128A_config.h"
36+
#include "N25Q128A_config.h" // N25Q128A13EF840E
37+
/* See STM32L476 Errata Sheet, it is not possible to use Dual-/Quad-mode for the command phase */
38+
#undef QSPI_CMD_READ_DPI
39+
#undef QSPI_CMD_READ_QPI
40+
#undef QSPI_CMD_WRITE_DPI
41+
#undef QSPI_CMD_WRITE_QPI
42+
3443
#elif defined(TARGET_DISCO_L496AG)
3544
#include "MX25RXX35F_config.h" // MX25R6435F
45+
46+
#elif defined(TARGET_NRF52840)
47+
#include "NORDIC/NRF52840_DK/flash_config.h"
48+
3649
#elif defined(TARGET_EFM32GG11_STK3701)
3750
#include "SiliconLabs/EFM32GG11_STK3701/flash_config.h"
51+
3852
#elif defined(TARGET_K82F)
3953
#include "NXP/K82F/flash_config.h"
54+
4055
#elif defined(TARGET_KL82Z)
4156
#include "NXP/KL82Z/flash_config.h"
57+
4258
#elif defined(TARGET_LPC546XX)
4359
#include "NXP/LPC546XX/flash_config.h"
44-
#endif
4560

61+
#endif
4662
#endif // MBED_FLASH_CONFIGS_H

0 commit comments

Comments
 (0)