From 8a42af682dcf702dcda4a277ea43fcb58ddef3a4 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 1 May 2015 15:41:53 +0100 Subject: [PATCH] Make sure PERIPH is on before accessing GPT registers --- cpu/cc26xx/clock.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cpu/cc26xx/clock.c b/cpu/cc26xx/clock.c index 47563250d..701971e16 100644 --- a/cpu/cc26xx/clock.c +++ b/cpu/cc26xx/clock.c @@ -79,8 +79,14 @@ clock_init(void) * Here, we configure GPT0 Timer A, which we subsequently use in * clock_delay_usec * - * First, enable GPT0 in run mode. We don't need it in sleep mode + * We need to access registers, so firstly power up the PD and then enable + * the clock to GPT0. */ + if(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) != + PRCM_DOMAIN_POWER_ON) { + power_domain_on(); + } + ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_TIMER0); ti_lib_prcm_load_set(); while(!ti_lib_prcm_load_get());