nrf54L15, mx24r64 and FOTA

I have searched all responses here and whatever sources I can find, but not have any success.  
The main problem is that existing materials appear incompatible with the 54L range of parts, so following guides and dev academy materials proved somewhat frustrating.
The other observation is, I am starting out with Nordic and Zephyr as a beginner, and my entry device is a 54L15. That's probably part of the problem. No history with older parts.

So firstly, the elephant in the room … why is there no example for FOTA using the external flash memory and the 54L part?
Hopefully, if answers are posted here, maybe that elephant can be removed.

Board used is a Ezerio 54L15 Kit. (basically the same as a Nordic version - same pinout for MX25r64)
Project I am using as a base example is the "peripheral_lbs".
The board file used is nrf54l15dK/nrf54l15/cpuapp.
The overlay file is as below.
Build selected is sysbuild
Tool Chain is V3.0.2

Now regards adding FOTA, existing materials do appear somewhat applicable. The issue I believe I am facing is not knowing if the external flash is being addressed correctly.
This is where there is so much conflicting information on how to configure the flash for a 54L device and how to partition. Is the partition manager instruction applicable the 54 device?
To add, my current status is that I am able to do a sysbuild, load board with firmware and get the DFU symbol on the Nordic Phone app to appear. Downloading a new zip file with updated revision status does not write to external flash, but rather to address 0x000C4800 of the 54l memory space. Hence I believe there is an issue with how the flash is configured.

My prj.conf

CONFIG_NCS_SAMPLES_DEFAULTS=y
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Nordic_LBS"
CONFIG_NORDIC_QSPI_NOR=y

# Enable the LBS service
CONFIG_BT_LBS=y
CONFIG_BT_LBS_POLL_BUTTON=y
CONFIG_DK_LIBRARY=y
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

I manually created sysbuild.conf which has

SB_CONFIG_PARTITION_MANAGER=y
SB_CONFIG_BOOTLOADER_MCUBOOT=y


My overlay file...

/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
};
};

/delete-node/ &boot_partition;
/delete-node/ &slot0_partition;
/delete-node/ &slot1_partition;

/delete-node/ &slot0_ns_partition;
/delete-node/ &slot1_ns_partition;

/delete-node/ &storage_partition;

&cpuapp_rram {
reg = < 0x0 DT_SIZE_K(1524) >;
partitions {
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x000000000 0x00014000>;
};
slot0_partition: partition@14000 {
label = "image-0";
reg = <0x000014000 0x0015A000>;
};
storage_partition: partition@16E000 {
label = "storage";
reg = < 0x16E000 0x9000 >;
};
};
};

&mx25r64 {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

slot1_partition: partition@0 {
label = "image-1";
reg = <0x000000000 0x0015A000>;
};
};
};


&pinctrl {
spi00_default: spi00_default {
group1 {
psels = <NRF_PSEL(SPIM_MISO, 2, 4)>,
<NRF_PSEL(SPIM_MOSI, 2, 2)>,
<NRF_PSEL(SPIM_SCK, 2, 1)>;
};
};

/omit-if-no-ref/ spi00_sleep: spi00_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 2, 1)>,
<NRF_PSEL(SPIM_MOSI, 2, 2)>,
<NRF_PSEL(SPIM_MISO, 2, 4)>;
low-power-enable;
};
};
};

&spi00 {
status = "okay";
cs-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
pinctrl-0 = <&spi00_default>;
pinctrl-1 = <&spi00_sleep>;
pinctrl-names = "default", "sleep";

mx25r64: mx25r6435f@0 {
compatible = "jedec,spi-nor";
status = "okay";
reg = <0>;
spi-max-frequency = <2000000>;
jedec-id = [c2 28 17];
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 48 44
30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
];
size = <67108864>;
has-dpd;
t-enter-dpd = <10000>;
t-exit-dpd = <35000>;
};
};


Lastly, I did go into the nRF Kconfig GUI and "tick" NVS, but did not see any change.
Thank You.

Parents
  • Hello,

    So firstly, the elephant in the room … why is there no example for FOTA using the external flash memory and the 54L part?

    In general there are samples, but most of the samples showcasing FOTA in NCS also showcases (mainly) other things. 

    The main problem is that existing materials appear incompatible with the 54L range of parts, so following guides and dev academy materials proved somewhat frustrating.

    You also mention the academy pages, but I'm not certain which courses you've gone through. Both the fundamentals and intermediary course (as well as the BLE fundamentals course) have support for the nRF54L15DK, so could you describe closer which parts that you're having issues with w.r.t compatability?

    So firstly, the elephant in the room … why is there no example for FOTA using the external flash memory and the 54L part?

    Based on your configurations it seems to me that you've been following https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-9-bootloaders-and-dfu-fota/ to some extent at least. The reason for why the https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-9-bootloaders-and-dfu-fota/topic/exercise-5-fota-over-bluetooth-low-energy/ does not contain an external flash is because for the purpose of the academy courses we keep the samples as minimal as we can. This means that users will have to merge the exercise 3 containing steps for how to configure the external flash for DFU with the transport for FOTA that the user chooses. The only exception is the simultaneous DFU for the nRF5340 which requires external flash to work (mentioned at the bottom of Exercise 5). 

      

    This brings me to the reason for why your update image is not being loaded to the external flash; you're missing some configurations from exercise 3, which you can see here: https://github.com/NordicDeveloperAcademy/ncs-inter/blob/main/l9/l9_e3_sol/spi/sysbuild.conf, more specifically in steps 1-3 in https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-9-bootloaders-and-dfu-fota/topic/exercise-3-dfu-with-external-flash/  (select the SPI tab whenever you can for the nrf54L15

    This is where there is so much conflicting information on how to configure the flash for a 54L device and how to partition. Is the partition manager instruction applicable the 54 device?

    Could you point me to the conflicting information so I can bring the feedback to the authors and/or help you clarify any misunderstandings?

    Let me know if this clarifies the uncertainties for you.

    Kind regards,
    Andreas

  • Andreas ..Thank you for taking the time to respond. Much appreciated.

    I have been mainly following this youtube video by Nordic .. www.youtube.com/watch
    In addition, I have searched through many material looking for clues, but its difficult and confusing for a Nordic beginner to make sene of it all. A lot to take in and also to miss.
    Never the less, your comment are certainly helpful and some progress made, but also a step back that hopefully is simple to remedy.

    Changes made:

    Created a directory sysbuild.
    Inside sysbuild, created file mcuboot.conf and mcuboot.overlay

    mcuboot.conf has only ..
    CONFIG_GPIO=y
    CONFIG_NORDIC_QSPI_NOR=y

    mcuboot.overlay has only..

    &mx25r64 {
    status = "okay";
    };

    / {
    chosen {
    nordic,pm-ext-flash = &mx25r64;
    };
    };


    Then in sysbuild.conf, I comment out
    #SB_CONFIG_PARTITION_MANAGER=y
    and added
    SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
    # Step 3.1 - For SPI, we need to set this
    SB_CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y

    This in accordance to Exercise 3: DFU with External Flash

    The moment I add SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y

    the mcuboot complile section fails with

    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/libzephyr.a(flash_map_partition_manager.c.obj):(.rodata.default_flash_map+0x1c): undefined reference to `__device_dts_ord_117'

    The memory map does look better and it is showing up the second boot image in Flash.. so thats good.
    Out of interest, if I leave out SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y, the entire project will compile, but when board is programmed, the app fails to run.

  • Hi,

    Could you attach the full build log in a .txt here? I'm curious to see if the board file you mention are being picked up since you mention that you're using the Ezerio 54l15 kit

    Could you also zip a somewhat minimal project that I can have a look at and compare with the solution I have for the nRF54L15DK?

    Kind regards,
    Andreas

  • Hi Andreas.   

    The Ezerio point is of no concern  ... board selected is a standard Nordic board as per pic sent.    The compile fails, so not even able to program the board.   

    The zip file is a basic project downloaded via the new project/copy a sample.   Then changes added as per the tutorials found.   Chances are that I have missed something.

    Thank you

    Brian

     1200.peripheral_lbs_1.zip

  • Noted, thank you for clarifying

    I will look into the zip tomorrow (10th of July) and get back to you with (hopefully) something more constructive then

    Kind regards,
    Andreas

  • Hi again,

    I've had a brief look through your zip and I've created a sample for you that compiles, builds and flashes (tested on nrf54l15dk/nrf54l15/cpuapp)

    Sample goes through the booting process and starts advertising as expected

    And the partition manager sets up the secondary mcuboot partition for the update image on the SPI connected external flash device: 

    Please compare this sample to your solution and let me know if you're able to spot any differences between this zip and your project

    7_54l15_fota_ext.zip

    Kind regards,
    Andreas

  • Hello Andreas

    " let me know if you're able to spot any differences"

    You kidding right (LOL)... cheezzz .. a lot different.   So my first thought is .. is this kind of detail referenced anywhere?  Clearly the examples I have been working through has not covered this level of detail.   I will work through it to gain understanding and if all good, translate it to the main project I am working on.  Thank you for taking the time and energy to provide the zip.

    Will provide feedback on the results a little later.

    Brian

Reply
  • Hello Andreas

    " let me know if you're able to spot any differences"

    You kidding right (LOL)... cheezzz .. a lot different.   So my first thought is .. is this kind of detail referenced anywhere?  Clearly the examples I have been working through has not covered this level of detail.   I will work through it to gain understanding and if all good, translate it to the main project I am working on.  Thank you for taking the time and energy to provide the zip.

    Will provide feedback on the results a little later.

    Brian

Children
  • Hello again Andreas.

    I had high hopes ....  Opened your file and tried to build.   

    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Work/7_54l15_fota_ext/build/7_54l15_fota_ext
    [1/329] Generating include/generated/zephyr/app_version.h
    -- git describe failed: fatal: not a git repository (or any of the parent directories): .git
    [5/329] Generating include/generated/zephyr/version.h
    -- Zephyr version: 4.0.99 (C:/ncs/v3.0.1/zephyr), build: v4.0.99-ncs1-1
    [324/329] Linking C executable zephyr\zephyr_pre0.elf
    FAILED: zephyr/zephyr_pre0.elf zephyr/zephyr_pre0.map C:/Work/7_54l15_fota_ext/build/7_54l15_fota_ext/zephyr/zephyr_pre0.map 
    cmd.exe /C "cd . && C:\ncs\toolchains\0b393f9e1b\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe  -gdwarf-4 @CMakeFiles\zephyr_pre0.rsp -o zephyr\zephyr_pre0.elf -L"c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/thumb/v7e-m/nofp" -lc -lgcc && cmd.exe /C "cd /D C:\Work\7_54l15_fota_ext\build\7_54l15_fota_ext\zephyr && C:\ncs\toolchains\0b393f9e1b\opt\bin\cmake.exe -E true""
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/libzephyr.a(flash_map_partition_manager.c.obj):(.rodata.default_flash_map+0x1c): undefined reference to `__device_dts_ord_131'
    c:/ncs/toolchains/0b393f9e1b/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd.exe: zephyr/libzephyr.a(flash_map_partition_manager.c.obj):(.rodata.default_flash_map+0x6c): undefined reference to `__device_dts_ord_131'
    collect2.exe: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    [10/20] No configure step for 'mcuboot'
    FAILED: _sysbuild/sysbuild/images/7_54l15_fota_ext-prefix/src/7_54l15_fota_ext-stamp/7_54l15_fota_ext-build C:/Work/7_54l15_fota_ext/build/_sysbuild/sysbuild/images/7_54l15_fota_ext-prefix/src/7_54l15_fota_ext-stamp/7_54l15_fota_ext-build 
    cmd.exe /C "cd /D C:\Work\7_54l15_fota_ext\build\7_54l15_fota_ext && C:\ncs\toolchains\0b393f9e1b\opt\bin\cmake.exe --build ."
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\0b393f9e1b\opt\bin\cmake.EXE' --build C:/Work/7_54l15_fota_ext/build
    

    The missing node issue in this case is ..

    /* Node's dependency ordinal: */
    #define DT_N_S_soc_S_qspi_40029000_S_mx25r6435f_0_ORD 131
    #define DT_N_S_soc_S_qspi_40029000_S_mx25r6435f_0_ORD_STR_SORTABLE 00131

    Not sure if I am now not defining something in the build table.  

    Thank You

    Brian


     

  • Jasper_Golden said:
    is this kind of detail referenced anywhere

    I guess "FOTA for the nRF54L15 with secondary partition located on the external flash" is not documented explicitly anywhere, but here's a breakdown of what I did

    1. Made a copy of the solution from Lesson 9, exercise 5 of the intermediate course. This sample is basically the peripheral_lbs sample with added BLE FOTA support for single bank without internal flash. By following the course content you will get an overview over how to create a BLE application, and the solution should work out of the box for the nrf54l15dk/nrf54l15/cpuapp build target
    2. Next I took the contents of Lesson 9, exercise 3, and added that to my copy of the solution of the previous step. Since the nrf54l15 has the external flash connected over SPI, I had to choose the SPI solution
    3. I made a board directory where I took the contents of the "app_mx.overlay" and pasted that into the boards/nrf54l15dk_nrf54l15_cpuapp.overlay that you see in the zip
      1. The reason for why I'm doing this is so that for every time I compile the project for the nRF54L15DK CPUapp target it will pick up this specific overlay file
    4. I copied the missing configurations from L9E3 SPI -> into my copy of L9E5
      1. This is for both prj.conf, sysbuild.conf
    5. I created a sysbuild folder where I created the files mcuboot.conf and mcuboot.overlay and pasted the respective components from L9E3 sysbuild/mcuboot.conf and sysbuild/mcuboot_mx.overlay into these files
    6. I looked through the main files of the L9E3 and copied the lacking code (which was basically just some optional LED stuff) and pasted into my application

    Now for where this is documented:

    If I were to follow the same steps only using the documentation and not the academy exercises this is how I would've done it (which is easy to say for me since I know where to look in the docs):

    1. I would've chosen a BLE sample such as the peripheral_lbs sample that you chose because that is a relatively minimal sample that sets up BLE and advertising. Alternatively I would've used the smp server sample, which is mentioned in the quick start guide found under 2c below (which also mentions the academy pages)
    2. At https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev.html I would've looked at 
      1. https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev/device_guides/nrf54l/index.html 
      2. https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev/bootloaders_dfu/index.html 
      3. https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev/bootloaders_dfu/mcuboot_nsib/bootloader_quick_start.html 
    3. From here I would've had a look at the working with 54L and "FOTA updates...." page https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev/device_guides/nrf54l/fota_update.html and followed the steps here
    4. W.r.t using the external flash partitioning I would've followed the steps here  https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/app_dev/bootloaders_dfu/mcuboot_nsib/bootloader_partitioning.html#using_external_flash_memory_partitions which takes you to the generic partition manager script here https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/scripts/partition_manager/partition_manager.html#pm-external-flash with an example of how to set up the mx25 for qspi for the nRF5340
      1. Question now becomes how to set up the external flash for SPI instead of QSPI, which you would have to either find a solution for by examining samples with this support for either the nRF9160/61 or the nRF54L15 which both has SPI set up to communicate with the external flash and copy that implementation

    But this leaves us with the troublesome part; this is a lot of work and with no sample reference you may spend quite a bit of time going through these docs without any finding anything explicitly mentioning "FOTA with external flash for the nRF54L15".

    TLDR I can completely understand the struggles with finding the correct documentation if you don't know where to look/don't find the academy pages immediately!...

    Edit: PS I saw your latest comment after posting this. Will reply shortly

    Kind regards,
    Andreas

  • Jasper_Golden said:
    I had high hopes ....  Opened your file and tried to build.   

    I double checked that I could build it with VS Code extension and not just in command line and it build out of the box for me using this configuration. 

    I see that you have an overlay in the image you attached. Could you 

    1. Delete any build folders that are within the project you're currently working with so that we ensure a completely pristine build
    2. Build with the same setup as I've done in the image pasted above

    Kind regards,
    Andreas

  • Hi Andreas .... and apology! 

    I glazed over the build setup and did not pick up that it was automatically selecting the wrong CPU/board. (82 part)  I thought it would have selected the 54L as that was the board we dealing with.  Completely missed that detail.

    I can confirm that it compiles fully without errors.   Thank you once again.   

    I still need to go over the detail you provided in previous message in order that I can make sense/learn how you put  this together.    Thank You again.  I think you could close this thread now.   If I find anything else, can start something new for that. 

    Regards

    Brian

  • Great! Glad to hear that the firmware is compiling on your end as well! 

    I will mark this case as resolved for now, but feel free to ask follow up questions. I will however be OoO from tomorrow for a few weeks, so a reply should come faster from our side if you create new cases than if you reply with a follow up here 

    Kind regards,
    Andreas

Related