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

app_timer on app_evt_wait - fails / failing / bugging out / cancelling

In moving to the "rev-2 51422 silicon, we find that the app_timer inevitably fails after minutes to several hours. Power requirement moves from about .002ma to 4.5ma then stays there. Prior silicon did not have this problem.

The same routine is called via the handler on every interval. As discovered, we removed ALL instructions in the handler routine - the event timer still fails.

No other instructions are contained in the main where the app_timer is called.

while (forever) app_evt_wait();

a. Is this a known problem? b. why is it not noted in the PAN c. is there a solid fix that will keep it from failing?

tks!

  • Hi,

    We've had some corner-case issues with the app_timer library lately, which we are fixing in the next release of the SDK. These issues are related to when stopping/starting the timer, or having a timeout handler which is greater than MAX_RTC_COUNTER_VAL/2 (see this thread for detailed info) Since this is a firmware issue, there is no PAN on this entry.

    In order to find out if your issue is related to the known issues, I need some more information about your application

    1. Do you see any asserts when the device fails? Asserts can be enabled by commenting in call to "ble_debug_assert_handler" in function "app_error_handler()".

    2. How long is your timeout routines and what prescaler setting are you using?

    3. Are you stopping and starting the app_timer in your application?

    4. Which SDK version are you basing your application upon?

    Best regards Håkon

  • Thanks for the prompt response. Before we dive into details of the program...

    a. What is the rev of the new SDK? b. Is it out for distribution/download? If not - when? :)

  • a) The next revision will be SDK v6.0.0. Current is v5.2.0 b) Not yet. But it should not be far away. I'm not allowed to give specific dates, as releases are not always on track ;-)

    However, I have been able to obtain the app_timer library that is going into the next release. Could you try this one to see if the issue is still present?

    Best regards Håkon

    app_timer.c

  • With new app_timer.c, problem appears to happen more frequently. Here's setup: Thoughts??

    //VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV //++++++++++++++++++++++++++++++++++++++++++++++++ //APP_TIMER_CLOCK_FREQ = 32768 #define SUBTICKS_PER_MINUTE 12u // timer usual clocking ! 12 for default execution , 24 for diag fast cycling. #define RTC_COUNTER_FREQ 1024u //DON'T CHANGE!!! to modify cycles, use above^^^ // Desired RTC COUNTER frequency is 1024Hz. #define RTC_PRESCALER (ROUNDED_DIV(APP_TIMER_CLOCK_FREQ, RTC_COUNTER_FREQ) - 1u) // Computed value of the RTC prescaler register. #define CYCLE_TIMER_INTERVAL APP_TIMER_TICKS(ROUNDED_DIV((60u * 1024u), SUBTICKS_PER_MINUTE), RTC_PRESCALER)

    void timer_initialize(void)
    		{
    				APP_TIMER_INIT(RTC_PRESCALER, 1u, 1u, false);
    				app_timer_id_t timer_id1;
    				uint32_t err_code = app_timer_create(&timer_id1, APP_TIMER_MODE_REPEATED, Tick_Increments_Handler);
    				err_code = app_timer_start(timer_id1, CYCLE_TIMER_INTERVAL, NULL);  					if (LCD_Enabled) APP_ERROR_CHECK(err_code);  
    		}
    
  • Note - we're also using ADC in each of these clock intervals. It's ended as follows:

    Is this correct in the new world? NRF_ADC->TASKS_STOP NRF_ADC->EVENTS_END = 0; NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Disabled;

Related