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

System crash when execute "app_timer_start" in nRF52832

Hi,

I am using SDK15.2 to develop my project.

When I execute "app_timer_start" function (At line 115 of  main.c), the system will crash.

Please reference the attach file for the attach file.

TimerTest.7z

Would you please tell me how can i solve this problem?

Thank you,

Chianglin

Parents
  • Hi,

    In timers_start(), you are defining a variable err_code, which you later pass to the macro APP_ERROR_CHECK(), without initializing or assigning it any value. The variable will contain garbage data from RAM and the macro will put you in the error handler whenever the variable is non-zero. I suppose this is what you intended to do:

    void timers_start(void)
    {
        ret_code_t err_code;
    
        err_code = app_timer_start(Timer_10Ms_timer_id, APP_TIMER_TICKS(1000), (void *)0);
        APP_ERROR_CHECK(err_code);
    }

    Best regards,
    Jørgen

Reply
  • Hi,

    In timers_start(), you are defining a variable err_code, which you later pass to the macro APP_ERROR_CHECK(), without initializing or assigning it any value. The variable will contain garbage data from RAM and the macro will put you in the error handler whenever the variable is non-zero. I suppose this is what you intended to do:

    void timers_start(void)
    {
        ret_code_t err_code;
    
        err_code = app_timer_start(Timer_10Ms_timer_id, APP_TIMER_TICKS(1000), (void *)0);
        APP_ERROR_CHECK(err_code);
    }

    Best regards,
    Jørgen

Children
Related