Mass storage initialization error with nsib and mcuboot

Board: nRF52840Dk

ncs: v2.3.0.

Hi, I am working on a project in which i need to update bootloader itself and application from the external flash. I also need to make partition where i can store my files using FatFs file system.

My project configuration and overlay setting are below:

When i am running the code then getting error of msc init:

Please help me, what I am doing wrong.

Thanks.

Parents
  • Hi Mithi,

    Currently FAT FS does not work with the Partition Manager enabled. Meanwhile, the Partition Manager is automatically involved when MCUboot, or NSIB, or any other child images are used. Reference:  How to use FATFS with partition manager?  

    Thus, what you are trying to achieve is currently not possible.

    If this is of great importance to your company and product, could you please drop a note with your local Nordic Regional Sales Manager?

    Hieu

    P.s: Please note that it is the summer holiday season here. We are thus understaffed and there would be delay in responses. Our apologies for the inconveniences.

  • By decreasing the size of external flash, I am able to run mass storage device:

            external_flash: partition@e8000 {
                label = "external flash";
                //reg = <0x0000e8000 0x000718000>;
                reg = <0x0000e8000 0x00018000>;
            };
    But I want to consume full size of  external flash memory.
  • You cannot just write the zip file to Flash, unfortunately, as MCUBoot does not support this. Also, MCUBoot has no system to receive both updates in the secondary slot and select the correct one.

    I think you have misinterpreted the documentation:

    >This file can be used by FOTA servers (for example, nRF Cloud) to serve both s0 and s1 to the device. The device can then select the firmware file for the slot that is currently not in use.

    This tries to explain that the device needs to request either S0 or S1 from the server, depending on which slot is active. So you cannot just provide it with both (in Flash), and it will select the correct one. Your FOTA solution could provide both files and then the device could select the correct one based on the active slot.

    As an example, the nRF Cloud server uses the manifest.json file to provide the device with the correct file according to what it requests.


  • Thank you for the clarification.

    For the mcuboot update we need an extra reboot the device, how can we know that we need to reboot the device again  to change the slot for mcuboot?

  • Hi Mithi,

    I must remind you that if the question is not directly related to the main topic of this case (FAT FS with Partition Manager in NCS v2.3.0), you should have opened a new question. I will give a quick answer, but please open a new post for follow-up, if it is unrelated to the main topic.

    When the bootloader is updated:

    • During the first reboot, the "new MCUboot" is still in the secondary slot, where it was downloaded. Then the "old MCUboot" swap the "new MCUboot" to the correct slot.
    • During the second reboot, the "new MCUboot" is in the correct slot, and NSIB boots it.

    When the application is updated, MCUboot can swap the application into the correct slot, and boot it right away.

    By the way, what stage is your project at? NCS v2.5.0 has been released, where the two-stage bootloader support for nRF5340 is completed. You can use it and don't have to worry about any cherry picking.

  • Hi Sigvartmh/Hieu,

    The project is in its final development stage.

    I downloaded the NCS v2.5.0, but it requires at least one cherry-pick:

    https://github.com/sigvartmh/fw-nrfconnect-nrf-1/pull/38/.

    I also need to change swap_misc.c:

    Can I expect these two changes in the upcoming NCS release?

  • Hi Mithi,

    If the project is in its final development stage, then I cannot recommend changing SDK. Your project will need to weigh the cost and benefits.

    The pull request you linked seems internal to Sigvartmh's repository. The support for flash disk API should have been completed in NCS v2.5.0.

    Where did you get that change in swap_misc.c from, and why do you think you need to apply it to NCS v2.5.0?

    I see that the change to swap_misc.c was provided by Sigvartmh below. I believe Sigvartmh is investigating whether the change has to be made permanently or not, so we cannot confirm whether it will be merged in NCS yet.

    Also, as Priyanka has said earlier, on DevZone, we also cannot comment on which NCS release will contain which change.

Reply
  • Hi Mithi,

    If the project is in its final development stage, then I cannot recommend changing SDK. Your project will need to weigh the cost and benefits.

    The pull request you linked seems internal to Sigvartmh's repository. The support for flash disk API should have been completed in NCS v2.5.0.

    Where did you get that change in swap_misc.c from, and why do you think you need to apply it to NCS v2.5.0?

    I see that the change to swap_misc.c was provided by Sigvartmh below. I believe Sigvartmh is investigating whether the change has to be made permanently or not, so we cannot confirm whether it will be merged in NCS yet.

    Also, as Priyanka has said earlier, on DevZone, we also cannot comment on which NCS release will contain which change.

Children
  • Okay.

    The pull request you linked seems internal to Sigvartmh's repository. The support for flash disk API should have been completed in NCS v2.5.0.

    Without this patch, I am getting code build error.

    I see that the change to swap_misc.c was provided by Sigvartmh below. I believe Sigvartmh is investigating whether the change has to be made permanently or not, so we cannot confirm whether it will be merged in NCS yet.

    Please let me know, if you get any solution for the same.

  • With things like this, I think it is reasonable for you to move forward with a cherry-picking version of NCS v2.3.0. To sync up, are there any issues left with that setup? 


    Next, just for the purpose of providing information, and not suggesting a different direction, I want to explain about the support of FAT FS with Partition Manager in NCS v2.5.0.

    Sigvartmh's own PR 38 contains experimental support to automatically create a FAT FS partition. In NCS v2.5.0, without that patch, you will still be able to setup a FAT FS partition manually using a static Partition Manager configuration YML.

    While the sample code in PR 11802 doesn't work. I can get FAT FS working with Partition Manager just fine using a slightly different pm_static.yml file like this:
    (note the affiliation attribute of the storage partition)

    I have checked with the author, and the issue is registered and in investigation. However, right now, the feature works as above.