I was following along the PIT example of your basic training "Basic Application Development Using MCUXpresso IDE and MCUXpresso Config Tools" found at
https://www.nxp.com/pages/basic-application-development-using-mcuxpresso-ide-and-mcuxpresso-config-t...
In the example, one simply configures an LED pin and the PIT and writes a simple IRQ to handle the interrupt of the PIT to toggle an LED.
In the example, the IRQ directly handles the toggling of the LED. When I follow along on my RT1064 board however, the toggling of the LED pin in the IRQ does not work. When debugging and setting a break point inside the IRQ, I can see the IRQ is executed and it works as expected. When however I let the application run freely, the LED is not toggled.
I then looked at the PIT example provided in the SDK (which is not using the IDEs tools to configure the PIT but instead hard-codes everything, which is poor form if you ask me...) I noticed the IRQ only sets a flag and the LED toggle is performed in the while(true) loop.
I copied this behavior and voila, it works.
So my question is: Why does the LED toggle not work in the interrupt but it does work when put in main. I am aware that IRQ should do as little as possible, but toggling a single LED / Pin should be possible, right? I am trying to understand if there is some form of optimization / setting that disables my toggling the LED.
Cheers and thanks in advance for your help,
Joe