Closed bigbearishappy closed 2 years ago
Hi @bigbearishappy ,
to use mbed classes you first need to modify nano33 config file adding "target.components_add" : ["QSPIF"],
(like https://github.com/arduino/ArduinoCore-mbed/blob/master/variants/NICLA/conf/mbed_app.json#L20 ) and recompile libmbed
using mbed-os-to-arduino
script (https://github.com/arduino/ArduinoCore-mbed#adding-an-mbed-target) .
Once done, you can replace this line https://github.com/arduino/ArduinoCore-mbed/blob/master/libraries/USBMSD/src/Singleton.cpp#L82 with an object of type QSPIFBlockDevice
, with the correct pins as you wired them.
Let me know if you need any help with these steps
Thank you so much for you reply.
I tried to follow you steps.
After I add "target.components_add" : ["QSPIF"],
to /variants/ARDUINO_NANO33BLE/conf/mbed_app.json
.
I compiled the libmbed.a with command:
./mbed-os-to-arduino -r /home/pi/work/mbed-os/ ARDUINO_NANO33BLE:ARDUINO_NANO33BLE
it compiled failed when compiling the QSPIFBlockDevice.cpp.Here is the error log:
Compile [ 88.3%]: SlicingBlockDevice.cpp
Compile [ 88.4%]: ObservingBlockDevice.cpp
Compile [ 88.5%]: ffunicode.cpp
Compile [ 88.5%]: QSPIFBlockDevice.cpp
[mbed] ERROR: "/usr/bin/python3" returned error.
Code: 1
Path: "/tmp/mbed-os-program"
Command: "/usr/bin/python3 -u /tmp/mbed-os-program/mbed-os/tools/make.py -t GCC_ARM -m ARDUINO_NANO33BLE --source . --build ./BUILD/ARDUINO_NANO33BLE/GCC_ARM -v"
done.
Generating defines... done.
Generating includes... copying to destination... /tmp/mbed-os-program
done.
Generating libs... done.
Generating flags... done.
Copying generic MbedOS headers to core... done.
Patching 'mbed.h'... done.
Patching SPI headers... done.
[mbed-os-to-arduino] MbedOS core generation ended succesfully.
I tried to run the command:
/usr/bin/python3 -u /tmp/mbed-os-program/mbed-os/tools/make.py -t GCC_ARM -m ARDUINO_NANO33BLE --source . --build ./BUILD/ARDUINO_NANO33BLE/GCC_ARM -v
here is the output of it:
pi@raspberrypi:~/work/ArduinoCore-mbed $ /usr/bin/python3 -u /tmp/mbed-os-program/mbed-os/tools/make.py -t GCC_ARM -m ARDUINO_NANO33BLE --source . --build ./BUILD/ARDUINO_NANO33BLE/GCC_ARM -v
/usr/lib/python3/dist-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.26.7) or chardet (3.0.4) doesn't match a supported version!
RequestsDependencyWarning)
[Warning] @,: Compiler version mismatch: Have 7.3.1; expected version >= 9.0.0 and < 10.0.0
Building project ArduinoCore-mbed (ARDUINO_NANO33BLE, GCC_ARM)
Scan: ArduinoCore-mbed
No Linker Script found
Could not compile for ARDUINO_NANO33BLE: No Linker Script found
I am wondering if you can give me some help to fix this problem. Thanks~
You procedure was correct but I forgot one modification :slightly_smiling_face:
Here's the full patch for mbed_app.json
+++ b/variants/ARDUINO_NANO33BLE/conf/mbed_app.json
@@ -1,6 +1,12 @@
{
"macros": [
- "NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS=8"
+ "NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS=8",
+ "QSPI_FLASH1_IO0=p1",
+ "QSPI_FLASH1_IO1=p1",
+ "QSPI_FLASH1_IO2=p1",
+ "QSPI_FLASH1_IO3=p1",
+ "QSPI_FLASH1_CSN=p1",
+ "QSPI_FLASH1_SCK=p1"
],
"target_overrides": {
"*": {
@@ -12,7 +18,9 @@
"rtos.main-thread-stack-size": 32768,
"cordio.max-connections": 5,
"platform.all-stats-enabled": true,
- "target.mbed_app_start": "0x10000"
+ "target.mbed_app_start": "0x10000",
+ "target.components_add" : ["QSPIF"],
+ "target.device_has_add" : ["QSPI"]
}
}
Of course replace p1
with the pins you are actually using to connect the external QSPI flash
You procedure was correct but I forgot one modification 🙂
Here's the full patch for mbed_app.json
+++ b/variants/ARDUINO_NANO33BLE/conf/mbed_app.json @@ -1,6 +1,12 @@ { "macros": [ - "NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS=8" + "NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS=8", + "QSPI_FLASH1_IO0=p1", + "QSPI_FLASH1_IO1=p1", + "QSPI_FLASH1_IO2=p1", + "QSPI_FLASH1_IO3=p1", + "QSPI_FLASH1_CSN=p1", + "QSPI_FLASH1_SCK=p1" ], "target_overrides": { "*": { @@ -12,7 +18,9 @@ "rtos.main-thread-stack-size": 32768, "cordio.max-connections": 5, "platform.all-stats-enabled": true, - "target.mbed_app_start": "0x10000" + "target.mbed_app_start": "0x10000", + "target.components_add" : ["QSPIF"], + "target.device_has_add" : ["QSPI"] } }
Of course replace
p1
with the pins you are actually using to connect the external QSPI flash
Great, I can compile the libmbed.a successfully now. I am going to make the change and try Nano33BLE_FlashMassStorage.ino now. Before that I have a question. Do I need to format the external QSPI flash before I run the Nano33BLE_FlashMassStorage.ino ??? I ask this question because I find that the arduino edge control support the external QSPI flash and in it's relative demo code. it's need to be format before use as a U disk.
Edge Control flash is being formatted in factory; anyway, adding the formatting phase is very easy (just add this line https://github.com/arduino-libraries/Arduino_EdgeControl/blob/master/examples/Storage/StoragePartitions/StoragePartitions.ino#L92 ) . format()
will also mount the partition so the flow doesn't need many modifications.
Hello, I am working with my arduino 33 ble. And I want to make it work fine with a QSPI flash. I find a demo code in this project. But it's based on the nrf52840's internal flash.
What should I do if I want to make the external QSPI flash works with nano 33 BLE?