MCUXpresso SDK Documentation

ctimer_capture

ctimer_capture#

Overview#

This example shows how to use CTimer to capture the edge. In this example, CTimer timer counter uses APB clock as clock source, and CTimer monitors capture pin. The capture pin is connected to a GPIO output. The project pulls GPIO to generate rising edge. When rising edge detected on the pin, CTimer saves the timer counter value to capture register, and print in the terminal. The GPIO pin is toggled priodically, so the edge capture timestamp is shown periodically in the terminal.

Supported Boards#

FRDM-MCXA346
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA346 board

  • Personal Computer

Board settings

Short J2-18(P1_8) and J2-20(P1_9).

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

FRDM-MCXL255
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA346 board

  • Personal Computer

Board settings

P3_12(J1-15) connect to CTimer simple PWM.

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The log below shows example output of the CTimer simple PWM demo using interrupts in the terminal window:

CTimer example to generate a PWM signal
This example uses interrupts to update the PWM duty cycle
FRDM-MCXW23
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXW23 Board

  • Personal Computer

Board settings

Short J4-5 and J5-1.

Prepare the Demo
  1. Connect a USB cable between the host PC and the FRDM board J10.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

CTimer capture example Rising edge triggered and CTimer capture the edge periodically

FRDM-RW612
Hardware requirements
  • Micro USB cable

  • FRDM-RW612 board

  • Personal Computer

Board settings

Short J4 Pin 5 and Pin 9

Prepare the Demo
  1. Connect a micro USB cable between the PC host and the MCU-Link USB port (J10) on the board

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

RD-RW612-BGA
Hardware requirements
  • Micro USB cable

  • RD-RW612-BGA board

  • Personal Computer

Board settings

Short HD2 Pin 6 and Pin 7

Prepare the Demo
  1. Connect a micro USB cable between the PC host and the MCU-Link USB port (J7) on the board

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

MCXW23-EVK
Hardware requirements
  • Mini/micro USB cable

  • MCXW23-EVK Board

  • Personal Computer

Board settings

Short J36-7 and J18-3.

Prepare the Demo
  1. Connect a USB cable between the host PC and the EVK board J33.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

CTimer capture example Rising edge triggered and CTimer capture the edge periodically

FRDM-MCXA174
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA174 board

  • Personal Computer

Board settings

Short J2-18(P1_8) and J2-20(P1_9).

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

FRDM-MCXA344
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA344 board

  • Personal Computer

Board settings

Short J2-18(P1_8) and J2-20(P1_9).

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

FRDM-MCXA266
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA266 board

  • Personal Computer

Board settings

Short J2-18(P1_8) and J2-20(P1_9).

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

FRDM-MCXA366
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA366 board

  • Personal Computer

Board settings

Short J2-18(P1_8) and J2-20(P1_9).

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

FRDM-MCXA577
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA577 board

  • Personal Computer

Board settings

Short J2-18(P0_20) and J2-20(P0_21).

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

FRDM-MCXC162
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXC162 board

  • Personal Computer

Board settings

Short J2-18(P3_28) and J2-20(P3_27).

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

FRDM-MCXA287
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA287 board

  • Personal Computer

Board settings

Short J2-18(P0_20) and J2-20(P0_21).

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

FRDM-MCXA153
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA153 board

  • Personal Computer

Board settings

Short J2-18(P1_8) and J2-20(P1_9).

Prepare the Demo
  1. Connect a Type-C USB cable between the host PC and the MCU-Link port(J15) on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

FRDM-MCXA156
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXA156 board

  • Personal Computer

Board settings

Short J6-1(P3_30) and J6-2(P3_29).

Prepare the Demo
  1. Connect a USB Type-C cable between the host PC and the MCU-Link USB port on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

MCX-N9XX-EVK
Hardware requirements
  • Micro USB cable

  • MCX-N9XX-EVK board

  • Personal Computer

Board settings

Short J2-18(P4_0) and J2-20(P4_1).

Prepare the Demo
  1. Connect a micro USB cable between the host PC and the MCU-Link USB port (J5) on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

FRDM-MCXN947
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXN947 board

  • Personal Computer

Board settings

Short J2-18(P4_0) and J2-20(P4_1).

Prepare the Demo
  1. Connect a type-c USB cable between the host PC and the MCU-Link USB port (J17) on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

FRDM-MCXN947T
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXN947T board

  • Personal Computer

Board settings

Short J2-18(P4_0) and J2-20(P4_1).

Prepare the Demo
  1. Connect a type-c USB cable between the host PC and the MCU-Link USB port (J17) on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

FRDM-MCXN236
Hardware requirements
  • Type-C USB cable

  • FRDM-MCXN236 board

  • Personal Computer

Board settings

Short J2-18(P1_16) and J2-20(P1_17).

Prepare the Demo
  1. Connect a type-c USB cable between the host PC and the MCU-Link USB port (J10) on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.

MCX-N5XX-EVK
Hardware requirements
  • Micro USB cable

  • MCX-N5XX-EVK board

  • Personal Computer

Board settings

Short J2-18(P4_0) and J2-20(P4_1).

Prepare the Demo
  1. Connect a micro USB cable between the host PC and the MCU-Link USB port (J5) on the target board.

  2. Open a serial terminal with the following settings:

    • 115200 baud rate

    • 8 data bits

    • No parity

    • One stop bit

    • No flow control

  3. Download the program to the target board.

  4. Either press the reset button on your board or launch the debugger in your IDE to begin running the demo.

Running the demo

The CTimer captured rising edge timestamp is print in the terminal periodically.