Dear community,
I encountered some issues with the nRF port on a nRF52382 board and would like to submit them to you:
- I was unable to turn on some of the features in mpconfigport.h, such as MICROPY_PY_SYS_STDFILES, MICROPY_PY_MATH_SPECIAL_FUNCTIONS, MICROPY_PY_IO_FILEIO and MICROPY_PY_MACHINE_SPI, as `make` would fail with those features on. Is there a way to enable all mpconfigport.h features successfully?
- I noticed that MICROPY_FATFS couldn't be enabled as open("code.py", "wb") would fail when enabled making it impossible to create files onto the board. How to enable successfully the FAT file system?
Thanks for any of your comments.
Questions about the nRF port
Re: Questions about the nRF port
Hi Sebi,
I'm using MICROPY_FATFS very often with the nrf-port together with SD cards, specially if the internal storage of microbitfs is a bit to small for for my usecase, or if i want to have a way to swap out large set of scripts without freezing them.
nrf port sample on mounting hard-soldered SD card:
https://github.com/micropython/micropyt ... mountsd.py
And the SD card driver itself:
https://github.com/micropython/micropyt ... /sdcard.py
I normally copy these to the freeze folder and let them be frozen with a command similar to this:
make BOARD=pca10056 MICROPY_FATFS=1 FROZEN_MPY_DIR=freeze
Hope this was to some help!
Edit:
I figured out when verifying it here, you will also need to add the configuration in your boards/<board>/mpconfigboard.h :
I'm using MICROPY_FATFS very often with the nrf-port together with SD cards, specially if the internal storage of microbitfs is a bit to small for for my usecase, or if i want to have a way to swap out large set of scripts without freezing them.
nrf port sample on mounting hard-soldered SD card:
https://github.com/micropython/micropyt ... mountsd.py
And the SD card driver itself:
https://github.com/micropython/micropyt ... /sdcard.py
I normally copy these to the freeze folder and let them be frozen with a command similar to this:
make BOARD=pca10056 MICROPY_FATFS=1 FROZEN_MPY_DIR=freeze
Hope this was to some help!
Edit:
I figured out when verifying it here, you will also need to add the configuration in your boards/<board>/mpconfigboard.h :
Code: Select all
#define MICROPY_VFS (1)
Re: Questions about the nRF port
Dear c45713,
I am talking to Glenn Rub right?
I was thinking of activating the FAT file system on the main flash memory of a nRF52382 board (it is a fitness tracker wristband and there is no possibility to connect an external SD card to it). As I wrote in this issue on GitHub activating the FAT FS results in an "OSError: [Errno 1] EPERM" error when opening a file. Do you understand the reason for this?
I am talking to Glenn Rub right?
I was thinking of activating the FAT file system on the main flash memory of a nRF52382 board (it is a fitness tracker wristband and there is no possibility to connect an external SD card to it). As I wrote in this issue on GitHub activating the FAT FS results in an "OSError: [Errno 1] EPERM" error when opening a file. Do you understand the reason for this?
Re: Questions about the nRF port
As of today (2019-10-10), it is now possible to activate MICROPY_PY_SYS_STDFILES in mpconfigport.h for the nRF port: see this issue on GitHub and the corresponding commit by @dpgeorge to fix it.
Additionally, MICROPY_PY_MATH_SPECIAL_FUNCTIONS can also be enabled following the recipe presented in the same issue on GitHub.
Additionally, MICROPY_PY_MATH_SPECIAL_FUNCTIONS can also be enabled following the recipe presented in the same issue on GitHub.
Re: Questions about the nRF port
Hi Sebi,
I'll provide you the link to the issue where we discussed. https://github.com/tralamazza/micropython/issues/96
After testing out the different solutions, we decided mostly on IRC to enable microbitfs as default on all targets.
There might be use cases where FatFS would make sense, like in a USB mass storage device scenario. Another alternative might be to take a look at the LittleFS work that is ongoing, that might be a good alternative to microbitfs. If you are still in need of FatFS for the internal flash after reading through the issue i linked, i'll try to help you bundle Ayke's work so that we get it up again.
Yes =)I am talking to Glenn Rub right?
It's definitely possible to use FatFS on the internal flash. However, we discovered that FatFS on internal flash had substantial overhead in terms of space of partition/file table and kind of bad utilization on the flash pages.How to enable successfully the FAT file system?
I'll provide you the link to the issue where we discussed. https://github.com/tralamazza/micropython/issues/96
After testing out the different solutions, we decided mostly on IRC to enable microbitfs as default on all targets.
There might be use cases where FatFS would make sense, like in a USB mass storage device scenario. Another alternative might be to take a look at the LittleFS work that is ongoing, that might be a good alternative to microbitfs. If you are still in need of FatFS for the internal flash after reading through the issue i linked, i'll try to help you bundle Ayke's work so that we get it up again.
Re: Questions about the nRF port
Hi Glenn,
I would like to build a data logger. Are there some limitations with the default microbitFS?
This would be a must indeed! Do the other FS do wear leveling as the LittleFS does?
- rcolistete
- Posts: 352
- Joined: Thu Dec 31, 2015 3:12 pm
- Location: Brazil
- Contact:
Re: Questions about the nRF port
See this MicroPython GitHub issue #6344 "nRF microbit (nRF51822) issues", for example :
- ports/nrf for microbit with default configuration;
- file system microbitfs is not accessible via ufs or Mu Editor. How to externally acess the internal file system ? With official MicroPython for BBC micro:bit ufs and Mu Editor can access the files;
- Ctrl+d in REPL freezes, as well as machine.soft_reset();
- deepsleep() and lightsleep() don't work. It seems that __WFIand __WFE are not working on microbit/nRF51822;
- unstable I2C scan reading;
- with Bluetooth enable (SD=s110), REPL is not accessible at all.
Any comment about these problems ?
- ports/nrf for microbit with default configuration;
- file system microbitfs is not accessible via ufs or Mu Editor. How to externally acess the internal file system ? With official MicroPython for BBC micro:bit ufs and Mu Editor can access the files;
- Ctrl+d in REPL freezes, as well as machine.soft_reset();
- deepsleep() and lightsleep() don't work. It seems that __WFIand __WFE are not working on microbit/nRF51822;
- unstable I2C scan reading;
- with Bluetooth enable (SD=s110), REPL is not accessible at all.
Any comment about these problems ?
Last edited by rcolistete on Thu Aug 20, 2020 4:51 pm, edited 1 time in total.
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).
- rcolistete
- Posts: 352
- Joined: Thu Dec 31, 2015 3:12 pm
- Location: Brazil
- Contact:
Re: Questions about the nRF port
Update : the above issue has a workaround, see my comment in GitHub issue #6344 "nRF microbit (nRF51822) issues" :rcolistete wrote: ↑Tue Aug 18, 2020 1:29 am- file system microbitfs is not accessible via ufs or Mu Editor. How to externally acess the internal file system ? With official MicroPython for BBC micro:bit ufs and Mu Editor can access the files;
basically, by changing 1-2 lines of 'microfs.py' source code, "ufs"/"Mu Editor" work with microbitFS used by MicroPython mainline on nRF (including BBC Micro:bit).
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).
- rcolistete
- Posts: 352
- Joined: Thu Dec 31, 2015 3:12 pm
- Location: Brazil
- Contact:
Re: Questions about the nRF port
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).