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

sd_app_evt_wait

      I used nrf52832 to port the program from SDK14.2 to SDK15.2 and there was a problem. In SDK 15.2, the program functions normally in the online debugging state, but the function is abnormal after burning into the IC, and the button and APP_TIMER are invalid. After masking the sd_app_evt_wait function, it is normal to burn the IC again. What is the reason? Thank you!

  • Hi,

    A call to sd_app_evt_wait() is essentially the same as a call to __WFE() (though it does a bit more). This makes the CPU go to sleep until an event/interrupt occurs. It should be the same regardless of whether you are debugging or not. What do you mean by "button and APP_TIMER are invalid"? Can you elaborate a bit more on what you are doing and how the system behaves?

  • Through multiple tests, the following findings have been made:
    1. May be related to the use of timer, I used timer3, timer4, timer5, all three timers use interrupts, the shortest interrupt interval is 244us. The timer related program I ported directly from SDK14.2 to SDK15.2, the code has not changed.
    2. After the sd_app_evt_wait() function is masked, the function is normal.


    3. After changing the power control module to nrf_pwr_mgmt, After mask the nrf_pwr_mgmt_run() function,the function is normal.


    4. After defining NRF_PWR_MGMT_CONFIG_DEBUG_PIN_ENABLED as 1, the function is normal. After the function is turned on, does NRF_PWR_MGMT_SLEEP_DEBUG_PIN have any influence on power consumption without external peripheral circuits?

    5. In my project, APP_Timer wakes up every second. I added the LOG print function to it, and added the LOG print function when the button detects that the press is released. But when there is an abnormal situation I mentioned, the button presses no response, and the button and APP_TIMER log print has no data.


    According to the above situation, can you help me with some suggestions? What is the cause? Thank you!

  • Hi Jim,

    I am having a bit of problems understanding what is going on. Can you upload your code along with a detailed explanation on what you do and how it fails? How do you detect button presses? What debugging have you done to see what happens when you press the button? The best would be if it can be tested on the DK.

    In the mean time I just want to share some general thoughts. Assuming you use a GPIO interrupt to detect button presses this should always be detected if the interrupt is enabled and there are no other same or higher priority interrupt is being continuously serviced (for instance waiting in a loop for something that never happens). Another uncommon but possible problem could be if the device wakes up on interrupt, but due to a bug you enter sleep somewhere else before all processing has happened. Therefor you should typically only call nrf_pwr_mgmt_run(), sd_app_evt_wait() or similar in the main loop of your application. 

    Br,

    Einar

Related