Skip to content

Commit e5e53e5

Browse files
committed
NRF52_DK: Use 32 bit counter for us ticker (instead 16 bit counter)
1 parent 835d38d commit e5e53e5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/us_ticker.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void us_ticker_init(void)
7777

7878
nrf_timer_frequency_set(NRF_TIMER1, NRF_TIMER_FREQ_1MHz);
7979

80-
nrf_timer_bit_width_set(NRF_TIMER1, NRF_TIMER_BIT_WIDTH_16);
80+
nrf_timer_bit_width_set(NRF_TIMER1, NRF_TIMER_BIT_WIDTH_32);
8181

8282
nrf_timer_cc_write(NRF_TIMER1, NRF_TIMER_CC_CHANNEL0, 0);
8383

@@ -110,7 +110,7 @@ void us_ticker_set_interrupt(timestamp_t timestamp)
110110
{
111111
core_util_critical_section_enter();
112112

113-
nrf_timer_cc_write(NRF_TIMER1, NRF_TIMER_CC_CHANNEL0, timestamp & 0xFFFF);
113+
nrf_timer_cc_write(NRF_TIMER1, NRF_TIMER_CC_CHANNEL0, timestamp);
114114

115115
if (!nrf_timer_int_enable_check(NRF_TIMER1, nrf_timer_compare_int_get(NRF_TIMER_CC_CHANNEL0))) {
116116
nrf_timer_event_clear(NRF_TIMER1, NRF_TIMER_EVENT_COMPARE0);

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/us_ticker.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
#define US_TICKER_H
1919

2020
/* TIMER0 is reserved for SoftDevice. We will use TIMER1 for us ticker
21-
* which counter size is 16 bits. */
21+
* which counter size is 32 bits. */
2222

23-
#define US_TICKER_COUNTER_BITS 16u
23+
#define US_TICKER_COUNTER_BITS 32u
2424
#define US_TICKER_FREQ 1000000
2525

2626
#endif // US_TICKER_H

0 commit comments

Comments
 (0)