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

Peer manager initialization error: FDS_ERR_USR_LIMIT_REACHED

Hello,

I am using a custom nRF52840 (SDK 14.2.0, SoftDevice S140) based board.

Our boards stopped advertising and upon debugging we saw an error in the peer_manager_init() function. 

On further debugging, we were led to pm_init() function, which led to the pds_init() function, which led to the fds_register(fds_evt_handler). 

It looked like the error was being generated from this function (fds_register). When we looked into fds_register, we saw that we are getting the FDS_ERR_USR_LIMIT_REACHED condition. 

In our case, FDS_Max_users is defined as 4 in the SDK _config.h file. We never edited this file and have been using these boards for 6 months, but this error just came up for the first time in the last two weeks on 3 different boards.

Can anyone explain what FDS_MAX_USERS is, why this error could be happening, and how to fix it?

Thanks!

Parents
  • In our case, FDS_Max_users is defined as 4 in the SDK _config.h file. We never edited this file and have been using these boards for 6 months, but this error just came up for the first time in the last two weeks on 3 different boards.

    We have not seen this behavior before. It seems to be that somehow your device is entering into a state where it is doing more fds_register than you intended. 

    FDS:MAX_USERS are max users(callbacks) that can be registered with fds module.

  • Thanks for the answer Susheel! A couple follow-up questions:

    1) fds_register gets called once every time our main() function runs. main() is only run once upon each power-up.

    m_users gets incremented every time fds_register is called until MAX_USERS is reached, but it never seems to get decremented. I assume that m_users gets reset to zero only when it is reinitialized. Theoretically, if we reflash the device, it should reset and reinitialize everything, but the error persists even after reflashing in order to debug. Any ideas why this might be?

    Should m_users also be reinitialized upon power cycling without reflash? (It doesn't seem to be for us... On one device, the error popped up after power cycling maybe 15-20 times over the course of several hours, a few days after flashing with new firmware.)

    2) Is there any downside to increasing the number of max users to a higher number, like 10 or 10000000 as a temporary fix? What's the reason for limiting the number of max users?

    Thanks a lot for your help!

  • In case it is helpful information, this ticket is also us, but the error here and there are happening on separate boards. All the boards worked fine for months until roughly last week. 

  • Sorry for late reply Nordev,

    I got sick for few days (no, it was not the corona ;) )

    nordev said:
    m_users gets incremented every time fds_register is called until MAX_USERS is reached, but it never seems to get decremented. I assume that m_users gets reset to zero only when it is reinitialized

     You are correct, There is no fds de-registration (as we did not see it is required). But I think there is an issue in the code where m_users is not initiatized to 0 in the init function. So it seems like if you re-init the fds, then the m_users wills till retain its old value. this seems like a bug.

    At power on or any reset, if you are doing RAM retention on the sector where m_users is residing, then the reset should clear the value of all uninitialized global static variables.

     

    nordev said:
    2) Is there any downside to increasing the number of max users to a higher number, like 10 or 10000000 as a temporary fix? What's the reason for limiting the number of max users?

     Yes, Just increase the FDS_MAX_USERS in the sdk_config.h file in your project. The reason for limiting this value is 1) to have clear architectural control on your software to see how many modules needs access to flash related procedures and 2) limit the usage of RAM as each registration will consume an extra few tens of bytes for the structure that needed to be allocated to store the information of the new registered module activity.

Reply
  • Sorry for late reply Nordev,

    I got sick for few days (no, it was not the corona ;) )

    nordev said:
    m_users gets incremented every time fds_register is called until MAX_USERS is reached, but it never seems to get decremented. I assume that m_users gets reset to zero only when it is reinitialized

     You are correct, There is no fds de-registration (as we did not see it is required). But I think there is an issue in the code where m_users is not initiatized to 0 in the init function. So it seems like if you re-init the fds, then the m_users wills till retain its old value. this seems like a bug.

    At power on or any reset, if you are doing RAM retention on the sector where m_users is residing, then the reset should clear the value of all uninitialized global static variables.

     

    nordev said:
    2) Is there any downside to increasing the number of max users to a higher number, like 10 or 10000000 as a temporary fix? What's the reason for limiting the number of max users?

     Yes, Just increase the FDS_MAX_USERS in the sdk_config.h file in your project. The reason for limiting this value is 1) to have clear architectural control on your software to see how many modules needs access to flash related procedures and 2) limit the usage of RAM as each registration will consume an extra few tens of bytes for the structure that needed to be allocated to store the information of the new registered module activity.

Children
No Data
Related