Hi,
I want to toggle the LEDs using an interrupt timer.
I have managed to toggle the LED using incremental count as seen in the link below,
Solved: Re: Turn on the GPIO using NXPs32k322 - NXP Community
I want to generate an interrupt every 10ms. Any help is appreciated.
Regards,
Pratik
解決済! 解決策の投稿を見る。
Hi @pratik_a,
Please make sure the GptIsrEnable and GptChannelIsUsed options are enabled:
Define the Pit notification and the ISR handler is defined:
Best regards,
Julián
Hi,
I have included the snapshots of the included module configs, please take a look and let me know if I'm missing out on something.
I'm using the Segger Edu mini flasher so I'm unaware of how to debug with it. But I'm confident that the callback function is not called. As the LED connected at MSCR 83 glows which is independent of the callback function as seen in code above.
Dio_WriteChannel(83, STD_HIGH);
But the one included in the callback function never toggles.
Can you also confirm from the above code that my callback function is properly called upon and whether it is included in the interrupt vector?
Regards,
Pratik
Hi @Julián_AragónM ,
I have been wanting to implement the Autosar method for timer functionality. As per the example provided, I have included the necessary components please refer to image 1.png
I want to generate an interrupt every 1 millisecond.
Can you also confirm if the callback function is equivalent to ISR implementation in the code? I want to specifically implement an ISR routine which will be called every 1 millisecond, and my state engine will change its state accordingly.
Regards,
Pratik
Hi @pratik_a,
It seems the components added to your project are okay, could this be an issue with the initialization of other modules apart from the GPT? Like the GPIO or the clocks? Could you confirm the example runs, and if the callback function is being stepped into?
An Interrupt Service Routine (ISR) is a function which runs when a hardware interrupt is triggered, the same way a Callback is a software implementation of this. An ISR needs to be installed with an interrupt vector (for example in the Siul2_Icu_Ip_BlinkLed_S32K344 example, SIUL_2_IRQn), and a Callback can be added into the interrupt routine.
You can modify the notification/callback function which will be modified by your state engine in this case.
Best regards,
Julián
Hi @pratik_a,
Please make sure the GptIsrEnable and GptChannelIsUsed options are enabled:
Define the Pit notification and the ISR handler is defined:
Best regards,
Julián
It worked...Thanks for your continuous help.
Hi @pratik_a,
The RTD 4.0.0 package includes examples for the General Purpose Timer:
After the initialization the channel will start counting, the notification will be generated and a 'while(1) loop' will run to blink a LED. You can use these examples as reference and modify the counter to change the period.
Best regards,
Julián
Hi @Julián_AragónM ,
I tried the GPT example. I did all the necessary settings in the configuration tools. I'm posting my code below. Somehow it doesn't work, Kindly help.
@
Also, can you guide me to where the void Gpt_PitNotification(void) function is declared? I just want to confirm if it is timer interrupt callback function?
Hi @pratik_a,
PitNotification should be declared in the pit configuration file. It is indeed a callback function:
Just to confirm, when debugging does the code step into the Gpt_PitNotification function?
Best regards,
Julián