You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2019/12/10 18:24:28 UTC

[GitHub] [mynewt-core] andrzej-kaczmarek commented on a change in pull request #2126: hw/mcu/nordic: Fix hal_timer firing too early

andrzej-kaczmarek commented on a change in pull request #2126: hw/mcu/nordic: Fix hal_timer firing too early
URL: https://github.com/apache/mynewt-core/pull/2126#discussion_r356202330
 
 

 ##########
 File path: hw/mcu/nordic/nrf52xxx/src/hal_timer.c
 ##########
 @@ -168,11 +168,15 @@ nrf_timer_set_ocmp(struct nrf52_hal_timer *bsptimer, uint32_t expiry)
          * The nrf documentation states that you must set the output
          * compare to 2 greater than the counter to guarantee an interrupt.
          * Since the counter can tick once while we check, we make sure
-         * it is greater than 2.
+         * it is greater than 2. Otherwise enable TICK event so we can get an
+         * interrupt at proper tick (also we may get an extra interrupt, but
+         * we will just not handle any timer there).
          */
         if (delta_t < 3) {
 
 Review comment:
   you're right. and now actually I think we should also set pending interrupt when delta==1 because the timer can tick once so TICK interrupt will happen on next tick which is also one tick too late. so something like this should work I think:
   delta==2 enable tick and wait for proper tick (we may have 1 or 2 additional "empty" interrupts)
   delta==1 enable tick and set irq pending (we may have 0 or 1 "empty" interrupt)
   delta==0 set irq pending
   
   does this make sense?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services