Skip to content

Commit d4eaf6f

Browse files
jeromecoutantLMESTM
authored andcommitted
STM32L4: Add OSPI IP support in fallback QSPI mode
For STM32 platforms that embed an OSPI IP, we're offering a QSPI fallback support with this commit. When OSPI is supported in mbed, we can consider adding full OSPI support
1 parent 96a773a commit d4eaf6f

File tree

19 files changed

+602
-143
lines changed

19 files changed

+602
-143
lines changed

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F413xH/objects.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ struct trng_s {
4444
RNG_HandleTypeDef handle;
4545
};
4646

47-
struct qspi_s {
48-
QSPI_HandleTypeDef handle;
49-
PinName io0;
50-
PinName io1;
51-
PinName io2;
52-
PinName io3;
53-
PinName sclk;
54-
PinName ssel;
55-
};
56-
5747
#include "common_objects.h"
5848

5949
#ifdef __cplusplus

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F469xI/objects.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ struct trng_s {
5858
RNG_HandleTypeDef handle;
5959
};
6060

61-
struct qspi_s {
62-
QSPI_HandleTypeDef handle;
63-
PinName io0;
64-
PinName io1;
65-
PinName io2;
66-
PinName io3;
67-
PinName sclk;
68-
PinName ssel;
69-
};
70-
7161
#include "common_objects.h"
7262

7363
#ifdef __cplusplus

targets/TARGET_STM/TARGET_STM32F4/common_objects.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,23 @@ struct can_s {
143143
};
144144
#endif
145145

146+
#if DEVICE_QSPI
147+
struct qspi_s {
148+
#if defined(OCTOSPI1)
149+
OSPI_HandleTypeDef handle;
150+
#else
151+
QSPI_HandleTypeDef handle;
152+
#endif
153+
QSPIName qspi;
154+
PinName io0;
155+
PinName io1;
156+
PinName io2;
157+
PinName io3;
158+
PinName sclk;
159+
PinName ssel;
160+
};
161+
#endif
162+
146163
#ifdef __cplusplus
147164
}
148165
#endif

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F746xG/objects.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ struct trng_s {
5858
RNG_HandleTypeDef handle;
5959
};
6060

61-
struct qspi_s {
62-
QSPI_HandleTypeDef handle;
63-
PinName io0;
64-
PinName io1;
65-
PinName io2;
66-
PinName io3;
67-
PinName sclk;
68-
PinName ssel;
69-
};
70-
7161
#include "common_objects.h"
7262

7363
#ifdef __cplusplus

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F756xG/objects.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ struct trng_s {
5858
RNG_HandleTypeDef handle;
5959
};
6060

61-
struct qspi_s {
62-
QSPI_HandleTypeDef handle;
63-
PinName io0;
64-
PinName io1;
65-
PinName io2;
66-
PinName io3;
67-
PinName sclk;
68-
PinName ssel;
69-
};
70-
7161
#include "common_objects.h"
7262

7363
#ifdef __cplusplus

targets/TARGET_STM/TARGET_STM32F7/TARGET_STM32F769xI/objects.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ struct trng_s {
5858
RNG_HandleTypeDef handle;
5959
};
6060

61-
struct qspi_s {
62-
QSPI_HandleTypeDef handle;
63-
PinName io0;
64-
PinName io1;
65-
PinName io2;
66-
PinName io3;
67-
PinName sclk;
68-
PinName ssel;
69-
};
70-
7161
#include "common_objects.h"
7262

7363
#ifdef __cplusplus

targets/TARGET_STM/TARGET_STM32F7/common_objects.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,23 @@ struct can_s {
142142
};
143143
#endif
144144

145+
#if DEVICE_QSPI
146+
struct qspi_s {
147+
#if defined(OCTOSPI1)
148+
OSPI_HandleTypeDef handle;
149+
#else
150+
QSPI_HandleTypeDef handle;
151+
#endif
152+
QSPIName qspi;
153+
PinName io0;
154+
PinName io1;
155+
PinName io2;
156+
PinName io3;
157+
PinName sclk;
158+
PinName ssel;
159+
};
160+
#endif
161+
145162
#ifdef __cplusplus
146163
}
147164
#endif

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L475xG/objects.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ struct trng_s {
5858
RNG_HandleTypeDef handle;
5959
};
6060

61-
struct qspi_s {
62-
QSPI_HandleTypeDef handle;
63-
PinName io0;
64-
PinName io1;
65-
PinName io2;
66-
PinName io3;
67-
PinName sclk;
68-
PinName ssel;
69-
};
70-
7161
#include "common_objects.h"
7262

7363
#ifdef __cplusplus

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L476xG/objects.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ struct trng_s {
5858
RNG_HandleTypeDef handle;
5959
};
6060

61-
struct qspi_s {
62-
QSPI_HandleTypeDef handle;
63-
PinName io0;
64-
PinName io1;
65-
PinName io2;
66-
PinName io3;
67-
PinName sclk;
68-
PinName ssel;
69-
};
70-
7161
#include "common_objects.h"
7262

7363
#ifdef __cplusplus

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L486xG/objects.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ struct trng_s {
5858
RNG_HandleTypeDef handle;
5959
};
6060

61-
struct qspi_s {
62-
QSPI_HandleTypeDef handle;
63-
PinName io0;
64-
PinName io1;
65-
PinName io2;
66-
PinName io3;
67-
PinName sclk;
68-
PinName ssel;
69-
};
70-
7161
#include "common_objects.h"
7262

7363
#ifdef __cplusplus

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L496xG/objects.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ struct trng_s {
5858
RNG_HandleTypeDef handle;
5959
};
6060

61-
struct qspi_s {
62-
QSPI_HandleTypeDef handle;
63-
PinName io0;
64-
PinName io1;
65-
PinName io2;
66-
PinName io3;
67-
PinName sclk;
68-
PinName ssel;
69-
};
70-
7161
#include "common_objects.h"
7262

7363
#ifdef __cplusplus

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L4R9xI/TARGET_DISCO_L4R9I/PeripheralNames.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ typedef enum {
8383
CAN_1 = (int)CAN1_BASE
8484
} CANName;
8585

86+
typedef enum {
87+
QSPI_1 = (int)OCTOSPI1_R_BASE,
88+
QSPI_2 = (int)OCTOSPI2_R_BASE
89+
} QSPIName;
90+
8691
#ifdef __cplusplus
8792
}
8893
#endif

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L4R9xI/TARGET_DISCO_L4R9I/PeripheralPins.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,3 +390,59 @@ MBED_WEAK const PinMap PinMap_CAN_TD[] = {
390390
{PH_13, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_CAN1)}, // Connected to ARD_D9
391391
{NC, NC, 0}
392392
};
393+
394+
//*** QUADSPI ***
395+
396+
MBED_WEAK const PinMap PinMap_QSPI_DATA0[] = {
397+
{PB_1, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0
398+
{PE_12, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO0 // Connected to D9
399+
{PF_0, QSPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO0 // Connected to PSRAM_A0
400+
{PI_11, QSPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO0 // Connected to OCTOSPIM_P2_IO0
401+
{NC, NC, 0}
402+
};
403+
404+
MBED_WEAK const PinMap PinMap_QSPI_DATA1[] = {
405+
{PB_0, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 // Connected to ARD_A3
406+
{PE_13, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO1 // Connected to D10
407+
{PF_1, QSPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO1 // Connected to PSRAM_A1
408+
{PI_10, QSPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO1 // Connected to OCTOSPIM_P2_IO1
409+
{NC, NC, 0}
410+
};
411+
412+
MBED_WEAK const PinMap PinMap_QSPI_DATA2[] = {
413+
{PA_7, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 // Connected to ARD_A0
414+
{PE_14, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO2 // Connected to D11
415+
{PF_2, QSPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO2 // Connected to PSRAM_A2
416+
{PI_9, QSPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO2 // Connected to OCTOSPIM_P2_IO2
417+
{NC, NC, 0}
418+
};
419+
420+
MBED_WEAK const PinMap PinMap_QSPI_DATA3[] = {
421+
{PA_6, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 // Connected to SPI2_CS
422+
{PE_15, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_IO3 // Connected to D12
423+
{PF_3, QSPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO3 // Connected to PSRAM_A3
424+
{PH_8, QSPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_OCTOSPIM_P2)}, // OCTOSPIM_P2_IO3 // Connected to OCTOSPI_P2_IO3
425+
{NC, NC, 0}
426+
};
427+
428+
MBED_WEAK const PinMap PinMap_QSPI_SCLK[] = {
429+
// {PA_3, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_CLK // Connected to STDIO_UART_RX
430+
{PB_10, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_CLK // Connected to USART3_TX
431+
{PE_10, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_CLK // Connected to D7
432+
{PF_4, QSPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_OCTOSPIM_P2)}, // OCTOSPIM_P2_CLK // Connected to PSRAM_A4
433+
{PF_10, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_OCTOSPIM_P1)}, // OCTOSPIM_P1_CLK
434+
{PI_6, QSPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_OCTOSPIM_P2)}, // OCTOSPIM_P2_CLK // Connected to OCTOSPIM_P2_CLK
435+
{NC, NC, 0}
436+
};
437+
438+
MBED_WEAK const PinMap PinMap_QSPI_SSEL[] = {
439+
// {PA_2, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS // Connected to STDIO_UART_TX
440+
{PA_4, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS // Connected to DCMI_HSYNC
441+
{PB_11, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS // Connected to USART3_RX
442+
{PC_11, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS // Connected to uSD_D3
443+
{PD_3, QSPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P2)}, // OCTOSPIM_P2_NCS // Connected to PSRAM_CLK
444+
{PE_11, QSPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OCTOSPIM_P1)}, // OCTOSPIM_P1_NCS // Connected to D8
445+
{PG_12, QSPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_OCTOSPIM_P2)}, // OCTOSPIM_P2_NCS // Connected to OCTOSPIM_P2_CS
446+
{PI_5, QSPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_OCTOSPIM_P2)}, // OCTOSPIM_P2_NCS // Connected to DCMI_VSYNC
447+
{NC, NC, 0}
448+
};

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L4R9xI/TARGET_DISCO_L4R9I/PinNames.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,14 @@ typedef enum {
352352
SYS_WKUP3 = PE_6,
353353
SYS_WKUP4 = PA_2,
354354

355+
/**** QSPI FLASH pins ****/
356+
QSPI_FLASH1_IO0 = PI_11,
357+
QSPI_FLASH1_IO1 = PI_10,
358+
QSPI_FLASH1_IO2 = PI_9,
359+
QSPI_FLASH1_IO3 = PH_8,
360+
QSPI_FLASH1_SCK = PI_6,
361+
QSPI_FLASH1_CSN = PG_12,
362+
355363
/**** STMOD+ pins ****/
356364
STMOD_1 = PA_6,
357365
STMOD_2 = PB_15,

targets/TARGET_STM/TARGET_STM32L4/TARGET_STM32L4R9xI/device/objects.h

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

0 commit comments

Comments
 (0)