Hello every body,
I would like to use the PIT of a TEENSY 4 to send periodic trame of pulses.
It works fine BUT, for debug reason I added some "serial.println" in code and when I remove them It doesn't work.
Here below an simple example
I'm pretty sure that's a story of interrupts unable or something like that but I'm running dry !!
Thank you for reading.
Fred
I would like to use the PIT of a TEENSY 4 to send periodic trame of pulses.
It works fine BUT, for debug reason I added some "serial.println" in code and when I remove them It doesn't work.
Here below an simple example
Code:
#include <Arduino.h>
void pit_test()
{
PIT_TFLG0 = 1;
Serial.println(micros()); //<--- when I remove this line I can't see the LED blinking anymore
digitalToggle(LED_BUILTIN);
}
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
PIT_LDVAL0 = 12000000 - 1; // 1/2 seconde
PIT_TCTRL0 = 0x00000003; // timer 0 enable et interrupt enable
attachInterruptVector(IRQ_PIT, pit_test);
NVIC_SET_PRIORITY(IRQ_PIT, 0);
NVIC_ENABLE_IRQ(IRQ_PIT);
}
void loop()
{
}
Thank you for reading.
Fred