Skip to content

Commit f8f9faa

Browse files
committed
LPC566XX LPCXpresso: Update to add QSPI support
Signed-off-by: Mahesh Mahadevan <[email protected]>
1 parent b3d0b5c commit f8f9faa

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-0
lines changed

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC546XX/TARGET_LPCXpresso/PeripheralNames.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ typedef enum {
105105
SPI_1 = Flexcomm9
106106
} SPIName;
107107

108+
typedef enum {
109+
QSPI_0 = 0
110+
} QSPIName;
111+
108112
#ifdef __cplusplus
109113
}
110114
#endif

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC546XX/TARGET_LPCXpresso/PeripheralPins.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,21 @@ const PinMap PinMap_SPI_SSEL[] = {
115115
const PinMap PinMap_PWM[] = {
116116
{NC , NC , 0}
117117
};
118+
119+
/************QSPI***************/
120+
const PinMap PinMap_QSPI_DATA[] = {
121+
{P0_24, QSPI_0, 6},
122+
{P0_25, QSPI_0, 6},
123+
{P0_28, QSPI_0, 6},
124+
{P0_27, QSPI_0, 6},
125+
{NC , NC , 0}
126+
};
127+
const PinMap PinMap_QSPI_SCLK[] = {
128+
{P0_26, QSPI_0, 6},
129+
{NC , NC , 0}
130+
};
131+
const PinMap PinMap_QSPI_SSEL[] = {
132+
{P0_23, QSPI_0, 6},
133+
{NC , NC , 0}
134+
};
135+

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC546XX/TARGET_LPCXpresso/PinNames.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,14 @@ typedef enum {
219219
I2C_SCL = D15,
220220
I2C_SDA = D14,
221221

222+
/**** QSPI FLASH pins ****/
223+
QSPI_FLASH1_IO0 = P0_24,
224+
QSPI_FLASH1_IO1 = P0_25,
225+
QSPI_FLASH1_IO2 = P0_28,
226+
QSPI_FLASH1_IO3 = P0_27,
227+
QSPI_FLASH1_SCK = P0_26,
228+
QSPI_FLASH1_CSN = P0_23,
229+
222230
A0 = P0_16,
223231
A1 = P0_31,
224232
A2 = P1_0,

targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/TARGET_LPC546XX/TARGET_LPCXpresso/mbed_overrides.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,12 @@ void BOARD_InitSDRAM(void)
172172
/* EMC Dynamc memory configuration. */
173173
EMC_DynamicMemInit(EMC, &dynTiming, &dynChipConfig, 1);
174174
}
175+
176+
// Get the QSPI clock frequency
177+
uint32_t qspi_get_freq(void)
178+
{
179+
CLOCK_AttachClk(kFRO_HF_to_SPIFI_CLK);
180+
181+
return CLOCK_GetFroHfFreq();
182+
}
183+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2018, ARM Limited
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice,
9+
* this list of conditions and the following disclaimer.
10+
* 2. Redistributions in binary form must reproduce the above copyright notice,
11+
* this list of conditions and the following disclaimer in the documentation
12+
* and/or other materials provided with the distribution.
13+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
14+
* may be used to endorse or promote products derived from this software
15+
* without specific prior written permission.
16+
*
17+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
*/
28+
29+
#ifndef _FSL_MBED_QSPI_DEVICE_H_
30+
#define _FSL_MBED_QSPI_DEVICE_H_
31+
32+
#include "fsl_spifi.h"
33+
34+
#define FLASH_SIZE 0x00400000U
35+
#define FLASH_PAGE_SIZE 256U
36+
37+
/* Pre-defined commands */
38+
spifi_command_t preset_spifi_command[2] = {
39+
{FLASH_PAGE_SIZE, false, kSPIFI_DataInput, 0, kSPIFI_CommandAllSerial, kSPIFI_CommandOpcodeAddrThreeBytes, 0x3},
40+
{FLASH_PAGE_SIZE, false, kSPIFI_DataOutput, 0, kSPIFI_CommandAllSerial, kSPIFI_CommandOpcodeAddrThreeBytes, 0x2}
41+
};
42+
43+
#endif /* _FSL_MBED_QSPI_DEVICE_H_*/

0 commit comments

Comments
 (0)