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

pm_peer_new() causing "PM_EVT_ERROR_UNEXPECTED"

Hi,

I want to add new peer to peer manager using pm_peer_new().

pm_peer_id_t p1 = 0;

pm_peer_new(&p1,&bond_info,NULL);

there are no peers, so trying to add as peer_id 0. but this causing "PM_EVT_ERROR_UNEXPECTED" error in pm_evt_handler() function.

bond_info is filled with information.

Parents Reply Children
  • Please set PM_LOG_LEVEL to 4 in the sdk_config.h and provide the debug log. Thanks. 

    -Amanda H.

  • same log is coming. no <debug> information is printing even after setting PM_LOG_LEVEL  to 4

    <info> app_timer: RTC: initialized.
    <error> peer_manager_pds: Could not write data to flash. fds_record_{write|update}() returned 0x8601. peer_id: 0
    <error> peer_manager_pds: Could not delete peer data. fds_file_delete() returned 0x8601 for peer_id: 0
    <error> peer_manager_handler: Unexpected fatal error occurred: error: Unknown error code
    <error> peer_manager_handler: Asserting.
    <error> app: Fatal error

  • Hi Surya, 

    I can reproduce the issue with the code in this post, but I need time to investigate. 

    -Amanda H.

  • Hi Surya, 

    Sorry for the delay. 

    You need to do is to wait for the FDS init event before adding the peer data. The initialization takes longer the first time you boot the device as it has to tag each FDS page with the magic words. See Page tag documentation. Then, all pages have been tagged when you get the init event.

    What you need to do is to wait for the FDS init event before adding the peer data. 

    -Amanda H.

  • I have done the following

    1.Registering a Handler for fds events
    err_code = fds_register(fds_evt_handler);
    APP_ERROR_CHECK(err_code);

    2. Handle FDS_EVT_INIT event

    static void fds_evt_handler(fds_evt_t const * const p_evt)
    {
        if (p_evt->id == FDS_EVT_GC)
        {
           NRF_LOG_DEBUG("GC completed\n");
        }
        else if(p_evt->id == FDS_EVT_INIT)
        { 
           bFDSInitialized = true;
        }
    }

    but bFDSInitialized never becomes true. 

    and also I tried to give a delay of 25 Seconds before calling pm_peer_new() but the same error is coming.

    I don't think it will take that much time, is it?

    I am using the following setting in sdk_config.h

     #ifndef FDS_VIRTUAL_PAGES
    #define FDS_VIRTUAL_PAGES 3
    #endif

    means 2 for Data 1 for Garbage Collection

    but when I read memory garbage collection page tag is correct whereas the remaining 2 pages page tag is not correct (it has to be 0xDEADC0DE 0xF11E01FE)


Related