[nRF52] pca10059 Flash FS not available - MBFS as well as VFS/LFS
Posted: Fri Nov 06, 2020 9:43 am
Hi,
Encountering a weird issue I can't troubleshoot after days of attempts and much reading.
Tried with many firmware versions. I have no issue building, flashing and getting various MicroPython running on my dongle, but no file system is available ever.
I'm using a Minew C2 dongle, which is the same hardware as pca10059, nRF52840, just in a nice case.
The dongle comes flashed with Nordic default bootloader, can be programmed with nRF Connect.
Detailling this since this may be part of the issue, I don't want to use a JTAG, ST-link aso to program the dongle.
I need a regular user to be able to flash a stock dongle with only nRF Connect USB SDFU, no hardware.
This bootloader is signed, there is no way to update the bootloader (0x000E0000 - 0x000FDFFF) without hardware.
Programming workflow:
- build micropython with SD=s140
- use nRF Connect programmer, drop soft device hex (MBR+SD 0x00001000 - 0x00025DE7) and firmware.hex (0x00026000 - )
- Write
MicroPython boots up, REPL works fine except flash fs.
1 - Default firmware, current 1.13 with default MBFS:
No error, I can open with 'w' and write a file (returns number of bytes written)
but nothing is written, listdir() remains empty, file can't be read back.
2 - Firmware with LFS support, built from this PR https://github.com/micropython/micropython/pull/5472
file = open("test.txt", "w")
OSError: 1
uos has VfsLfs2, nrf has flashbdev
flashbdev reports the 64K FS I config'd
nrf.flashbdev.ioctl(4, 0)
16
nrf.flashbdev.ioctl(5, 0)
4096
but trying to mkfs fails
uos.VfsLfs2.mkfs(nrf.flashbdev)
OSError: 28
other ioctl calls (init device, sync, erase a block) return 0
3 - Firmware build from a LFS enabled fork: WaspOs, targetting nrf watches (tested myself, working on several watches 52x)
https://github.com/daniel-thompson/wasp-os
Same as 2
What am I missing?
After many tests, only difference I can see with working setup is the uploading process, that does not fully erase the flash beforehand.
May that be the cause?
Is there another way to have the flash FS available, like uploading the FS as .hex as well?
Encountering a weird issue I can't troubleshoot after days of attempts and much reading.
Tried with many firmware versions. I have no issue building, flashing and getting various MicroPython running on my dongle, but no file system is available ever.
I'm using a Minew C2 dongle, which is the same hardware as pca10059, nRF52840, just in a nice case.
The dongle comes flashed with Nordic default bootloader, can be programmed with nRF Connect.
Detailling this since this may be part of the issue, I don't want to use a JTAG, ST-link aso to program the dongle.
I need a regular user to be able to flash a stock dongle with only nRF Connect USB SDFU, no hardware.
This bootloader is signed, there is no way to update the bootloader (0x000E0000 - 0x000FDFFF) without hardware.
Programming workflow:
- build micropython with SD=s140
- use nRF Connect programmer, drop soft device hex (MBR+SD 0x00001000 - 0x00025DE7) and firmware.hex (0x00026000 - )
- Write
MicroPython boots up, REPL works fine except flash fs.
1 - Default firmware, current 1.13 with default MBFS:
No error, I can open with 'w' and write a file (returns number of bytes written)
but nothing is written, listdir() remains empty, file can't be read back.
2 - Firmware with LFS support, built from this PR https://github.com/micropython/micropython/pull/5472
file = open("test.txt", "w")
OSError: 1
uos has VfsLfs2, nrf has flashbdev
flashbdev reports the 64K FS I config'd
nrf.flashbdev.ioctl(4, 0)
16
nrf.flashbdev.ioctl(5, 0)
4096
but trying to mkfs fails
uos.VfsLfs2.mkfs(nrf.flashbdev)
OSError: 28
other ioctl calls (init device, sync, erase a block) return 0
3 - Firmware build from a LFS enabled fork: WaspOs, targetting nrf watches (tested myself, working on several watches 52x)
https://github.com/daniel-thompson/wasp-os
Same as 2
What am I missing?
After many tests, only difference I can see with working setup is the uploading process, that does not fully erase the flash beforehand.
May that be the cause?
Is there another way to have the flash FS available, like uploading the FS as .hex as well?