MCUXpresso SDK API Reference Manual  Rev. 0
NXP Semiconductors
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
QDC Peripheral and Driver Overview

Peripheral features and how this peripheral works

The Quadrature Decoder module interfaces to position/speed sensors that are used in industrial motor control applications. It uses 5 input signals (PHASEA, PHASEB, INDEX, TRIGGER, and HOME) from those position/speed sensors, the quadrature decoder module decodes shaft position, revolution count, and speed.

Features

How this peripheral works

  1. Initialize the module clock, configure the input pins (PHASEA, PHASEB, INDEX, HOME) based on use case, configure the TRIGGER and POSMATCH signal if necessary.
  2. After configured, QDC's Revolution Counter, Position Counter, Position Difference Counter, Last Edge Time Counter, and Position Difference Period Counter start to work based on configurations. Input signal PHASEA, PHASEB, INDEX, HOME are filtered by digital glitch filter before feeding QDC counters. The QDC counters values are saved to each hold registers at the proper time, taking a snapshot of the counters' values allows a consistent view of a system's position and the velocity to be attained.

How this driver is designed to make this peripheral works

QDC driver's initialize function QDC_Init initializes the QDC based on configuration structure qdc_config_t. This function convers all the QDC configurations. Generally QDC is ready to work after calling this function. The function QDC_GetDefaultConfig helps to fill the qdc_config_t with default values.

Besides QDC_Init for the whole module configuration, there are smaller flexible functions used for runtime setting, including:

When QDC is working, QDC driver provides functions to get the counter registers value, revolution count value, position difference value, last edge time, position difference period.

How to use this driver

  1. Prepare the module clock, configure the input pins according to real use case, configure output pin if it is used.
  2. Prepare the configuration qdc_config_t, initialize the QDC using QDC_Init.
  3. When QDC started running, call the value get APIs to get the required register value to calculate position and speed.