Timer GPT question

Status
Not open for further replies.

luni

Well-known member
Is the timer GPT2 used for some internal tasks? Disabling it by setting GPT2_CR to zero crashes the system. GPT1 works as expected.

Code:
void setup()
{
  pinMode(LED_BUILTIN, OUTPUT);
  GPT1_CR = 0; // fine
  GPT2_CR = 0; // crashes Teensy
}

void loop()
{
  digitalWriteFast(LED_BUILTIN, !digitalReadFast(LED_BUILTIN));
  delay(250);
}

I searched the core files but do not find anything using the GPTs so that is quite strange.
 
Ok, seems like the clock for GPT2 is not enabled at startup. Enabling it prior to usage of the timer fixed the issue.
 
Status
Not open for further replies.
Back
Top