Hi there,
Ok Then, Good to know we aren’t part of a Homework assighnment.
ON ESP chips there is a RTOS, also on the Nrf parts. The Samd21 is slightly different,
Even in a simple sketch, Certain Interrupts are in use Always(well almost)
The main one is the SYSTEMs Core timer " SysTick" used fo things like Millis() and micros() and the Delay timing in the SAMD21 Arduino CORE.
This one fires every 1 ms.
Next would be Your Output, Think Serial port Interrupt (data available) or Receive Buffer notification Interrupt, or anything on the USB stack can generate an int. EVen if you don’t print , the USB stacks can generate a periodic interrupt.
then there’s the
“SERCOM” interrupts , early users of the SAMD parts got there first taste of interrupts for all serial devices, Rx/TX and I2C transactions, etc.
There may be others depending on board support packages (ADC, event system, watchdog), but the big three above explain the behavior 99% of the time.
Which timers are used (which ones are “off limits”?)
For Arduino SAMD21, the core timing (millis/micros/delay) uses SysTick, not the peripheral TC/TCC timers.
That means the peripheral timers TCC0/1/2 and TC3/4/5 are generally available for your own use (unless your libraries claim one). This is a classic difference from AVR Arduino where a hardware timer is often consumed.
What happens if you disable these interrupts?
Depends what you disable:
If you disable SysTick interrupt:
millis() stops incrementing
delay() stops working properly
micros() can become wrong/non-monotonic depending how the core is written/configured
If you disable global interrupts (noInterrupts()):
- Everything time-based stops behaving
- USB can stall / disconnect
- Serial RX/TX and most drivers stop (buffers won’t drain/fill)
- Any attachInterrupt() pin interrupts stop
So yes, your D6 pulse train becomes “clean,” but you’ve basically turned Arduino’s runtime off.
I found this as well, may explain the priorities better.
What priority are these interrupts?
SAMD21 (Cortex-M0+) supports multiple priority levels. Microchip documents 4 priority levels (0–3) and NVIC_SetPriority() is how you set them; higher number = lower priority.
In ArduinoCore-samd, SysTick is often configured at a low priority (specifically called out as “2nd lowest” in the core discussion).
That means “more important” ISRs (GPIO/EIC, some SERCOM, etc.) can preempt it.
If you want a truly stable “as fast as possible” output, don’t bit-bang in loop():
- Use a hardware timer (TCC/TC) to toggle a pin via waveform output, or
- Use the event system if he wants it ultra-clean.
I have a post on here about it, offloads it to the Peripheral interface.
HTH
GL
PJ 