nRF52833, Using MCUBoot with an external at45db641e flash drive for DFU

We are trying to understand whether it is possible to use our external flash drive at45db641e to implement DFU and then load the application firmware via Bluetooth.
As far as I know, the at45db641e is not an SPI NOR, and I was able to add it to the project by analogy with the existing example:
https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-9-bootloaders-and-dfu-fota/topic/exercise-3-dfu-with-external-flash/


We defined the external flash in the .overlay file as:

&spi2 {
status = "okay";
pinctrl-0 = <&spi2_default>;
pinctrl-1 = <&spi2_sleep>;
pinctrl-names = "default", "sleep";
cs-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;

at45db0: at45db641e@0 {
compatible = "atmel,at45";
reg = <0>;
spi-max-frequency = <15000000>;
jedec-id = [1f 28 00];
size = <67108864>;
sector-size = <262144>;
block-size = <2048>;
page-size = <256>;
enter-dpd-delay = <2000>;
exit-dpd-delay = <100000>;
status = "okay";

#address-cells = <1>;
#size-cells = <1>;

partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

ext_flash_area: partition@0 {
label = "external_flash";
reg = <0x00000000 0x0800000>; /* 8 MB */
};
};
};
};

and by analogy, for mcuboot.overlay.
Can we use this ext flash? If so, what files should we attach to you for analyze?





  • Hello,

    You must also set the nordic,pm-ext-flash property for your ext flash device in your MCUboot and application's devicetree overlay as mentioned in the linked devafademy course. Apart from that it looks ok. To verify your configuration you need to run the app+mcuboot on your device. We are not testing DFU with this specific HW combination.

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

    You can also verify that you are able to interface with this chip using the sample here: 

    https://docs.nordicsemi.com/bundle/ncs-3.1.1/page/zephyr/samples/drivers/spi_flash_at45/README.html

    Best regards,

    Vidar

  • We're unable to build the project with the external at45db641e flash overlay (for mcuboot), probeply reason in mcuboot.overlay or mcuboot.conf files.

    We get errors like:
    C:/ncs/v2.7.0/zephyr/include/zephyr/toolchain/gcc.h:87:36: error: static assertion failed: "Please enable GPIOTE instance for used GPIO port!"
    87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)

    or 

    undefined reference to z_impl_k_sem_give
    undefined reference to z_impl_k_sem_take

    undefined reference to __device_dts_ord_104


    I'm attaching the following files for the project structure:
    sysbuild/
    - mcuboot.conf
    - mcuboot.overlay

    And also our overlay:
    - 52833.overlay

    We also have a custom overlay for nrf52833, I'm attaching the .dts file.sw52833.dts0412.prj.conf1222.mcuboot.conf6012.mcuboot.overlay

  • I see you are disabling multithreading support in mcuboot by setting CONFIG_MULTITHREADING to "=n" in your mcuboot.conf file, but this is required by the SPI driver (dependency on this has been removed in latest SDK). CONFIG_SPI=y is also commented out.

    Stas Jis said:
    C:/ncs/v2.7.0/zephyr/include/zephyr/toolchain/gcc.h:87:36: error: static assertion failed: "Please enable GPIOTE instance for used GPIO port!"
    87 | #define BUILD_ASSERT(EXPR, MSG...) _Static_assert(EXPR, "" MSG)

    I see you are enabling the GPIOTE node in your mcuboot.overlay so not sure why this assert is raised. Have you tried doing the same in your sw52833.dts board file? Perhaps the assert is raised when building the application?

  • The CONFIG_SPI=y parameter is not commented anywhere (I rechecked 52833.overlay & mcuboot.overlay), may be you mean CONFIG_SPI_NOR ? But this ext flash isn't NOR.

    I excluded next options from 52833.overlay:

    // &gpiote {
    // status = "okay";
    // };

    // &gpio1 {
    // status = "okay";
    // gpiote-instance = <&gpiote>;
    // };

    And included them in the .dts file.

    I also enabled the option CONFIG_MULTITHREADING=y in mcuboot.conf

    So, we managed to build the project, but it immediately starts with bootloader errors:

    *** Booting MCUboot v2.1.0-dev-daf2946a0f07 ***
    *** Using nRF Connect SDK v2.7.0-5cb85570ca43 ***
    *** Using Zephyr OS v3.6.99-100befc70c74 ***
    I: Starting bootloader
    E: Failed to open flash area ID 1 (image 0 slot 1): -2, cannot continue

    75575.prj.conf0702.sw52833.dts5582.mcuboot.overlay1362.mcuboot.conf52833.overlay

  • Sorry, I must have misread CONFIG_SPI_NOR as CONFIG_SPI. Either way, please make sure you add CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y to your mcuboot.conf. This is needed to allow the bootlloader to access the external flash.

Related