You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2016/10/21 19:19:21 UTC

[1/2] incubator-mynewt-core git commit: MYNEWT-401: Minor mods to nrf51 and nrf52 hal timer. Remove an extraneous line of code and fix possible issue with nrf51 16-bit timer.

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop 0d75df2eb -> 35eee5b6b


MYNEWT-401: Minor mods to nrf51 and nrf52 hal timer. Remove
an extraneous line of code and fix possible issue with nrf51
16-bit timer.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/35eee5b6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/35eee5b6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/35eee5b6

Branch: refs/heads/develop
Commit: 35eee5b6bceae5a98e1a49c99d8f78957fa85bbe
Parents: a852d95
Author: William San Filippo <wi...@runtime.io>
Authored: Fri Oct 21 12:18:18 2016 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Fri Oct 21 12:19:15 2016 -0700

----------------------------------------------------------------------
 hw/mcu/nordic/nrf51xxx/src/hal_timer.c | 4 +---
 hw/mcu/nordic/nrf52xxx/src/hal_timer.c | 2 --
 2 files changed, 1 insertion(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/35eee5b6/hw/mcu/nordic/nrf51xxx/src/hal_timer.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/nrf51xxx/src/hal_timer.c b/hw/mcu/nordic/nrf51xxx/src/hal_timer.c
index 92e0009..85aedb9 100644
--- a/hw/mcu/nordic/nrf51xxx/src/hal_timer.c
+++ b/hw/mcu/nordic/nrf51xxx/src/hal_timer.c
@@ -165,7 +165,7 @@ nrf_timer_set_ocmp(struct nrf51_hal_timer *bsptimer, uint32_t expiry)
             hwtimer->INTENSET = NRF_TIMER_INT_MASK(NRF_TIMER_CC_INT);
 
             /* Force interrupt to occur as we may have missed it */
-            if (nrf_read_timer_cntr(hwtimer) > expiry16) {
+            if (nrf_read_timer_cntr(hwtimer) >= expiry16) {
                 goto set_ocmp_late;
             }
         } else {
@@ -494,8 +494,6 @@ hal_timer_init(int timer_num, uint32_t freq_hz)
 
     __HAL_ENABLE_INTERRUPTS(ctx);
 
-    hwtimer->PRESCALER = prescaler;
-
     return 0;
 
 err:

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/35eee5b6/hw/mcu/nordic/nrf52xxx/src/hal_timer.c
----------------------------------------------------------------------
diff --git a/hw/mcu/nordic/nrf52xxx/src/hal_timer.c b/hw/mcu/nordic/nrf52xxx/src/hal_timer.c
index ed15ffb..5aa0864 100644
--- a/hw/mcu/nordic/nrf52xxx/src/hal_timer.c
+++ b/hw/mcu/nordic/nrf52xxx/src/hal_timer.c
@@ -438,8 +438,6 @@ hal_timer_init(int timer_num, uint32_t freq_hz)
 
     __HAL_ENABLE_INTERRUPTS(ctx);
 
-    hwtimer->PRESCALER = prescaler;
-
     return 0;
 
 err:


[2/2] incubator-mynewt-core git commit: No jira ticket. Some minor mods to timtest app so that task2 allows the idle task to hit the watchdog.

Posted by we...@apache.org.
No jira ticket. Some minor mods to timtest app so that task2
allows the idle task to hit the watchdog.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/a852d95f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/a852d95f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/a852d95f

Branch: refs/heads/develop
Commit: a852d95fa2f9f461d84c3f3f61d4f1a0ed99490b
Parents: 0d75df2
Author: William San Filippo <wi...@runtime.io>
Authored: Fri Oct 21 11:51:10 2016 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Fri Oct 21 12:19:15 2016 -0700

----------------------------------------------------------------------
 apps/timtest/src/main.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/a852d95f/apps/timtest/src/main.c
----------------------------------------------------------------------
diff --git a/apps/timtest/src/main.c b/apps/timtest/src/main.c
index aa0cb8a..9c11e72 100755
--- a/apps/timtest/src/main.c
+++ b/apps/timtest/src/main.c
@@ -26,8 +26,6 @@
 #include <os/os_dev.h>
 #include <assert.h>
 #include <string.h>
-#include "app_util_platform.h"
-#include "app_error.h"
 
 /* Init all tasks */
 volatile int tasks_initialized;
@@ -49,7 +47,7 @@ struct os_task task2;
 os_stack_t stack2[TASK2_STACK_SIZE];
 
 #define TASK2_TIMER_NUM     (2)
-#define TASK2_TIMER_FREQ    (62500)
+#define TASK2_TIMER_FREQ    (31250)
 
 /* For LED toggling */
 int g_led1_pin;
@@ -116,6 +114,7 @@ task1_handler(void *arg)
 void
 task2_handler(void *arg)
 {
+    int cntr;
     int32_t delta;
     uint32_t tval1;
     uint32_t tval2;
@@ -123,6 +122,7 @@ task2_handler(void *arg)
     g_led2_pin = LED_2;
     hal_gpio_init_out(g_led2_pin, 1);
 
+    cntr = 8;
     while (1) {
         /* Read timer, block for 500 msecs, make sure timer counter counts! */
         tval1 = hal_timer_read(TASK2_TIMER_NUM);
@@ -133,6 +133,13 @@ task2_handler(void *arg)
 
         /* Toggle LED2 */
         hal_gpio_toggle(g_led2_pin);
+
+        /* We want to wait to hit watchdog so delay every now and then */
+        --cntr;
+        if (cntr == 0) {
+            os_time_delay(OS_TICKS_PER_SEC);
+            cntr = 8;
+        }
     }
 }