Sleep mode nrf52 DK

Hello, by usingnrf52832 DK and testing some examples i found out that the example peripheral UART was not going like I wanted to do. He is going to sleep mode after 3 minutes I think and I don't know why. I would like to know how to take off because when  I'm using my app I would like to see my example constantly in my nrf correct and to make it appear I have to click on the reset button. I already try to change the APP_DURATION from 18000 to 0 but it doesn't work.  THX in advance

  • Hello,

    You are correct that the default behavior of the BLE NUS example is to go into SYSTEM_OFF sleep when the advertising duration is expired. You could see this happen in the advertising's event handler for the IDLE event.

    I'm using my app I would like to see my example constantly in my nrf correct and to make it appear I have to click on the reset button.

    If you would like to keep the device advertising for an indefinite time you will need to change the advertising duration to unlimited by setting the APP_ADV_DURATION to 0. You will also need to change which flag your device is advertising with from the default limited discoverability to general discoverability.

    APP_DURATION from 18000 to 0 but it doesn't work.

    Please elaborate on how it does not work. What are you observing and how does it diverge from what you would have expected? Does the application suddenly reset, or does it advertise for a certain time before going to SYSTEM_OFF sleep regardless of your APP_ADV_DURATION being set to 0?

    Best regards,
    Karl

  • Hello Karl, thank you so much for your quick reply. Actually, I don't see the program in the app anymore when I put the duration to 0. When you are talking about the flag where can I change that? Thank you it is maybe wh it isn't working

  • lm said:
    thank you so much for your quick reply.

    No problem at all, I am happy to help!

    lm said:
    Actually, I don't see the program in the app anymore when I put the duration to 0.

    Thank you for clarifying - this could indeed mean that the program is encountering an error or otherwise non-functioning.

    lm said:
    When you are talking about the flag where can I change that?

    You will need to change the flags that are part of the advertising payload, they are defined in line 617 of main.c of the unmodified BLE NUS example:

    init.advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

    It should instead be BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE.

    Best regards,
    Karl

  • Hello, i changed the line in the flag

    but i can't see my app if don't press the button reset, I would to know how to not have this obligation ( 0 on the app duration is working only if I'm pressing the button reset too)

    and the problem is that this is a big constraint. I would like to see my app constantly.

    Thank you in advance for your help :) 

  • lm said:

    but i can't see my app if don't press the button reset, I would to know how to not have this obligation ( 0 on the app duration is working only if I'm pressing the button reset too)

    and the problem is that this is a big constraint. I would like to see my app constantly.

    That likely means that the application is not running as expected. Could you elaborate on what you mean when you say that the 0 on the app duration is working only if I'm pressing the button reset? - Do you see unlimited advertising after a reset, only?
    Could you enter into a debug session and see if the program counter is getting stuck anywhere unexpected?
    Could you also confirm for me that you have made sure to pass all returned error codes to an APP_ERROR_CHECK?


    If you make sure to have DEBUG defined in your preprocessor defines, like shown in the included image, your debugger will output a detailed error message whenever a non-NRF_SUCCESS error code is passed to an APP_ERROR_CHECK.
    Please do this, and let me know if you see any such error message appear in your logger when you run the modified application.

    Bet regards,
    Karl

Related