Hello, I've just started with the IMXRT1020-EVK board, so i can improve my programming and electrical skills. First of all, I've tried to blink the led, which worked fine, even without the driver functions (#reverse engineering).
So I started with the PIT and the corresponding overflow-interrupt. The example code worked just fine. After that, I tried to do it myself, but I failed, because the program-counter jumps to the
"WEAK_AV void IntDefaultHandler(void)
{ while(1) {}
}",
although I provided him the
"void PIT_LED_HANDLER(void){
/* Clear interrupt flag.*/
PIT->CHANNEL[0].TFLG |= (1 << TIF);
PIT_ClearStatusFlags(DEMO_PIT_BASEADDR, DEMO_PIT_CHANNEL, kPIT_TimerFlag);
pitIsrFlag = true;
GPIO1->DR ^= (1 << 5);
/* Added for, and affects, all PIT handlers. For CPU clock which is much larger than the IP bus clock,
* CPU can run out of the interrupt handler before the interrupt flag being cleared, resulting in the
* CPU's entering the handler again and again. Adding DSB can prevent the issue from happening.
*/
__DSB();
}"
For this reason I copied the code from the provided example and pasted it into my own project. So finally my own program has the same code, as the example code.
The curious thing is, that the error hasn't disappeared, even though the example code worked well in the provided example. I hope you can help me.
Best regards
michael_imxrt
Sorry for my English.
Hi
Which instruction causes the hard fault?
Have you enabled the clock to the PIT and to GPIO1, since if not they will hard fault when accessed.
Regards
Mark
[uTasker project developer for Kinetis and i.MX RT]
Contact me by personal message or on the uTasker web site to discuss professional training, solutions to problems or rapid product development requirements
For professionals searching for faster, problem-free Kinetis and i.MX RT 10xx developments the uTasker project holds the key: https://www.utasker.com/iMX/RT1020.html