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

NRF52840DK error caused in app_timer2.c (error code 8)

Hello,

In order to try and implement passkeys, I've implemented my program inside of the glucose app example. The project compiles + runs and crashes sometimes randomly but usually after connecting and entering the passkey.

According to the debugger, the error starts inside of "app_timer2.c"

Then continues to app_error.c with an error code of 8.

Does anyone know what this is?

Thank you!

Parents
  • Hi,

    It is not clear to me which functions return the error code (8 = NRF_ERROR_INVALID_STATE), and the screenshot does not show it. Can you make sure to enable logging and build select "Debug" from the build configuration drop-down? That way the exact location of the error will be printed in the log so that we can know which function returned NRF_ERROR_INVALID_STATE.

  • Hello!

    I understand, for I haven't been able to find out which function returns the error code as well. I have logging and the RTT back-end enabled too but I'm not getting the location of the error. Would the call stack be of any help?

    Thank you!

  • Hi,

    The call stack does indicate a failure in app_timer implementation, as you write, but it would be good to know more. The fact that only "Fatal error" is printed indicates that you are not building the debug configuration, which has more extensive logging (assuming you are basing your application on an SDK example). Can you select "Debug" from the build configuration drop-down menu, rebuild and test again? What does the log say in that case?

    Do you have any code that can reproduce this on a DK that I can run on my side?

  • Yes, I am based on an application example. I have the settings enabled in the sdk_config, but I guess the insufficient DEBUG feedback another issue for me.

    Yes I do have something you could run on an nRF52840DK but I was wondering if there is a way I could send it to you without posting it here? I would consider this program to be "company-sensitive".

  • Hi,

    Nicholas_Nuti said:
    Yes, I am based on an application example. I have the settings enabled in the sdk_config, but I guess the insufficient DEBUG feedback another issue for me.

    Yes. But getting debug logging is very good in this cases, as it typicaly points right at the problem. If you select the Debug build as shown by this image you get it right away:

    This does not do much, but it adds DEBUG and DEBUG_NRF to the list of preprocessor definitions (which is what is relevant for logging), and it sets the optimization level to None, so that the behavior you see actually match the code. This is very important for making life easier when debugging. 

    Nicholas_Nuti said:
    Yes I do have something you could run on an nRF52840DK but I was wondering if there is a way I could send it to you without posting it here? I would consider this program to be "company-sensitive".

    Yes. You can open a new private case where you upload the code and refer to this thread.

Reply
  • Hi,

    Nicholas_Nuti said:
    Yes, I am based on an application example. I have the settings enabled in the sdk_config, but I guess the insufficient DEBUG feedback another issue for me.

    Yes. But getting debug logging is very good in this cases, as it typicaly points right at the problem. If you select the Debug build as shown by this image you get it right away:

    This does not do much, but it adds DEBUG and DEBUG_NRF to the list of preprocessor definitions (which is what is relevant for logging), and it sets the optimization level to None, so that the behavior you see actually match the code. This is very important for making life easier when debugging. 

    Nicholas_Nuti said:
    Yes I do have something you could run on an nRF52840DK but I was wondering if there is a way I could send it to you without posting it here? I would consider this program to be "company-sensitive".

    Yes. You can open a new private case where you upload the code and refer to this thread.

Children
  • Oh, I can't believe I didn't have that selected... Thank you so much for your help!

    The error code that comes up in the terminal is:

    <error> peer_manager_sm: Could not perform security procedure. smd_params_reply() or smd_link_secure() returned NRF_ERROR_INVALID_ADDR. conn_handle: 0
    <error> peer_manager_handler: Unexpected fatal error occurred: error: NRF_ERROR_INVALID_ADDR
    <error> peer_manager_handler: Asserting.
    <error> app: ERROR 16 [NRF_ERROR_INVALID_ADDR] at C:\Nordic\components\ble\peer_manager\peer_manager_handler.c:294
    PC at: 0x00039F85
    <error> app: End of error report

    So it seems to be a connection issue.

  • New Update on the errors as well. If I disable LESC:

    #define SEC_PARAM_LESC                  0

    and I pair... it seems to work fine for a short time in DEBUG mode. BUT when I go to the battery service and turn on notifications, I get another error from the SAADC:


    <info> peer_manager_handler: Peer data updated in flash: peer_id: 0, data_id: Local database, action: Update
    <error> app: ERROR 3735928559 [Unknown error code] at C:\Nordic\modules\nrfx\drivers\src\nrfx_saadc.c:522
    PC at: 0x000320BB
    <error> app: End of error report

  • I'm really only using this glucose example for the passkey. I don't even need a random passkey; I only need a static passkey. This seems to be more trouble than it's worth. Is there a simple way I can simply implement a static passkey?

  • Hi,

    Nicholas_Nuti said:
    Is there a simple way I can simply implement a static passkey?

    Yes. This is essentially the same way as you implement random passkey, just that you additionally specify the passkey by configuring the SoftDevice accordingly.

    This will work smoothly if you take an unmodified GLS example, and just add this snipped at the end of the gap_params_init() function.

        memset(&opt, 0x00, sizeof(opt));
        uint8_t passkey[] = "123456";
        opt.gap_opt.passkey.p_passkey = passkey;
        err_code = sd_ble_opt_set(BLE_GAP_OPT_PASSKEY, &opt);
        APP_ERROR_CHECK(err_code);

  • Thank you for your help Einar! I very much appreciate it.

    Do you have any insight on the previous problem?

Related