Hi,
I need some clarification on implementing a system tick counter.
1. I am creating 1 ms, 10 ms, and 100 ms task containers in my main loop so that I need a system tick counter periodic interrupt for every 100 us or 500 us once to increment the background run time counter. However, I can't able to enable the system tick interrupt.
2. For creating 1 ms, 10 ms, and 100 ms task containers, which one is better: a system tick counter or PIT?
3. Is there any example code available? system tick counter periodic interrupt?
4. In my project, startup_code exception.c already defined system tick ISR, and also in the vector table, IRQ number -1 system tick handler is defined. How to use the system tick ISR from main.c and how to enable IRQ number -1 interrupt ?
5. System tick counter initialization
Is it the correct way or not?
Ide : S32DS V3.5.14
RTD : v4.0.0
Hardware : S32K344, S32K358.
Hi @karmegancjk
2. This depends on your application. PIT module is separate from the MCU, does not affect core performance, since it is its own module. If your application does not need to optimize performance, you can use SysTick, which is easier to configure.
3. I explain how to configure OsIf and use SysTick in this thread: Solved: Delay function using OSIF - NXP Community.
4. This thread talks about SysTick priority and IRQ handling: Solved: How can I configure SysTick timer interrupt priority ? - NXP Community.
5. OsIf_Timer_System_Init(void) function initializes SysTick if system timer is selected in the BaseNXP component.
Best regards,
Julián