Kinetis SDK v.1.2 Demo Applications User's Guide  Rev. 0
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
FlexIO simulated UART Example with other methods

Overview

The FlexIO UART example application demonstrates the FlexIO-simulated UART driver working with different methods. The FlexIO UART example shows the transmit/receive between the FlexIO-simulated UART and the LPUART1 using interrupts and DMA:

Supported Platforms

These Freescale Freedom development platforms and Tower System modules are supported by the FlexIO UART example.

System Requirement

Hardware requirements

Toolchain requirements

Software requirements

Getting Started

Hardware settings

This example requires connecting the FLEXIO pins with the LPUART1 pins. Connect the FlexIO pins to the LPUART1 pins. Note that the default uses the FlexIO pin2 and pin4:

FlexIO Pins Connects To LPUART1 Pins
FlexIO Pin2 -> LPUART1 Rx
FlexIO Pin4 -> LPUART1 Tx

Make these connections between the FlexIO pins and LPUART pins by using external wires:

TWR-KL43Z48

FlexIO Pins Connects To LPUART Pins
Pin Name Board Location Pin Name Board Location
PTD0/FLEXIO_PIN2 Primary Elevator B45 -> LPUART1 Rx TWR-KL43Z48M J15-14
PTD0/FLEXIO_PIN4 Primary Elevator B59 -> LPUART1 Tx Primary Elevator B47

FRDM-KL43Z

Because the LPUART1_RX is not pinned out on the FRDM-KL43Z, the example only demonstrates the FlexIO UART Rx:

FlexIO Pins Connects To LPUART Pins
Pin Name Board Location Pin Name Board Location
PTD4/FLEXIO_PIN4 J2-6 -> LPUART1 Tx J1-7

FRDM-KL27Z

FlexIO Pins Connects To LPUART Pins
Pin Name Board Location Pin Name Board Location
PTD0/FLEXIO_PIN2 J1-5 -> LPUART1 Rx J3-3
PTD4/FLEXIO_PIN4 J1-9 -> LPUART1 Tx J3-1

Prepare the example

  1. Connect a USB cable between the PC host and the OpenSDA USB port on the board.
  2. Insert TWR board into TWR-ELEV.
  3. Open a serial terminal with these settings:
    • 115200 baud rate
    • 8 data bits
    • No parity
    • One stop bit
    • No flow control
  4. Download the program to the target board.
  5. Either press the reset button on your board or launch the debugger in your IDE to begin running the example.

Run the example

FLEXIO_UART_DMA interrupt method

These instructions are displayed/shown on the terminal window:

++++++++++++++++ FLEXIO UART Send/Receive Example Start +++++++++++++++++
1. FlexIO simulated UART send a buffer
2. LPUART1 receives data from FlexIO simulated UART.
3. Compare rxBuff and txBuff to see result.
4. LPUART1 send a buffer
5. FlexIO simulated UART receives data from LPUART1.
6. Compare rxBuff and txBuff to see result.
============================================================
Press any key to start transfer:

Type a character from the keyboard and the FlexIO simulated UART sends a buffer to the LPUART1, compares the receive buffer in the LPUART1 side with the txBuff and checks whether the result is successful. Then, the LPUART1 sends a buffer to the FlexIO simulated UART, compares the received buffer in the FlexIO-simulated UART side with the txBuff and checks whether the result is successful.

FlexIO simulated UART receive from FlexIO LPUART1 successfully
FlexIO simulated UART receive from FlexIO LPUART1 successfully
FlexIO simulated UART receive from FlexIO LPUART1 successfully
FlexIO simulated UART receive from FlexIO LPUART1 successfully
...

For other boards:

Transfer from FlexIO simulated UART to LPUART1 successfully
FlexIO simulated UART receive from FlexIO LPUART1 successfully
Transfer from FlexIO simulated UART to LPUART1 successfully
FlexIO simulated UART receive from FlexIO LPUART1 successfully
Transfer from FlexIO simulated UART to LPUART1 successfully
FlexIO simulated UART receive from FlexIO LPUART1 successfully
Transfer from FlexIO simulated UART to LPUART1 successfully
FlexIO simulated UART receive from FlexIO LPUART1 successfully
Transfer from FlexIO simulated UART to LPUART1 successfully
FlexIO simulated UART receive from FlexIO LPUART1 successfully
...

FLEXIO_UART_DMA interrupt method

These instructions are displayed/shown on the terminal window:

++++++++++++++++ FLEXIO UART Send/Receive DMA Example Start +++++++++++++++++
1. FlexIO simulated UART send a buffer using DMA
2. LPUART1 receives data from FlexIO simulated UART.
3. Compare rxBuff and txBuff to see result.
4. LPUART1 send a buffer
5. FlexIO simulated UART receives data from LPUART1 using DMA.
6. Compare rxBuff and txBuff to see result.
============================================================
Press any key to start transfer:

Type a character from the keyboard and the FlexIO-simulated UART sends a buffer to the LPUART1, compares the received buffer in the LPUART1 side with the txBuff, checks whether the result is successful. Then, the LPUART1 sends a buffer to the FlexIO-simulated UART, compares the received buffer in the FlexIO-simulated UART side with the txBuff and checks whether the result is successful.

FlexIO simulated UART receive from FlexIO LPUART1 using DMA successfully
FlexIO simulated UART receive from FlexIO LPUART1 using DMA successfully
FlexIO simulated UART receive from FlexIO LPUART1 using DMA successfully
FlexIO simulated UART receive from FlexIO LPUART1 using DMA successfully
...

For other boards:

Transfer from FlexIO simulated UART to LPUART1 using DMA successfully
FlexIO simulated UART receive from FlexIO LPUART1 using DMA successfully
Transfer from FlexIO simulated UART to LPUART1 using DMA successfully
FlexIO simulated UART receive from FlexIO LPUART1 using DMA successfully
Transfer from FlexIO simulated UART to LPUART1 using DMA successfully
FlexIO simulated UART receive from FlexIO LPUART1 using DMA successfully
Transfer from FlexIO simulated UART to LPUART1 using DMA successfully
FlexIO simulated UART receive from FlexIO LPUART1 using DMA successfully
...