Skip to content

Qspi flash pin names standardization #7639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
b51056a
QSPI HAL addition
0xc0170 Nov 3, 2017
1b17da5
QSPI: fix address/alt variable sizes (can be skipped)
0xc0170 Nov 7, 2017
c2fbac4
QSPI: change length to be in/out parameter
0xc0170 Nov 7, 2017
e7b55d3
QSPI: improve mode documentation
0xc0170 Nov 8, 2017
86899ea
QSPI: fix command declaration names
0xc0170 Nov 10, 2017
6c221dc
QSPI: initial HAL nrf52840 version
0xc0170 Nov 10, 2017
54f6237
Modify QSPI HAL API to include an API for command-transfer operations
SenRamakri Nov 23, 2017
91dcbbe
Enabling QSPI headers in Nordic HAL implementation and fix for UART S…
SenRamakri Nov 23, 2017
1103f80
QSPI driver implementation
SenRamakri Nov 23, 2017
d0e84d6
Review fixes and doxygen changes
SenRamakri Nov 27, 2017
f94c6fb
Fix code style issues
SenRamakri Nov 29, 2017
b091d74
Add support for 1_1_2 and 1_2_2 modes in HAL
SenRamakri Nov 30, 2017
d0b6112
Changing config and return definitions to adhere to HAL defs
SenRamakri Nov 30, 2017
5c973cb
Remove explicit initialize API and coding style fixes
SenRamakri Dec 1, 2017
d58d980
Fix bracket placements
SenRamakri Dec 1, 2017
41104e1
Remove changes to Nordic SDK and modify HAL to track qspi init
SenRamakri Dec 4, 2017
dacfa9f
Minor optimizations and code style fixes
SenRamakri Dec 4, 2017
3a7b331
Review fixes
SenRamakri Dec 4, 2017
993c3ed
QSPI: fix address size for build qspi command
0xc0170 Dec 5, 2017
34f3fe2
QSPI: remove initialize method
0xc0170 Dec 5, 2017
eef50cd
QSPI: remove spaces on empty lines
0xc0170 Dec 5, 2017
764a1a6
QSPI HAL: fix alternative comment
0xc0170 Dec 5, 2017
3b75274
QSPI: fix arguments for write/read when alt is defined
0xc0170 Dec 6, 2017
c9516a7
QSPI: fix driver style issues
0xc0170 Dec 6, 2017
74b7666
QSPI: fix alt size NONE instead 0
0xc0170 Dec 6, 2017
22091d9
QSPI HAL: add disabled flag to format phase
0xc0170 Nov 23, 2017
67a0e78
QSPI: add STM32 implementation
0xc0170 Nov 15, 2017
beee925
QSPI STM32: fix ssel af selection
0xc0170 Nov 23, 2017
63b1507
QSPI STM32: fix return value in frequency
0xc0170 Nov 23, 2017
5b23dbe
QSPI STM32: set default command values to none
0xc0170 Nov 23, 2017
903ce56
QSPI STM32: remove polling from write/read
0xc0170 Nov 24, 2017
a0dc7ae
QSPI STM32: add qspi_command_transfer implementation
0xc0170 Dec 5, 2017
058ca03
QSPI STM32: init returns error if failed to init
0xc0170 Dec 5, 2017
06063d2
QSPI STM32: add QSPI_x support to pinnames
0xc0170 Dec 5, 2017
70b8158
QSPI STM32: fix disabled format phase
0xc0170 Dec 11, 2017
86be6a7
QSPI STM32: fix pin merging
0xc0170 Dec 12, 2017
a7f4db0
QSPI STM32: fix command transfer
0xc0170 Dec 12, 2017
1045234
QSPI STM32: fix prepare comman - alt/address
0xc0170 Dec 12, 2017
4f6bb68
QSPI STM32: fix default fifo and cycle
0xc0170 Dec 12, 2017
3d7d5ac
QSPI: hal doxygen fixes
0xc0170 Jan 9, 2018
6d518d1
QSPI: add flash pins for F469 disco board
0xc0170 Jan 8, 2018
90f5859
QSPI: add flash pins for nrf52480_dk board
0xc0170 Jan 8, 2018
8aea076
QSPI: add STM32L4 support
0xc0170 Jan 10, 2018
e10503c
QSPI: fix memset header file missing
0xc0170 Feb 16, 2018
025ef51
QSPI: add address to command transfer
0xc0170 Feb 13, 2018
43b379b
Fix Address.Size and AlternateByes.Size by shifting them
adustm Mar 22, 2018
e354bd9
Fix Instruction with no data command
adustm Mar 22, 2018
afe462a
Dummy cycles count is not an init parameter, but a command parameter.
adustm Mar 20, 2018
6ec6f6a
Change default FlashSize to 64Mbit = 8Mbytes = 0x800000
adustm Mar 19, 2018
ac23307
Move _mode from QSPI::configure_format to QSPI::QSPI
adustm Mar 30, 2018
5ae636d
Revert "Dummy cycles count is not an init parameter, but a command pa…
adustm Mar 30, 2018
b6e1fc1
Enable QSPI feature for DISCO_F413ZH platform
adustm Apr 9, 2018
b3d6e28
Support maximum flash size : 4Gbytes
adustm Apr 9, 2018
ff168a6
Add MBED_WEAK for pins
adustm Apr 10, 2018
3140125
Enable QSPI for DISCO_F746NG
adustm Apr 10, 2018
060abc1
Add support for QSPI on DISCO_L476VG
adustm Apr 10, 2018
00a29cf
QSPI: add doxygen options
0xc0170 Apr 24, 2018
a9a0c22
QSPI: fix doxy hal documentation
0xc0170 Apr 24, 2018
2fe18db
fix qspi command transfer for NORDIC
maciejbocianski Jun 22, 2018
9fd50af
STM qspi: temporary fix for qspi_free return value
maciejbocianski Jun 25, 2018
4f1d7c6
STM: add qspi pin names for DISCO_L475VG_IOT01A
maciejbocianski Jun 25, 2018
f5cb477
NRF5: fix qspi custom command sending
maciejbocianski Jun 25, 2018
1ec8c79
NRF5: fix qspi R/W opcodes mapping
maciejbocianski Jun 25, 2018
f4e9982
add hal-qspi test
maciejbocianski Jun 26, 2018
ad825f4
hal-qspi test refactoring
maciejbocianski Jul 4, 2018
24750d6
hal-qspi test: fix QSPI preprocessor guard
maciejbocianski Jul 6, 2018
af90f2c
nrf52x: fix QSPI enable flag
maciejbocianski Jul 17, 2018
0715a46
Merge pull request #7325 from maciejbocianski/qspi_tests
Jul 18, 2018
98aa5ea
STM32 : add all QSPI pins in available targets
jeromecoutant Jul 20, 2018
1796fed
Fix support of max flash size
adustm Jul 19, 2018
0a3f5a0
hal-qspi_test: remove STM workaround
maciejbocianski Jul 23, 2018
02e4a7b
Merge pull request #7562 from jeromecoutant/PR_ADDQSPI
Jul 23, 2018
74307ff
Merge pull request #7580 from maciejbocianski/qspi_test_rem_stm_worka…
Jul 24, 2018
488baf9
Implement qspi_free function
adustm Jul 19, 2018
5821e6c
Add reset internal state before call to HAL_QspiInit function
adustm Jul 24, 2018
1c38d24
Merge pull request #7586 from adustm/qspistm_fix_arm_toolchain
Jul 24, 2018
a2da175
normalize QSPI flash pin names
maciejbocianski Jul 30, 2018
1e1d57c
align QSPI test to new pin names
maciejbocianski Jul 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 182 additions & 0 deletions TESTS/mbed_hal/qspi/flash_configs/MX25R6435F_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
/* mbed Microcontroller Library
* Copyright (c) 2018-2018 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_QSPI_FLASH_MX25R6435F_H
#define MBED_QSPI_FLASH_MX25R6435F_H


#define QSPI_FLASH_CHIP_STRING "macronix MX25R6435F"

// Command for reading status register
#define QSPI_CMD_RDSR 0x05
// Command for reading configuration register
#define QSPI_CMD_RDCR0 0x15
// Command for writing status/configuration register
#define QSPI_CMD_WRSR 0x01
// Command for reading security register
#define QSPI_CMD_RDSCUR 0x2B

// Command for setting Reset Enable
#define QSPI_CMD_RSTEN 0x66
// Command for setting Reset
#define QSPI_CMD_RST 0x99

// Command for setting write enable
#define QSPI_CMD_WREN 0x06
// Command for setting write disable
#define QSPI_CMD_WRDI 0x04

// WRSR operations max time [us] (datasheet max time + 15%)
#define QSPI_WRSR_MAX_TIME 34500 // 30ms
// general wait max time [us]
#define QSPI_WAIT_MAX_TIME 100000 // 100ms


// Commands for writing (page programming)
#define QSPI_CMD_WRITE_1IO 0x02 // 1-1-1 mode
#define QSPI_CMD_WRITE_4IO 0x38 // 1-4-4 mode

// write operations max time [us] (datasheet max time + 15%)
#define QSPI_PAGE_PROG_MAX_TIME 11500 // 10ms

#define QSPI_PAGE_SIZE 256 // 256B

// Commands for reading
#define QSPI_CMD_READ_1IO_FAST 0x0B // 1-1-1 mode
#define QSPI_CMD_READ_1IO 0x03 // 1-1-1 mode
#define QSPI_CMD_READ_2IO 0xBB // 1-2-2 mode
#define QSPI_CMD_READ_1I2O 0x3B // 1-1-2 mode
#define QSPI_CMD_READ_4IO 0xEB // 1-4-4 mode
#define QSPI_CMD_READ_1I4O 0x6B // 1-1-4 mode

#define QSPI_READ_1IO_DUMMY_CYCLE 0
#define QSPI_READ_FAST_DUMMY_CYCLE 8
#define QSPI_READ_2IO_DUMMY_CYCLE 4
#define QSPI_READ_1I2O_DUMMY_CYCLE 8
#define QSPI_READ_4IO_DUMMY_CYCLE 6
#define QSPI_READ_1I4O_DUMMY_CYCLE 8

// Commands for erasing
#define QSPI_CMD_ERASE_SECTOR 0x20 // 4kB
#define QSPI_CMD_ERASE_BLOCK_32 0x52 // 32kB
#define QSPI_CMD_ERASE_BLOCK_64 0xD8 // 64kB
#define QSPI_CMD_ERASE_CHIP 0x60 // or 0xC7

// erase operations max time [us] (datasheet max time + 15%)
#define QSPI_ERASE_SECTOR_MAX_TIME 276000 // 240 ms
#define QSPI_ERASE_BLOCK_32_MAX_TIME 3450000 // 3s
#define QSPI_ERASE_BLOCK_64_MAX_TIME 4025000 // 3.5s

// max frequency for basic rw operation
#define QSPI_COMMON_MAX_FREQUENCY 32000000

#define QSPI_STATUS_REG_SIZE 1
#define QSPI_CONFIG_REG_0_SIZE 2
#define QSPI_SECURITY_REG_SIZE 1
#define QSPI_MAX_REG_SIZE 2

// status register
#define STATUS_BIT_WIP (1 << 0) // write in progress bit
#define STATUS_BIT_WEL (1 << 1) // write enable latch
#define STATUS_BIT_BP0 (1 << 2) //
#define STATUS_BIT_BP1 (1 << 3) //
#define STATUS_BIT_BP2 (1 << 4) //
#define STATUS_BIT_BP3 (1 << 5) //
#define STATUS_BIT_QE (1 << 6) // Quad Enable
#define STATUS_BIT_SRWD (1 << 7) // status register write protect

// configuration register 0
// bit 0, 1, 2, 4, 5, 7 reserved
#define CONFIG0_BIT_TB (1 << 3) // Top/Bottom area protect
#define CONFIG0_BIT_DC (1 << 6) // Dummy Cycle

// configuration register 1
// bit 0, 2, 3, 4, 5, 6, 7 reserved
#define CONFIG1_BIT_LH (1 << 1) // 0 = Ultra Low power mode, 1 = High performance mode


// single quad enable flag for both dual and quad mode
#define QUAD_ENABLE_IMPLEMENTATION() \
\
uint8_t reg_data[QSPI_STATUS_REG_SIZE]; \
\
reg_data[0] = STATUS_BIT_QE; \
qspi.cmd.build(QSPI_CMD_WRSR); \
\
if (qspi_command_transfer(&qspi.handle, qspi.cmd.get(), \
reg_data, QSPI_STATUS_REG_SIZE, NULL, 0) != QSPI_STATUS_OK) { \
return QSPI_STATUS_ERROR; \
} \
WAIT_FOR(WRSR_MAX_TIME, qspi); \
\
memset(reg_data, 0, QSPI_STATUS_REG_SIZE); \
if (read_register(STATUS_REG, reg_data, \
QSPI_STATUS_REG_SIZE, qspi) != QSPI_STATUS_OK) { \
return QSPI_STATUS_ERROR; \
} \
\
return ((reg_data[0] & STATUS_BIT_QE) != 0 ? \
QSPI_STATUS_OK : QSPI_STATUS_ERROR)



#define QUAD_DISABLE_IMPLEMENTATION() \
\
uint8_t reg_data[QSPI_STATUS_REG_SIZE]; \
\
reg_data[0] = 0; \
qspi.cmd.build(QSPI_CMD_WRSR); \
\
if (qspi_command_transfer(&qspi.handle, qspi.cmd.get(), \
reg_data, QSPI_STATUS_REG_SIZE, NULL, 0) != QSPI_STATUS_OK) { \
return QSPI_STATUS_ERROR; \
} \
WAIT_FOR(WRSR_MAX_TIME, qspi); \
\
reg_data[0] = 0; \
if (read_register(STATUS_REG, reg_data, \
QSPI_STATUS_REG_SIZE, qspi) != QSPI_STATUS_OK) { \
return QSPI_STATUS_ERROR; \
} \
\
return ((reg_data[0] & STATUS_BIT_QE) == 0 ? \
QSPI_STATUS_OK : QSPI_STATUS_ERROR)



#define FAST_MODE_ENABLE_IMPLEMENTATION() \
\
qspi_status_t ret; \
const int32_t reg_size = QSPI_STATUS_REG_SIZE + QSPI_CONFIG_REG_0_SIZE; \
uint8_t reg_data[reg_size]; \
\
if (read_register(STATUS_REG, reg_data, \
QSPI_STATUS_REG_SIZE, qspi) != QSPI_STATUS_OK) { \
return QSPI_STATUS_ERROR; \
} \
if (read_register(CONFIG_REG0, reg_data + QSPI_STATUS_REG_SIZE, \
QSPI_CONFIG_REG_0_SIZE, qspi) != QSPI_STATUS_OK) { \
return QSPI_STATUS_ERROR; \
} \
\
reg_data[2] |= CONFIG1_BIT_LH; \
qspi.cmd.build(QSPI_CMD_WRSR); \
\
return qspi_command_transfer(&qspi.handle, qspi.cmd.get(), \
reg_data, reg_size, NULL, 0)



#endif // MBED_QSPI_FLASH_MX25R6435F_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* mbed Microcontroller Library
* Copyright (c) 2018-2018 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_QSPI_FLASH_CONFIG_H
#define MBED_QSPI_FLASH_CONFIG_H

#include "../../MX25R6435F_config.h"

// NRF doesn't uses read/write opcodes, instead it uses commands id's.
// Before sending it to H/W opcodes are mapped to id's in Mbed hal qspi implementation
//
// for more details see:
// targets\TARGET_NORDIC\TARGET_NRF5x\TARGET_SDK_14_2\device\nrf52840_bitfields.h
// targets\TARGET_NORDIC\TARGET_NRF5x\qspi_api.c

// NRF doesn't support read 1IO (opcode 0x03)
#undef QSPI_CMD_READ_1IO
#define QSPI_CMD_READ_1IO QSPI_CMD_READ_1IO_FAST


#endif // MBED_QSPI_FLASH_CONFIG_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* mbed Microcontroller Library
* Copyright (c) 2018-2018 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MBED_QSPI_FLASH_CONFIG_H
#define MBED_QSPI_FLASH_CONFIG_H

#include "../../MX25R6435F_config.h"


#endif // MBED_QSPI_FLASH_CONFIG_H
26 changes: 26 additions & 0 deletions TESTS/mbed_hal/qspi/flash_configs/flash_configs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* mbed Microcontroller Library
* Copyright (c) 2018-2018 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef MBED_FLASH_CONFIGS_H
#define MBED_FLASH_CONFIGS_H

#if defined(TARGET_DISCO_L475VG_IOT01A)
#include "STM/DISCO_L475VG_IOT01A/flash_config.h"
#elif defined(TARGET_NRF52840)
#include "NORDIC/NRF52840_DK/flash_config.h"
#endif

#endif // MBED_FLASH_CONFIGS_H
Loading