Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

nrf5 SDK 17.1.0 app_timer2 issue

Hello I recently updated my project from 17.0.2 to 17.1.0.
I found a problem while checking the full functionality after the update.
In my project, there is a buzzer for an alarm, and it was confirmed that the operation time was doubled.
I'm using app_timer2 for buzzer control, I ask if there are SDK fixes related to app_timer2.
In the code I wrote, it is enough to input the buzzer operation time by 1/2, but I would like to know the fundamental solution.
I'll be waiting for the reply.

Parents
  • Hi there,

    Strange, I haven't seen this issue. Could you share a minimal example that would reproduce this issue, so that I can reproduce it on my development kit?

    regards

    Jared 

  • 1856.ble_app_template.zip

    I have created a new project based on ble_app_template.
    pca10040 - s132 - ses, NRF52 DK identified a problem.
    please check. thank you

  • I've created a new project using version 17.0.2 of ble_app_template.
    please check.ble_app_template_17_0_2.zip

  • I've modified the two examples by adding a callback handler to the app timer module, so that I can toggle a GPIO when the app timer starts and when it has completed in the handler. This lets me measure the elapsed time of the app timer.

    Comparing the two:

    SDK v17.02 ble_app_template_17_0_2.zip:

    Using the debugger I check the timeout parameter that is passed to app_timer_start() and see that it's set to 100 (ms). 

    By measuring the toggling interval of the GPIO, I see that the timeout time of the application timer corresponds to the timeout that is passed to app_timer_start(): 

    SDK v17.1 0 1856.ble_app_template.zip

    Using the debugger I check the timeout parameter that is passed to app_timer_start() and see that it's set to 100(ms):

    By measuring the toggling interval of the GPIO, I see that the timeout time of the application timer corresponds to the timeout that is passed to app_timer_start(): 

    Result: In both cases I can see and verify that the timeout is set to 100 ms. 
    I could therefore not reproduce your observations.

    regards

    Jared 

  • hello
    It's terribly strange that you can't verify.
    It is also confirmed with LED control, not PWM control like your example.
    Please check the picture and code below again.

    17.1.0 ver

    17.0.2 ver

    ble_app_template_17_1_0_220824.zipble_app_template_17_0_2_220824.zip

  • I also attach the binary file of 17.1.0ver with the problem.
    (softdevice + application .hex file)
    timer_ex.hex

  • Hi, 

    As far as I can see, you toggle the LED every time the program enters wrapper_timer_restart() from wrapper_timer_reschedule(). This will not represent the amount of time elapsed before the app timer has reached its timeout as multiple different timers in your program call wrapper_timer_reschedule(). For example, beepClock, alert_majorClock, alert_subClock all call wrapper_timer_reschedule(), which means that all of them will toggle LED1. I think this problem is more related to your program flow then the app timer module itself. 

    If you disagree, can you share a much simpler example that only uses the app timer module and toggles a LED and see if you can reproduce a difference between SDK v17.0.2 and v17.1.0? 

    regards

    Jared 

Reply
  • Hi, 

    As far as I can see, you toggle the LED every time the program enters wrapper_timer_restart() from wrapper_timer_reschedule(). This will not represent the amount of time elapsed before the app timer has reached its timeout as multiple different timers in your program call wrapper_timer_reschedule(). For example, beepClock, alert_majorClock, alert_subClock all call wrapper_timer_reschedule(), which means that all of them will toggle LED1. I think this problem is more related to your program flow then the app timer module itself. 

    If you disagree, can you share a much simpler example that only uses the app timer module and toggles a LED and see if you can reproduce a difference between SDK v17.0.2 and v17.1.0? 

    regards

    Jared 

Children
  • I made a simple led blink example using app_timer2.
    Toggle the led in the timer handler and run timer stop -> start.
    There are still differences depending on the SDK version.
    In 17.1.0 the led blinks slowly.

    Is this a problem with the program?
    Please check again.

    17_1_0_220825.zip

    17_0_2_220825.zip

  • Hi John, 
    I'm sorry for the late response. Jared is on vacation. 

    I have reproduced the issue here and can confirm what you observed. 


    I'm suspecting that the change in the library in SDK v17.1 caused the issue. I have reported this to the team and will keep you updated. 

    What I found is that if you do APP_TIMER_MODE_SINGLE_SHOT instead of APP_TIMER_MODE_REPEATED you will not see the issue. 
    Or if you use app_schedule to do the app_timer_stop() app_timer_start() in main context it would work as well. 

    Would these workarounds good for you ?

  • thank you for your reply.
    I solved the issue by creating a timer using single shot mode.
    If you find the cause of the problem with the SDK, please share.
    thank you

  • I noticed the same problem an hour ago. My code suddenly stopped working after upgrading the SDK from 17.0.2 to 17.1.0. I suspected it had something to do with the timers, as the blinking sequence of a LED changed.

    My quick and dirty solution was to simply rollback to 17.0.2 version of the SDK, until I find out the cause. Anyway, it's half an year later and still no official solution to this bug.

  • Hi Strobotek,

    I'm checking internally to see if there is any update. It doesn't seem we will have a new release for the SDK soon so you may want to have a look at the workaround I suggested above. Or use SDK v17.0.2 like you are doing now.