Implmenting Tick Timer in KE1xZ

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Implmenting Tick Timer in KE1xZ

Jump to solution
819 Views
Jmir
Contributor II

I will need to implement a 10ms tick timer for a real time control system in KE1xZ. 

Should it be implemented in the FTM module or in the LPIT?

0 Kudos
1 Solution
805 Views
gusarambula
NXP TechSupport
NXP TechSupport

Hello Jmir,

Both timers may generate the required signal, albeit they have different features depending on your application:

The FTM (Flex Timer Module) is very flexible, as the name suggest, as it has additional modes like input capture or output compare, for example.

The LPIT (Low-power Periodic Interrupt Timer) can operate in low power modes so it’s mostly used for operations required in low power mode.

In regards as a tick timer for a real time control system, as Mark mentioned, in Kinetis microcontrollers usually use the SysTick timer is used instead, which is part of the Cortex-M0+ features.

Regards,
Gustavo

View solution in original post

0 Kudos
4 Replies
806 Views
gusarambula
NXP TechSupport
NXP TechSupport

Hello Jmir,

Both timers may generate the required signal, albeit they have different features depending on your application:

The FTM (Flex Timer Module) is very flexible, as the name suggest, as it has additional modes like input capture or output compare, for example.

The LPIT (Low-power Periodic Interrupt Timer) can operate in low power modes so it’s mostly used for operations required in low power mode.

In regards as a tick timer for a real time control system, as Mark mentioned, in Kinetis microcontrollers usually use the SysTick timer is used instead, which is part of the Cortex-M0+ features.

Regards,
Gustavo

0 Kudos
753 Views
Jmir
Contributor II

I have been looking in the KE1xZ reference manual for information on SysTick, however I cannot find which registers I have to configure to program a 10ms tick capable of generating an interruption.

Can you help me?

0 Kudos
746 Views
ErichStyger
Senior Contributor V

The SysTick is part of the ARM Core and the ARM manuals. You can easily use the SDK and CMSIS headers to configure it, e.g. with the following example:

/*
 * Copyright (c) 2021, Erich Styger
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include "systick.h"
#include "fsl_common.h"

static volatile uint32_t g_systickCounter;

void SysTick_Handler(void) {
  if (g_systickCounter != 0U) {
    g_systickCounter--;
  }
}

void SysTick_DelayTicks(uint32_t n) {
  g_systickCounter = n;
  while (g_systickCounter != 0U) {
  }
}
void SysTick_Init(void) {
  g_systickCounter = 0;
  SysTick_Config(MSEC_TO_COUNT(1, SystemCoreClock)); /* 1 ms tick period */
}

I hope this helps,

Erich

812 Views
mjbcswitzerland
Specialist V

Hi

Typically the SYSTICK is used for tick in all Kinetis (Cortex) parts.

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/kinetis/FRDM-KE15Z.html