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

Question about stopping all the timers that are used in the application.

Hi Everyone

I have got 3 timers in my application. 

1 is repeated , and other two are Single shot which are ran from the inputs to the 1st Repeated timer.

The repeated keeps checking the UART for a byte , once the byte is received , One single shot timer is started , which on expiry turn One of my sensor OFF and inside the handler starts another single shot timer which again turns ON the sensor after 1 hour. 

If i stop the repeated timer when i turn OFF the Sensor , and start the Timer when I turn ON the sensor again. The whole thing just comes to a halt and it doesn't work anymore.

I have fixed this issue by using a timer of 10 seconds , which does literally nothing but keep repeating after 10 seconds, but i am not sure if the theory is correct or not.

""If all the timers have been turned OFF , the RTC goes to deep-sleep and it doesn't count anymore and to keep the RTC alive , i have used a repeated timer as desribed above.

It works in this configuration , but i am not sure if the reasoning is correct or not.""

Kindly help me understand this behavior.

Thanks 

Rajat

  • Where is APP_TIMER_PRESCALER used?

    It may be that the .zip file is too big. Try to delete everything inside the _build folder. I don't know what IDE you use (Segger Embedded Studio, Keil or IAR), but you can delete everything that is generated when you compile your project before zipping the project folder. Then it will be a much smaller file.

    If you want to send e.g. the ble_app_hrs project, and you use Segger Embedded Studio, then go to SDK\examples\ble_peripheral\ble_app_hrs\pca10056\s140\ses, and delete your Output folder. Then zip the ble_app_hrs folder.

    If you use Keil, the folder you should delete is SDK\examples\ble_peripheral\ble_app_hrs\pca10056\s140\arm5_no_packs\_build

    Best regards,

    Edvin

  • 3034.Test.rar

    in-terra.rar

    Test.rar file contains the main.c file and sdk_config.h and in-terra.rar contains the .c and .h files being used.

    Path used for project is : C:\Nordic\nRF5_SDK_15.0.0_a53641a\examples\myprojects\Test

    Path used for in-terra folder for .c and .h files is : C:\Nordic\nRF5_SDK_15.0.0_a53641a\in-terra

  • Did you look into the project files i sent to you"?

  • Hello,

    Sorry. I was out of office for a few days.

    It didn't help to switch places on the scheduler and pwr mgmt in your main loop by the way?

    I still don't see where you have used your APP_TIMER_PRESCALER. It is only defined (twice), and not used anywhere else, as far as I can tell.

    Try these two steps:

    1: change your main loop to:

        while (1)
            {
                app_sched_execute ();
                nrf_pwr_mgmt_run ();
            }

    so that your application actually handles the scheduler before going to sleep.

    and 2:

    Change your APP_TIMER_CONFIG_RTC_FREQUENCY in sdk_config.h to something higher. E.g. 31 (1024Hz). You can of course tune this, but try this value first. Then your timeout values should be fine.

    BR,

    Edvin

  • 1st method 

    doesn't work

    2nd method 

    does the job , but i have doubts on it . 

    If the frequency of RTC was previously 32kHZ and it was stopping after 10 minutes ,then freq of 1024hZ will stop at a time 32 times more than that , which is 320 minutes , around 5 hours.

    But As per my requirement , i should be able to configure it for atleast for a day(24 hours of interval).

Related