From e8938ea7fa90cea0f17460ef35ee00cdcb81aea3 Mon Sep 17 00:00:00 2001 From: mwachs5 Date: Tue, 13 Jun 2017 20:19:02 -0700 Subject: led_fade: make sure the HFROSC is running before you try to use it. --- software/led_fade/led_fade.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'software') diff --git a/software/led_fade/led_fade.c b/software/led_fade/led_fade.c index 3c7b8c8..9b50eda 100644 --- a/software/led_fade/led_fade.c +++ b/software/led_fade/led_fade.c @@ -68,11 +68,14 @@ static void _puts(const char * s) { int main (void){ - // Run off 16 MHz Crystal for accuracy. + // Make sure the HFROSC is on before the next line: + PRCI_REG(PRCI_HFROSCCFG) |= ROSC_EN(1); + // Run off 16 MHz Crystal for accuracy. Note that the + // first line is PRCI_REG(PRCI_PLLCFG) = (PLL_REFSEL(1) | PLL_BYPASS(1)); PRCI_REG(PRCI_PLLCFG) |= (PLL_SEL(1)); // Turn off HFROSC to save power - PRCI_REG(PRCI_HFROSCCFG) = 0; + PRCI_REG(PRCI_HFROSCCFG) &= ~(ROSC_EN(1)); // Configure UART to print GPIO_REG(GPIO_OUTPUT_VAL) |= IOF0_UART0_MASK; -- cgit v1.2.1-18-gbd029