Hi,
I have a firmware project that was originally developed for an nRF52833. It successfully mounts LittleFS on 3 partitions in external flash. For the nRF52833 I was simply able to define these partitions in my DTS without using the Partition Manager. This firmware has been rigorously tested for the nRF52833 and LittleFS is successfully configured on external flash. Files can be written and read.
&spi2 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi2_default>;
pinctrl-1 = <&spi2_sleep>;
pinctrl-names = "default", "sleep";
cs-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
mx25u64: mx25u6432f@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <32000000>;
jedec-id = [ c2 25 37 ];
size = <67108864>;
wp-gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
hold-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
sfdp-bfp = [ e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52 10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44 30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff ];
has-dpd;
t-enter-dpd = <10000>;
t-exit-dpd = <35000>;
};
};
&mx25u64 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
user_partition: partition@0 {
label = "user_partition";
reg = <0x00000000 0x00370000>;
};
display_partition: partition@370000 {
label = "display_partition";
reg = <0x00370000 0x0048C000>;
};
log_partition: partition@7FC000 {
label = "log_partition";
reg = <0x007FC000 0x00004000>;
};
};
};
/ {
fstab {
compatible = "zephyr,fstab";
user_lfs: user_lfs {
compatible = "zephyr,fstab,littlefs";
mount-point = "/user";
partition = <&user_partition>;
read-size = <16>;
prog-size = <16>;
cache-size = <64>;
lookahead-size = <32>;
block-cycles = <512>;
};
display_lfs: display_lfs {
compatible = "zephyr,fstab,littlefs";
mount-point = "/display";
partition = <&display_partition>;
read-size = <16>;
prog-size = <16>;
cache-size = <64>;
lookahead-size = <32>;
block-cycles = <512>;
};
log_lfs: log_lfs {
compatible = "zephyr,fstab,littlefs";
mount-point = "/log";
partition = <&log_partition>;
read-size = <16>;
prog-size = <16>;
cache-size = <64>;
lookahead-size = <32>;
block-cycles = <512>;
};
};
};
After porting this project to the nRF5340, it appears the Partition Manager is permanently enabled and my partition definitions in my DTS are ignored. So I created a pm_static.yml file:
littlefs_storage:
address: 0x00000000 # Start of the combined storage area in external flash
region: external_flash
size: 0x00800000 # Total size covering all three partitions
placement:
before: end
user_partition:
address: 0x00000000
region: external_flash
size: 0x00370000
placement:
within: littlefs_storage # Explicitly part of littlefs_storage
display_partition:
address: 0x00370000
region: external_flash
size: 0x0048C000
placement:
after: user_partition
within: littlefs_storage
log_partition:
address: 0x007FC000
region: external_flash
size: 0x00004000
placement:
after: display_partition
within: littlefs_storage
and updated my DTS:
chosen {
nordic,pm-ext-flash = &mx25u64;
};
In my logs I can see that there are attempts to read the external flash, but it is never able to access the individual partitions, even though it was able to for the nRF53833 with the same application code. It always just sees the external flash as one giant partition:
[00:00:03.550,109] <inf> littlefs: FS at mx25u6432f@0:0x0 is 2048 0x1000-byte blocks with 512 cycle
Is this a known issue? Is there a proper way to configure LittleFS partitions on external flash? Any help is appreciated.
Parker