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

RTC calendar

Hi, I need a RTC calendar ble stack on nrf51822 . (turn on the RTC0 on ble stack and get the count, how to setting the rtc wakeup )

which calendar need follow : track of the time (hours, minutes and seconds) and date (day, week,month, year)

i want to do list: 1.setting(every sec) and turn on the RTC0 interrupt 2.when the rtc0 trigger convert the RTC0 count to time. 3.configure the rtc0 wakeup when it is going to system off. 4.write to flash when system goto system off. 5.if wakeup by rtc0 or i/o, read the data from flash . and add rtc0 count ,update the timing and write back to flash. if it wake by rtc0, Then the system go into system off .

Can you give a hint about every steps of RTC calendar?

Parents
  • Hi Steven,

    This can be achieved by using the app_timer library. If you have alook at any of the ble-examples, all of these use the app_timer library. What you need to adjust is this define: #define APP_TIMER_MAX_TIMERS

    This define must be equal or greater to the amount of times "app_timer_create" function is called. If this is not done, the library will not allocate the sufficient amount of RAM to run the added timer function. You create like this: app_timer_create(&m_my_timer_id, APP_TIMER_MODE_REPEATED, my_timeout_handler);

    my_timeout_handler is your RTC timer function which is called based on the interval that you set when starting this.

    You start the timer by running this function: app_timer_start(m_my_timer_id, INTERVAL, NULL);

    For storing information to flash, you can use one of these libraries:

    • ble_flash
    • nrf_nvmc

    Best regards Håkon

  • Thank you, but I've not so sure to have understood . Supposing that there are ten events that want to start a timer , OP_QUEUES_SIZE = 10, MAZ_TIMER= 1, softdevice will store all events in a queue, but if the events will be 11, the queue will be corrupted ? (Will be raised an exception or an assert?) Again, with a max timer = 10 and a queue = 11, the 12th event will raise a corruption if all 10 timers are working and nobody of them can accept the 12th event ?

Reply
  • Thank you, but I've not so sure to have understood . Supposing that there are ten events that want to start a timer , OP_QUEUES_SIZE = 10, MAZ_TIMER= 1, softdevice will store all events in a queue, but if the events will be 11, the queue will be corrupted ? (Will be raised an exception or an assert?) Again, with a max timer = 10 and a queue = 11, the 12th event will raise a corruption if all 10 timers are working and nobody of them can accept the 12th event ?

Children
No Data
Related