On my ATSAMD21 Xplained Pro board, I have a relatively simple program that drives the RTC from the OSCULP32K and does the following:
- sets the RTC COMPARE register for 1 second in the future, enables COMP interrupts
- upon waking, toggles the LED
What I observe:
- Running under the EDBG debugger, the LED toggles once a second.
- Running without the debugger, the LED doesn't toggle BUT the code is getting called (see below)
Question: Any ideas on what could cause this?
- Hardware is ATSAMD21 Xplained Pro
- Firmware generated under Atmel START via Atmel Studio 7 (7.0.1931)
- Clock configuration:
- OSC8M => GCLK0 (NOT run in standby) => [CPU, USART_0]
- OSCULP32K => GCLK3 (run in standby) => [EXT IRQ, RTC]
What's especially puzzling is that -- as far as I can tell -- the LED toggling code IS getting called: I added a software call counter that gets incremented every time the LED is toggled. When I start the program NOT under the debugger, the LED doesn't visibly toggle, but if I subsequently attach the debugger to the running process, I can see that the call counter has been incremented from the start.
It's almost as if the PORT is getting disconnected and not reconnecting when the processor wakes up (but only when not running under the debugger). Any thoughts would be appreciated!