Kinetis SDK v.1.3 API Reference Manual  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
FlexIO basic HAL Driver

This section describes the programming interface of the FlexIO basic HAL driver.

Basic concept for FlexIO programming

FlexIO is a module that can be used to simulate multiple communication interfaces. The FlexIO can work by assembling pins, shifters, and timers with the appropriate configuration.

The pin is bonded to shifter and timer and is usually an external interface to other devices.

The FlexIO 32-bit shifter is the data interface to the modules inside the chip. Shifters are responsible for buffering and shifting data in or out of the FlexIO. The timing of a shift, load and store events are controlled by the timer assigned to the shifter via the SHIFTCTL[TIMSEL] register This setting creates the relationship between the shifter and the timer. Shifters are designed to support either DMA, interrupt or polled operation. Corresponding switchers generate triggers for the DMA or the interrupt request.

For advanced versions of the FlexIO module, there is a parallel mode for the shifter, which means that one shifter can be connected to more than one pins and the count of shift bits per shifter clock is related to the pin number.

The FlexIO 16-bit timers control the loading, shifting, and storing of the shift registers. The counters load the contents of the comparison register and decrement down to zero on the FlexIO clock.

Each timer operates independently, although a timer can be configured to enable or disable at the same time as a previous timer. For example, timer1 can enable or disable at the same time as timer 0 and a timer output can be used to trigger any other timer. The trigger used by each timer is configured independently and can be configured to be a timer output, a shifter status flag, a pin input or an external trigger input. The trigger configuration is separate from the pin configuration, which can be configured for input, output data, or output enable.

FlexIO HAL model building

In addition to setting global features and reading the information of hardware attribution, the most important APIs involve operating the timer and shifter. FLEXIO_HAL_ConfigureTimer() and FLEXIO_HAL_ConfigureShifter() functions are designed to configure the timer and shifter integrally with their related settings. There are also the APIs to enable/disable the interrupt/DMA, get/clear flags, fill/fetch the data to/from the shifter, in the same way as other drivers of bus interfaces.

As a basic driver of FlexIO module, the flexio_hal provides the basic APIs to operate the timer and shifter. To simulate the communication interface, the appropriate configuration should be applied. An SoC Reference Manual provides detailed information to use the flexio_<device>_hal which includes the special configurations with the basic FlexIO HAL driver.