Skip to content

Commit bdfe9ad

Browse files
committed
switch to using QSPI bus for external flash
1 parent c5180d4 commit bdfe9ad

File tree

8 files changed

+27
-15
lines changed

8 files changed

+27
-15
lines changed

examples/companion_radio/DataStore.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <Arduino.h>
22
#include "DataStore.h"
33

4-
#if defined(EXTRAFS) || defined(SPIFLASH)
4+
#if defined(EXTRAFS) || defined(QSPIFLASH)
55
#define MAX_BLOBRECS 100
66
#else
77
#define MAX_BLOBRECS 20
@@ -49,7 +49,9 @@ void DataStore::begin() {
4949
#elif defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
5050
// #include <InternalFileSystem.h> // disabled for now, leaving here for dual fs branch
5151
#include <CustomLFS.h>
52-
#include <CustomLFS_SPIFlash.h>
52+
#if defined(QSPIFLASH)
53+
#include <CustomLFS_QSPIFlash.h>
54+
#endif
5355
#endif
5456

5557
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)

examples/companion_radio/main.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ static uint32_t _atoi(const char* sp) {
1414

1515
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
1616
#include <InternalFileSystem.h>
17-
#if defined(SPIFLASH)
18-
#include <CustomLFS_SPIFlash.h>
19-
const int chipSelect = PIN_QSPI_CS;
20-
SPIClass SPI_2(NRF_SPIM2, PIN_QSPI_IO1, PIN_QSPI_SCK, PIN_QSPI_IO0);
21-
DataStore store(FlashFS, rtc_clock);
17+
#if defined(QSPIFLASH)
18+
#include <CustomLFS_QSPIFlash.h>
19+
DataStore store(QSPIFlash, rtc_clock);
2220
#else
2321
#if defined(EXTRAFS)
2422
#include <CustomLFS.h>
@@ -131,12 +129,12 @@ void setup() {
131129
fast_rng.begin(radio_get_rng_seed());
132130

133131
#if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
134-
#if defined(SPIFLASH)
135-
if (!FlashFS.begin(chipSelect, SPI_2)) {
132+
#if defined(QSPIFLASH)
133+
if (!QSPIFlash.begin()) {
136134
// debug output might not be available at this point, might be too early. maybe should fall back to InternalFS here?
137-
MESH_DEBUG_PRINTLN("CustomLFS_SPIFlash: failed to initialize");
135+
MESH_DEBUG_PRINTLN("CustomLFS_QSPIFlash: failed to initialize");
138136
} else {
139-
MESH_DEBUG_PRINTLN("CustomLFS_SPIFlash: initialized successfully");
137+
MESH_DEBUG_PRINTLN("CustomLFS_QSPIFlash: initialized successfully");
140138
}
141139
#else
142140
InternalFS.begin();

src/helpers/IdentityStore.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
#include <FS.h>
55
#define FILESYSTEM fs::FS
66
#elif defined(NRF52_PLATFORM) || defined(STM32_PLATFORM)
7-
#if defined(SPIFLASH)
8-
#include <CustomLFS_SPIFlash.h>
9-
#define FILESYSTEM CustomLFS_SPIFlash
7+
#if defined(QSPIFLASH)
8+
#include <CustomLFS_QSPIFlash.h>
9+
#define FILESYSTEM CustomLFS_QSPIFlash
1010
#elif defined(EXTRAFS)
1111
#include <CustomLFS.h>
1212
#define FILESYSTEM CustomLFS

variants/nano_g2_ultra/platformio.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ build_flags =
4242
-D OFFLINE_QUEUE_SIZE=256
4343
-D DISPLAY_CLASS=SH1106Display
4444
-D PIN_BUZZER=4
45+
-D QSPIFLASH=1
4546
; -D MESH_PACKET_LOGGING=1
4647
; -D MESH_DEBUG=1
4748
build_src_filter = ${Nano_G2_Ultra.build_src_filter}

variants/thinknode_m1/platformio.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ build_flags =
8080
-D OFFLINE_QUEUE_SIZE=256
8181
-D PIN_BUZZER=6
8282
-D AUTO_SHUTDOWN_MILLIVOLTS=3300
83+
-D QSPIFLASH=1
8384
; -D MESH_PACKET_LOGGING=1
8485
; -D MESH_DEBUG=1
8586
build_src_filter = ${ThinkNode_M1.build_src_filter}

variants/thinknode_m1/variant.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ extern const int MISO;
110110
extern const int MOSI;
111111
extern const int SCK;
112112

113+
////////////////////////////////////////////////////////////////////////////////
114+
// QSPI
115+
#define PIN_QSPI_SCK (46)
116+
#define PIN_QSPI_CS (47)
117+
#define PIN_QSPI_IO0 (44) // MOSI if using two bit interface
118+
#define PIN_QSPI_IO1 (45) // MISO if using two bit interface
119+
#define PIN_QSPI_IO2 (7) // WP if using two bit interface (i.e. not used)
120+
#define PIN_QSPI_IO3 (5) // HOLD if using two bit interface (i.e. not used)
121+
113122
////////////////////////////////////////////////////////////////////////////////
114123
// Display
115124

variants/wio-tracker-l1/platformio.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ build_flags = ${WioTrackerL1.build_flags}
8686
-D OFFLINE_QUEUE_SIZE=256
8787
-D DISPLAY_CLASS=SH1106Display
8888
-D PIN_BUZZER=12
89+
-D QSPIFLASH=1
8990
; -D MESH_PACKET_LOGGING=1
9091
; -D MESH_DEBUG=1
9192
build_src_filter = ${WioTrackerL1.build_src_filter}

variants/xiao_nrf52/platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ build_flags =
6666
; -D BLE_DEBUG_LOGGING=1
6767
; -D MESH_PACKET_LOGGING=1
6868
-D MESH_DEBUG=1
69-
-D SPIFLASH=1
69+
-D QSPIFLASH=1
7070
build_src_filter = ${Xiao_nrf52.build_src_filter}
7171
+<helpers/nrf52/SerialBLEInterface.cpp>
7272
+<../examples/companion_radio/*.cpp>

0 commit comments

Comments
 (0)