This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PCA10059 Keeps Resetting after sometime

Hi,

I am developing an app for PCA10059 board. my app works well but after sometime and saving some data on flash, boards keep resetting and did not booted(LD1 blinking in green) and re-programming do not solve problem also. and with increasing Virtual Pages number it work for sometime and then problem again happen and program keep resetting. and also this problem did not happen with PCA10056 board!!

as PCA10059 dose not support in chip debugging i do no have any idea that whats is happening in the CPU?  

can anyone give me an idea to solve the problem??

Parents
  • Hi,

    increasing Virtual Pages number it work for sometime and then problem again happen and program keep resetting.

    Are you referring to the FDS virtual pages? So that the more FDS pages you have reserved, the longer it takes before the issue happens? If so, it is tempting to think that the problem is caused by filling up FDS somehow and that your application does not handle it properly? It is odd that it does not happen with the PCA10056 board, though.

    as PCA10059 dose not support in chip debugging i do no have any idea that whats is happening in the CPU?  

    can anyone give me an idea to solve the problem??

    Since debugging on the dongle is a bit tricky I would consider what could be the difference between when you test on the dongle and the DK, and try to make the situation as similar and possible and see if you can reproduce it on the DK. If that does not work, you can connect the Debug out port on the DK to the SWD lines on the dongle so that you can debug it properly. If you do, just remember that you use firmware that sets the REG0 voltage properly, as described in the nFRF52840 dongle programming tutorial.

  • Thanks for your info,

    With some tricks i found that problem happen when i call fds_init function and it returns FDS_ERR_NO_PAGES error instead of FDS_SUCCESS and then APP_ERROR_CHECK cause cpu reset. 

    so there is anyway to solve the problem?

  • Hi,

    fds_init() returns FDS_ERR_NO_PAGES the number of pages found is less than two (since that is the minimum number of pages required for FDS to work). When searching through the reserved pages, a page can be used by FDS if it is a valid swap page or a valid data page, or if it is empty. If a page is neither empty nor has a valid FDS header, it will not be used by FDS. So the question here is why your FDS pages get corrupted? And the proper fix would be to prevent it from being corrupted. Alternatively, you can work around it by erasing the FDS pages (and loose data) if fds_init returns an error.

    The fact that you only see this issue on the dongle and not on the nRF52840 DK makes the bootloader or DFU process a likely suspect. The bootloader has a concept of reserved pages, which is pages it knows it should stay away from during DFU updates. If you use more FDS pages than the bootloader has reserved, it may use parts of the FDS pages for temporary storage during a DFU update. This will corrupt the FDS pages. How many pages are you using? This is set in sdk_config.h for the bootloader and is 12288 byte = 4 pages in the open USB bootloader project. So if you use more than 4 FDS pages, they may be corrupted by DFU updates.

    I suspect the above explanation is most relevant, but it also seems to be an issue with FDS which could make pages corrupt if there is a reset at just the wrong time during garbage collection (GC). We are still investigating this issue, but if you do GC frequently and/or reset or power cycle the device frequently, then that may also be related.

  • Thanks.

    "Alternatively, you can work around it by erasing the FDS pages (and loose data) if fds_init returns an error."

    there is anyway to erase FDS pages in app? without using j-link and other stuff ?

    "How many pages are you using?"

    at first my app has 50 FDS virtual pages and problem happened. with increasing it to 120 it worked for sometime and again problem happened. and also i am using PCA10059 official bootloader so if it has only 4 data reserved page it may be the reason of problem. 

    "but if you do GC frequently and/or reset or power cycle the device frequently"

    Yes, i am using gc in every delete event of FDS if there was reasonable freeable space(that fstat reports) and also power cycle occur sometimes, but not too much.

  • Hi,

    alireza sadeghpour said:
    there is anyway to erase FDS pages in app? without using j-link and other stuff ?

    Yes, you can erase the FDS pages like you would any other flash page, just make sure you have not initialized FDS yet. There are several libraries that can do flash page erase for you. The cleanest is probably to use fstorage and nrf_fstorage_erase(), since this provides the same API regardless of whether the SoftDevice is in use or not. Alternatively, you can call sd_flash_page_erase() directly if you are always using the SoftDevice.

    alireza sadeghpour said:
    at first my app has 50 FDS virtual pages and problem happened. with increasing it to 120 it worked for sometime and again problem happened. and also i am using PCA10059 official bootloader so if it has only 4 data reserved page it may be the reason of problem. 

    Yes, that seems likely. In that case, deleting the flash from your firmware as described above should solve the issue (provided it is OK for you to erase all FDS data after a DFU has been performed).

    alireza sadeghpour said:
    Yes, i am using gc in every delete event of FDS if there was reasonable freeable space(that fstat reports) and also power cycle occur sometimes, but not too much.

    I see. Then this is less likely (the worst case is if you have a battery-powered product and do GC after every reset. Then when the battery is low, you may get a large number of brow out resets, sometimes happening in the middle of GC since this is done during startup. But it is not relevant in this case).

Reply
  • Hi,

    alireza sadeghpour said:
    there is anyway to erase FDS pages in app? without using j-link and other stuff ?

    Yes, you can erase the FDS pages like you would any other flash page, just make sure you have not initialized FDS yet. There are several libraries that can do flash page erase for you. The cleanest is probably to use fstorage and nrf_fstorage_erase(), since this provides the same API regardless of whether the SoftDevice is in use or not. Alternatively, you can call sd_flash_page_erase() directly if you are always using the SoftDevice.

    alireza sadeghpour said:
    at first my app has 50 FDS virtual pages and problem happened. with increasing it to 120 it worked for sometime and again problem happened. and also i am using PCA10059 official bootloader so if it has only 4 data reserved page it may be the reason of problem. 

    Yes, that seems likely. In that case, deleting the flash from your firmware as described above should solve the issue (provided it is OK for you to erase all FDS data after a DFU has been performed).

    alireza sadeghpour said:
    Yes, i am using gc in every delete event of FDS if there was reasonable freeable space(that fstat reports) and also power cycle occur sometimes, but not too much.

    I see. Then this is less likely (the worst case is if you have a battery-powered product and do GC after every reset. Then when the battery is low, you may get a large number of brow out resets, sometimes happening in the middle of GC since this is done during startup. But it is not relevant in this case).

Children
No Data
Related