避免使用FATFS因為以某種方式(與核心問題”(與核心問題)僅使用512KB 。請使用Better LittleFS ,您可以在其中選擇64kb至512kb的任何位置。
該庫只是一個簡單的LittleFS包裝器,可以促進您使用arduino-mbed mbed_nano core ,nano_33_ble_sense在MBED NRF52840基於MED NRF52840的板上的使用LittleFS
文件系統訪問使用普通POSIX API或MBED文件系統API
mbed基於seeed_xiao_nrf52840和seeed_xiao_nrf52840_sense等董事會等Arduino IDE 1.8.19+ for Arduino。Arduino mbed_nano core 3.4.1+ for Arduino(使用Arduino Board Manager)MBED NRF52840板,例如Nano_33_ble,Nano_33_ble_sense 。Seeeduino mbed core 2.7.2+用於Seeeduino NRF52840的基於seeed_xiao_nrf52840和Seeed_xiao_nrf52840_sense等基於seeeduino nrf52840 最好和最簡單的方法是使用Arduino Library Manager 。搜索FS_NANO33BLE ,然後選擇 /安裝最新版本。您也可以使用此鏈接以獲取更詳細的說明。
安裝的另一種方法是:
FS_Nano33BLE-main.zip 。FS_Nano33BLE-main目錄FS_Nano33BLE-main文件夾複製到Arduino庫的目錄,例如~/Arduino/libraries/ 。FS_NANO33BLE/示例/fs_test/fs_test.ino
AC168D3中的第11至371行
以下是使用LittleFS上運行示例fs_counting fs_counting fs_counting時的示例終端輸出
Start FS_Test on Nano 33 BLE
LittleFS_Nano33BLE v1 .2.1
FS_size (KB) = 256
FS_ Start Address = 0xC0000
[FS] LittleFS size (KB) = 256
[LFS] LittleFS Mount OK
Deleting file: /littlefs/counts.txt => OK
Times have been run = 1
=> Open to write OK
Start FS_Test on Nano 33 BLE
LittleFS_Nano33BLE v1.2.1
[LFS] LittleFS size (KB) = 256
[LFS] LittleFS Mount OK
=> Open to read OK
Times have been run = 2
=> Open to write OK
Start FS_Test on Nano 33 BLE
LittleFS_Nano33BLE v1.2.1
[LFS] LittleFS size (KB) = 256
[LFS] LittleFS Mount OK
=> Open to read OK
Times have been run = 3
=> Open to write OK以下是使用LittleFS上運行MBED nano_33_ble上運行示例fs_test時的示例終端輸出
Start FS_Test on Nano 33 BLE
LittleFS_Nano33BLE v1 .2.1
FS_size (KB) = 256
FS_ Start Address = 0xC0000
[FS] LittleFS size (KB) = 256
[LFS] LittleFS Mount Fail
[LFS] Formatting...
[LFS]
FS Format OK. Mounting
====================================================
Writing file: /fs/hello1.txt => Open OK
* Writing OK
====================================================
Reading file: /fs/hello1.txt => Open OK
Hello from Nano_33_BLE
====================================================
Appending file: /fs/hello1.txt => Open OK
* Appending OK
====================================================
Reading file: /fs/hello1.txt => Open OK
Hello from Nano_33_BLE
Hello from Nano_33_BLE
====================================================
Renaming file: /fs/hello1.txt to: /fs/hello2.txt => OK
====================================================
readCharsFromFile: /fs/hello2.txt => Open OK
Hello from Nano_33_BLE
Hello from Nano_33_BLE
====================================================
Deleting file: /fs/hello2.txt => OK
====================================================
Reading file: /fs/hello2.txt => Open Failed
====================================================
Testing file I/O with: /fs/hello1.txt => Open OK
- writing
64 Kbytes written in (ms) 2461
====================================================
- reading
64 Kbytes read in (ms) 7
====================================================
Testing file I/O with: /fs/hello2.txt => Open OK
- writing
64 Kbytes written in (ms) 2460
====================================================
- reading
64 Kbytes read in (ms) 7
====================================================
Deleting file: /fs/hello1.txt => OK
====================================================
Deleting file: /fs/hello2.txt => OK
====================================================
Test complete以下是使用fatfs在mbed nano_33_上運行示例fs_test時的示例終端輸出
Start FS_Test on Nano 33 BLE
FATFS_Nano33BLE v1 .2.1
FS_size (KB) = 512
FS_ Start Address = 0x80000
[FS] LittleFS size (KB) = 512
[LFS] FATFS Mount OK
====================================================
Writing file: /fs/hello1.txt => Open OK
* Writing OK
====================================================
Reading file: /fs/hello1.txt => Open OK
Hello from Nano_33_BLE
====================================================
Appending file: /fs/hello1.txt => Open OK
* Appending OK
====================================================
Reading file: /fs/hello1.txt => Open OK
Hello from Nano_33_BLE
Hello from Nano_33_BLE
====================================================
Renaming file: /fs/hello1.txt to: /fs/hello2.txt => OK
====================================================
readCharsFromFile: /fs/hello2.txt => Open OK
Hello from Nano_33_BLE
Hello from Nano_33_BLE
====================================================
Deleting file: /fs/hello2.txt => OK
====================================================
Reading file: /fs/hello2.txt => Open Failed
====================================================
Testing file I/O with: /fs/hello1.txt => Open OK
- writing
64 Kbytes written in (ms) 4374
====================================================
- reading
64 Kbytes read in (ms) 15
====================================================
Testing file I/O with: /fs/hello2.txt => Open OK
- writing
64 Kbytes written in (ms) 4374
====================================================
- reading
64 Kbytes read in (ms) 15
====================================================
Deleting file: /fs/hello1.txt => OK
====================================================
Deleting file: /fs/hello2.txt => OK
====================================================
Test complete默認情況下啟用調試。
您還可以將調試級別( FS_Loglevel )從0更改為4
# define FS_DEBUG_OUTPUT Serial
// These define's must be placed at the beginning before #include "FS_Nano33BLE.h"
// _FS_LOGLEVEL_ from 0 to 4
# define _FS_LOGLEVEL_ 0如果您遇到彙編錯誤,則通常需要安裝Arduino Board的核心版本的較新版本。
有時,只有在您使用新添加的功能時,只有將板核更新為最新版本時,庫才能正常工作。
提交問題:FS_NANO33BLE問題
multiple-definitions鏈接器錯誤NANO33BLE_FS_START地址, LittleFS不會浪費閃存空間。檢查Flash#2的半尺寸mbed支持。allman樣式添加ASTYLE。庫圖書館_FS_LOGLEVEL_ > 3時顯示編譯警告非常感謝大家的錯誤報告,新功能建議,測試和為該庫的開發做出貢獻。
![]() Rob Probin |
如果您想為這個項目做出貢獻:
版權(C)2021- Khoi Hoang