Flash Storage in nrf connect sdk with mesh

Hi,

I have successfully added nvs in my project and able to store and retrieve data in flash.

But, i can't able to write after initializing mesh.

Could you guide me on this??

Thanks.

Parents
  • Hi

    Please share some more information on what SDK version you're using, whether you're using an nRF52 or nRF53 series device, and what exactly you're trying to do with the NVS in Mesh? As of NCS 2.2.0 we added sections describing FOTA in Bluetooth Mesh for example. Here for nRF52 and here for nRF53.

    Also, please share details on what exactly is going wrong. Are you seeing an error message of any kind when trying to write to flash after initializing Mesh or what?

    Best regards,
    Simon

  • Hi,

    I'm using version 2.0.2 sdk in nrf52, and i'm trying to store a user structure in flash with nvs.

    I have also successfully implemented FOTA  in my project too.

    Update: Now i can able to write data to flash after mesh initialization,

    previously i have called the following functions only once that too before initializing mesh

        fs.flash_device = FLASH_AREA_DEVICE(STORAGE_NODE_LABEL);
        if (!device_is_ready(fs.flash_device)) {
            printk("Flash device %s is not ready\n", fs.flash_device->name);
            return;
        }
        fs.offset = FLASH_AREA_OFFSET(storage);
        rc = flash_get_page_info_by_offs(fs.flash_device, fs.offset, &info);
    
        if (rc) {
            printk("Unable to get page info\n");
            return;
        }
        fs.sector_size = info.size;
        fs.sector_count = 3U;
    
        rc = nvs_mount(&fs);
        if (rc) {
            printk("Flash Init failed\n");
            return;
        }

    and then followed by nvs_write() and nvs_read() wherever i wanted to write/read, that didn't work.

    After that i tried calling the fs_init(code in above section)  before each nvs_write() or nvs_read() and it worked.

    Now i wanted to confirm that, is this the correct procedure for nvs implementation?

Reply
  • Hi,

    I'm using version 2.0.2 sdk in nrf52, and i'm trying to store a user structure in flash with nvs.

    I have also successfully implemented FOTA  in my project too.

    Update: Now i can able to write data to flash after mesh initialization,

    previously i have called the following functions only once that too before initializing mesh

        fs.flash_device = FLASH_AREA_DEVICE(STORAGE_NODE_LABEL);
        if (!device_is_ready(fs.flash_device)) {
            printk("Flash device %s is not ready\n", fs.flash_device->name);
            return;
        }
        fs.offset = FLASH_AREA_OFFSET(storage);
        rc = flash_get_page_info_by_offs(fs.flash_device, fs.offset, &info);
    
        if (rc) {
            printk("Unable to get page info\n");
            return;
        }
        fs.sector_size = info.size;
        fs.sector_count = 3U;
    
        rc = nvs_mount(&fs);
        if (rc) {
            printk("Flash Init failed\n");
            return;
        }

    and then followed by nvs_write() and nvs_read() wherever i wanted to write/read, that didn't work.

    After that i tried calling the fs_init(code in above section)  before each nvs_write() or nvs_read() and it worked.

    Now i wanted to confirm that, is this the correct procedure for nvs implementation?

Children
No Data
Related