Adding NVS in zigbee sample

We are making ZigBee product. The base we have took is from nrf connect sdk samples light_switch and coordniator example. everything works fine but we need to keep some information stored in NVS/flash.

Mainly for device list in network so that we can relate mac and short address and update it when rejoins. so that when coordinator  restarts it has network device list.

Issue we are facing is that when we add nvs sample code it gives error 

*** Booting nRF Connect SDK v3.5.99-ncs1-1 ***
[00:00:00.020,416] <err> flash_nrf: invalid address: 0x00100ff8:8
[00:00:00.037,841] <inf> fs_nvs: 3 Sectors of 4096 bytes
[00:00:00.038,604] <inf> fs_nvs: alloc wra: 0, fe8
[00:00:00.039,306] <inf> fs_nvs: data wra: 0, 0
[00:00:00.040,039] <err> flash_nrf: invalid address: 0x00100ff8:8
No address found, adding 192.168.1.1 at id 1
[00:00:00.041,351] <err> flash_nrf: invalid address: 0x00100ff8:8
[00:00:00.042,236] <err> flash_nrf: invalid address: 0x00100ff8:8
No key found, adding it at id 2

After research found its due to multi build 
The nRF Connect SDK build system enables sysbuild by default, while Zephyr build system does not. You can select the build system default or choose to explicitly use --sysbuild or --no-sysbuild for your build configuration. 

I am not sure how to fix it still
Any suggestion idea will be helpful!

Parents
  • Hi,

     

    Can you share how you are reproducing this issue?

    When altering the partition layout, it is important that you re-generate the build (ie. delete the build folder, then re-configure) - this is to ensure that the partitions are generated within the address space of the chosen device.

    Your address space seems to be out-of-bounds.

     

    Kind regards,

    Håkon

  • Hi Hakon 
    I am not sure where to alter partition layout 
    in nvs example it used to be mentioned in device tree but if have used zigbee samples 
    not able to find where to add nvs partition or if it has then how to modify it 


  •  
    I found if I comment 

    CONFIG_ZIGBEE_SCENES=y
     it works fine

    but I will need that so how can I fix it any idea?
  • Hi,

     

    Thank you for sharing this, I was able to reproduce the scenario.

    The problem is that ZIGBEE_SCENES uses settings, which uses NVS as the backend.

    The application must then setup a specific storage partition that does not overlap with this settings partition. This can be done by setting a dedicated partition, lets name this "second_storage" here for simplicity:

    // Comment out "original" partition name
    //#define NVS_PARTITION       storage_partition
    #define NVS_PARTITION       second_storage

    Then we adjust the flash by placing this in the myproject/pm_static.yml:

    app:
      address: 0x0
      end_address: 0xf3000
      region: flash_primary
      size: 0xf3000
    settings_storage:
      address: 0xfe000
      end_address: 0x100000
      placement:
        align:
          start: 0x1000
        before:
        - end
      region: flash_primary
      size: 0x2000
    sram_primary:
      address: 0x20000000
      end_address: 0x20040000
      region: sram_primary
      size: 0x40000
    zboss_nvram:
      address: 0xf5000
      end_address: 0xfd000
      placement:
        after:
        - app
        align:
          start: 0x1000
      region: flash_primary
      size: 0x8000
    zboss_product_config:
      address: 0xfd000
      end_address: 0xfe000
      placement:
        after:
        - zboss_nvram
      region: flash_primary
      size: 0x1000
    second_storage:
      address: 0xf3000
      end_address: 0xf5000
      placement:
        align:
          start: 0x1000
        before:
        - end
      region: flash_primary
      size: 0x2000
    

    Ran your on a nrf52840dk_nrf52840 board:

     

    *** Booting nRF Connect SDK v2.8.0-a2386bfc8401 ***
    *** Using Zephyr OS v3.7.99-0bc3393fb112 ***
    I: Starting ZBOSS Light Switch example
    I: 3 Sectors of 4096 bytes
    I: alloc wra: 0, bf8
    I: data wra: 0, 280
    Id: 1, Address: 192.168.1.1
    Id: 2, Key: ff fe fd fc fb fa f9 f8 
    Id: 3, Reboot_counter: 120
    Id: 5, Longarray: 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 20 21 22 23 24 25 26 27 2 
    Reboot counter history: ...120...119...118...117...116...115...114...113...112...111...110...109...108...107...106...105...0
    Oldest reboot counter: 0
    Rebooting in ...5...4...3...2...1
    

    Remember to delete your build folder and regenerate the project when changing the partition layout.

     

    Could you try this and report back?

     

    Kind regards,

    Håkon

  • Hi Hakon 

    this worked but partially If I compile same in mac it gives compilation error second_storage undefined

  • Hi,

     

    Dhaval Dalvadi said:
    this worked but partially If I compile same in mac it gives compilation error second_storage undefined

    I am not sure I understand, did the proposed fix work on one machine and not another?

    Can you share a bit more details on what works and what does not ?

     

    Please note that you have to delete your build folder when explicitly creating a new pm_static.yml file.

     

    Kind regards,

    Håkon

  • Hi 
    It worked in windows system but in mac it gives error as mentioned above 

    had already deleted build folder and have confirmed pm_static.yml there with code you have provided and confirmed in windows that it works fine

Reply Children
No Data
Related