避免使用FATFS因为以某种方式(与核心问题”(与核心问题)仅使用512KB 。请使用Better LittleFS ,您可以在其中选择64kb至512kb的任何位置。
该库只是一个简单的LittleFS包装器,可以促进您使用MEBED NRF52840板上的板载LittleFS的使用,例如Nano_33_ble,Nano_33_ble_sense ,使用arduino-mbed mbed_nano core,
文件系统访问使用普通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