From: Keith Packard Date: Sat, 18 Feb 2023 23:28:08 +0000 (-0800) Subject: samd21: Use TM v4.0 LEDs to debug samd21 clock bits X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=f4e4af8ae17db271d6f50323f70142054f970c28 samd21: Use TM v4.0 LEDs to debug samd21 clock bits red on at top of clock routine. green on after XOSC is running. red off at bottom of clock routine. Signed-off-by: Keith Packard --- diff --git a/src/samd21/ao_timer.c b/src/samd21/ao_timer.c index 2b431d38..91d74b12 100644 --- a/src/samd21/ao_timer.c +++ b/src/samd21/ao_timer.c @@ -122,6 +122,7 @@ ao_clock_init(void) ; #ifdef AO_XOSC + ao_enable_output(&samd21_port_b, 10, 1); /* Enable xosc (external xtal oscillator) */ samd21_sysctrl.xosc = ((SAMD21_SYSCTRL_XOSC_STARTUP_8192 << SAMD21_SYSCTRL_XOSC_STARTUP) | (0 << SAMD21_SYSCTRL_XOSC_AMPGC) | @@ -135,6 +136,8 @@ ao_clock_init(void) while ((samd21_sysctrl.pclksr & (1 << SAMD21_SYSCTRL_PCLKSR_XOSCRDY)) == 0) ; + ao_enable_output(&samd21_port_b, 11, 1); + /* program DPLL */ /* Divide down */ @@ -289,4 +292,6 @@ ao_clock_init(void) /* Disable automatic NVM write operations */ samd21_nvmctrl.ctrlb |= (1UL << SAMD21_NVMCTRL_CTRLB_MANW); + + ao_gpio_set(&samd21_port_b, 10, 0); }