From 2f3a0e9b7ee191f21dd419b9826f5c176b01afa0 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 19 Mar 2020 16:16:50 +0100 Subject: [PATCH 1/3] boards: fix CORE_CLOCK for cc2538 based boards --- boards/cc2538dk/include/periph_conf.h | 7 +++++++ boards/common/remote/include/cfg_clk_default.h | 2 +- boards/openmote-b/include/periph_conf.h | 2 +- boards/openmote-cc2538/include/periph_conf.h | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/boards/cc2538dk/include/periph_conf.h b/boards/cc2538dk/include/periph_conf.h index 492cc16735..469aa52ff1 100644 --- a/boards/cc2538dk/include/periph_conf.h +++ b/boards/cc2538dk/include/periph_conf.h @@ -26,6 +26,13 @@ extern "C" { #endif +/** + * @name Clock system configuration + * @{ + */ +#define CLOCK_CORECLOCK (16000000U) /* desired core clock frequency, 16MHz */ +/** @} */ + /** * @name Timer configuration * diff --git a/boards/common/remote/include/cfg_clk_default.h b/boards/common/remote/include/cfg_clk_default.h index 12cc651a7c..419be08f9f 100644 --- a/boards/common/remote/include/cfg_clk_default.h +++ b/boards/common/remote/include/cfg_clk_default.h @@ -30,7 +30,7 @@ extern "C" { * @name Clock system configuration * @{ */ -#define CLOCK_CORECLOCK (32000000U) /* 32MHz */ +#define CLOCK_CORECLOCK (16000000U) /* 16MHz */ /** @} */ #ifdef __cplusplus diff --git a/boards/openmote-b/include/periph_conf.h b/boards/openmote-b/include/periph_conf.h index a01002cd0b..f52e331411 100644 --- a/boards/openmote-b/include/periph_conf.h +++ b/boards/openmote-b/include/periph_conf.h @@ -33,7 +33,7 @@ * @name Clock system configuration * @{ */ -#define CLOCK_CORECLOCK (32000000U) /* desired core clock frequency, 32MHz */ +#define CLOCK_CORECLOCK (16000000U) /* desired core clock frequency, 16MHz */ /** @} */ /** diff --git a/boards/openmote-cc2538/include/periph_conf.h b/boards/openmote-cc2538/include/periph_conf.h index 7b96ad749e..cb371d8bd6 100644 --- a/boards/openmote-cc2538/include/periph_conf.h +++ b/boards/openmote-cc2538/include/periph_conf.h @@ -31,7 +31,7 @@ * @name Clock system configuration * @{ */ -#define CLOCK_CORECLOCK (32000000U) /* desired core clock frequency, 32MHz */ +#define CLOCK_CORECLOCK (16000000U) /* desired core clock frequency, 16MHz */ /** @} */ /** From 226e1b5daf22fb5b60d8274c047d14f514facb45 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 19 Mar 2020 16:17:17 +0100 Subject: [PATCH 2/3] cpu/cc2538: fix GPT3 timer IRQ definition --- cpu/cc2538/periph/timer.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/cpu/cc2538/periph/timer.c b/cpu/cc2538/periph/timer.c index 6dfc377764..9a911e00ad 100644 --- a/cpu/cc2538/periph/timer.c +++ b/cpu/cc2538/periph/timer.c @@ -67,8 +67,21 @@ static inline void _irq_enable(tim_t tim) DEBUG("%s(%u)\n", __FUNCTION__, tim); if (tim < TIMER_NUMOF) { - IRQn_Type irqn = GPTIMER_0A_IRQn + (2 * tim); - + IRQn_Type irqn; + switch (tim) { + case 0: + irqn = GPTIMER_0A_IRQn; + break; + case 1: + irqn = GPTIMER_1A_IRQn; + break; + case 2: + irqn = GPTIMER_2A_IRQn; + break; + case 3: + irqn = GPTIMER_3A_IRQn; + break; + } NVIC_SetPriority(irqn, TIMER_IRQ_PRIO); NVIC_EnableIRQ(irqn); From daab688998b4210396d81048ac00c9fd0f4ec92d Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Thu, 19 Mar 2020 16:17:49 +0100 Subject: [PATCH 3/3] tests/periph_timer: adapt to cc2538 boards --- tests/periph_timer/Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/periph_timer/Makefile b/tests/periph_timer/Makefile index 7506dd2bbd..3d8e2bcce8 100644 --- a/tests/periph_timer/Makefile +++ b/tests/periph_timer/Makefile @@ -21,10 +21,20 @@ BOARDS_TIMER_32kHz := \ frdm-k22f \ # +BOARDS_TIMER_16MHz := \ + cc2538dk \ + openmote-b \ + openmote-cc2538 \ + remote-reva \ + remote-revb \ + # + ifneq (,$(filter $(BOARDS_TIMER_25kHz),$(BOARD))) TIMER_SPEED ?= 250000 else ifneq (,$(filter $(BOARDS_TIMER_32kHz),$(BOARD))) TIMER_SPEED ?= 32768 +else ifneq (,$(filter $(BOARDS_TIMER_16MHz),$(BOARD))) + TIMER_SPEED ?= 16000000 endif TIMER_SPEED ?= 1000000