Evite usar FATFS porque de alguma forma (problema com o núcleo ???) Não há problema em usar apenas com 512KB . Use os melhores LittleFS , onde você pode selecionar o tamanho de 64kb a 512kb.
Esta biblioteca é apenas um LittleFS simples para facilitar o uso de LittleFS a bordo do flash nas placas baseadas em nrf52840, como nano_33_ble, nano_33_ble_sense , usando arduino-mbed_nano core
O acesso ao sistema de arquivos usa APIs normais de POSIX ou MBED FileSystem APIs
mbed NRF52840, como Seeed_Xiao_NRF52840 e Seeed_Xiao_NRF52840_Sense , etc. Arduino IDE 1.8.19+ para Arduino.Arduino mbed_nano core 3.4.1+ para Arduino (Use Arduino Board Manager) MBED NRF52840 Placas como Nano_33_ble, Nano_33_ble_sense .Seeeduino mbed core 2.7.2+ para placas baseadas em SeeDuino NRF52840, como Seeed_Xiao_NRF52840 e Seeed_Xiao_NRF52840_Sense A melhor e mais fácil maneira é usar Arduino Library Manager . Pesquise fs_nano33ble e selecione / instale a versão mais recente. Você também pode usar este link para obter instruções mais detalhadas.
Outra maneira de instalar é:
FS_Nano33BLE-main.zip .FS_Nano33BLE-main DirectoryFS_Nano33BLE-main para o diretório das bibliotecas Arduino, como ~/Arduino/libraries/ .Fs_nano33ble/exemplos/fs_test/fs_test.ino
Linhas 11 a 371 no AC168D3
A seguir, é apresentado a saída do terminal de amostra ao executar o exemplo fs_counting em mbed nano_33_ble usando Littlefs
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 OKA seguir, é apresentado a saída do terminal de amostra ao executar o exemplo fs_test no mbed nano_33_ble usando Littlefs
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 completeA seguir, é apresentado a saída do terminal de amostra ao executar o exemplo fs_test no mbed nano_33_ble usando os gordos
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 completeA depuração é ativada por padrão no Serial.
Você também pode alterar o nível de depuração ( fs_loglevel ) de 0 para 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_ 0Se você receber erros de compilação, na maioria das vezes, pode ser necessário instalar uma versão mais recente do núcleo para as placas Arduino.
Às vezes, a biblioteca só funcionará se você atualizar o núcleo da placa para a versão mais recente, porque estou usando funções recém -adicionadas.
Envie questões para: FS_NANO33BLE Issues
multiple-definitionsNANO33BLE_FS_START para LittleFS sem desperdiçar espaço flash. Verifique a metade do tamanho do flash #2mbed Coreallman . Restyle a biblioteca_FS_LOGLEVEL_ > 3Muito obrigado a todos pela reportagem de bugs, novos recursos sugerindo, testando e contribuindo para o desenvolvimento desta biblioteca.
![]() Rob Probin |
Se você deseja contribuir com este projeto:
Copyright (C) 2021- Khoi Hoang