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!

  • 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?

  • Hi,

    Nicholas_Nuti said:
    Do you have any insight on the previous problem?

    It seems like you get errors all over the place, and not always with sensible error codes.

    Regarding the specific errors you mentioned in the last few posts:

    • SAADC: Assuming you use SDK 16, there is an assert on line 522 in nrfx_saadc.c that will trigger if you try to sample without having the SAADC initialized. Is that the problem here?
    • For the peer manager error, it may be needed to debug a bit to understand what is going on. The error is essentially an assert from the peer manger, with an unexpected error.

    None of the errors are expected, so I wonder what state your application is in. Have you based it on an example project? Which modifications did you to? What modifications lead to these problems? I you do not have progress, can you upload your full project here so that I can test on my side on a DK? Which SDK version do you use?

  •  Yeah I do get errors. I guess that comes with rushed development on a mcu I've never used before.

      As for the SAADC I have it initialized in the beginning of my program but I can check it. Thank you for the suggestion.  I assume the unexpected errors can be overcome with setting custom conditional statements in that ble event handler. I'm going to try it next week. 

    Yes, I based my project on the very most basic ble template. I forget the name currently but I can check next week. Modifications I've made: saadc, added a ble service, ble characteristic, modified the basic sleep and wake up, hold bonds on wake up, and added a static passkey. This is a very basic implementation but it's rushed. I'm at the point of where Im optimizing for battery and I started a private post. I use SDK 16. Thanks for asking.

    Im not used to the... type of documentation and methods of learning how to use this device. Before I was using a scilabs device that had a plethora of documentation and it was great. It seems to be hard to find out the suggested way to do certain things for this nrf device. Might be a personal problem. 

Reply
  •  Yeah I do get errors. I guess that comes with rushed development on a mcu I've never used before.

      As for the SAADC I have it initialized in the beginning of my program but I can check it. Thank you for the suggestion.  I assume the unexpected errors can be overcome with setting custom conditional statements in that ble event handler. I'm going to try it next week. 

    Yes, I based my project on the very most basic ble template. I forget the name currently but I can check next week. Modifications I've made: saadc, added a ble service, ble characteristic, modified the basic sleep and wake up, hold bonds on wake up, and added a static passkey. This is a very basic implementation but it's rushed. I'm at the point of where Im optimizing for battery and I started a private post. I use SDK 16. Thanks for asking.

    Im not used to the... type of documentation and methods of learning how to use this device. Before I was using a scilabs device that had a plethora of documentation and it was great. It seems to be hard to find out the suggested way to do certain things for this nrf device. Might be a personal problem. 

Children
No Data
Related