Matter window covering example with factory data on nrf5340

Hi,

i'm trying to build the window covering example with factory data on nrf5340 with ncs 2.2.0 according to https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/matter/nrfconnect_factory_data_configuration.html

when running he example it stops with:

E: 178 [DL]Failed to protect the factory data partition.
E: Exited with code 2000016

partition in pm_static.yml is:

factory_data:
address: 0xfb000
size: 0x1000
region: flash_primary
the problem seems to be, that the mater code tries to lock the factory data partition, but fprotect can only lock block of size 0x4000 here: https://github.com/nrfconnect/sdk-nrf/blob/main/lib/fprotect/fprotect_spu.c#L19
Parents Reply Children
  • Hi,

    i haven't tried 2.3.0. The quickest way to reproduce is to start a new window covering example and append these options to prj.conf:

    # Use Factory Data
    CONFIG_CHIP_FACTORY_DATA=y
    # Generate Factory Data from KConifg
    CONFIG_CHIP_FACTORY_DATA_BUILD=y
    CONFIG_CHIP_DEVICE_DISCRIMINATOR=0xF01
     
    i get:
    uart:~$ I: nRF5 802154 radio initialized
    I: 4 Sectors of 4096 bytes
    I: alloc wra: 3, ab8
    I: data wra: 3, 6fc
    *** Booting Zephyr OS build v3.2.99-ncs1 ***
    I: Init CHIP stack
    I: 181 [DL]BLE address: C4:37:98:94:20:A9
    I: 204 [DL]OpenThread SED interval set to 500ms
    I: 219 [DL]OpenThread ifconfig up and thread start
    I: 227 [DL]OpenThread started: OK
    I: 230 [DL]Setting OpenThread device type to SYNCHRONIZED SLEEPY END DEVICE
    E: 238 [DL]Failed to protect the factory data partition.
    E: Exited with code 2000016
  • I am still struggling with building a sample that can reproduce this. Can you please zip and upload a sample that I can build?

    Did you manage to get jsonscheme into your toolchain? I am struggling with this part, and it will not build without.

    BR,

    Edvin

  • Hi

    i can reproduce the behavior with just the changes to the prj.conf, i'll attach a zip.

    just run:
    west build -b nrf5340dk_nrf5340_cpuapp
    west flash
    west attach

    and observe output an /dev/ttyACM1

    window_covering.zip

  • Hello,

    I managed to get it working, and ran it by our Matter team. They confirmed that this is a bug in v2.2.0 and v2.3.0. This will be fixed in a future release, and it is found here, so you can use it now:

    https://github.com/nrfconnect/sdk-nrf/pull/10561

    They said:

    So there are three options. Either increase the factory size, turn off FPROTECT or, as we did in the PR, keep the factory data on one flash page, but overlap the FPROTECT block with the application part. The last one is a bit tricky. It is fixed automatically on the pull request, but the client needs to ensure that the settings partition is not under FPRTOECT. 

    Best regards,

    Edvin

  • Hi,

    thanks. Protection (part of) the application sounds like a good solution, assuming mcuboot handles unlocking on OTA updates.

    The PR looks like it changes the size of the factory data partition to 16K. We can do the same and look into overlaping the protection with the app later, when we run out of flash.

Related