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

This section describes the LPUART type definitions.

LPUART Overview

The LPUART peripheral driver transfers data to and from external devices on the Low Power Universal Asynchronous Receiver/Transmitter (LPUART) serial bus. It provides a method to transmit or receive buffers of data with a single function call.

LPUART Device structures

The driver uses instantiations of the lpuart_tx_state_t and the lpuart_rx_state_t structure to maintain the current state of a particular LPUART instance module driver. The user is required to provide memory for the driver state structures during the initialization. The driver itself does not statically allocate memory.

LPUART Initialization

  1. To initialize the LPUART driver, call the LPUART_DRV_Init() function and pass the instance number of the relevant LPUART peripheral. For example, to use LPUART0 pass a value 0 to the initialization function.
  2. Pass a user configuration structure lpuart_user_config_t as shown here:
// LPUART configuration structure
typedef struct LpuartUserConfig {
uint32_t baudRate;
lpuart_parity_mode_t parityMode;
lpuart_stop_bit_count_t stopBitCount;
lpuart_bit_count_per_char_t bitCountPerChar;

Typically the user configures the lpuart_user_config_t instantiation as an 8-bit-char, no-parity, 1-stop-bit (8-n-1) with a baud rate of 9600 bps. The lpuart_user_config_t instantiation can be modified to configure the LPUART peripheral to a different baud rate or character transfer features. This is a code example to set up a user LPUART configuration instantiation:

lpuart_user_config_t lpuartConfig;
lpuartConfig.baudRate = 9600;

LPUART Transfers

The driver implements transmit and receive functions to transfer buffers of data by blocking and non-blocking modes.

The blocking transmit and receive functions include LPUART_DRV_SendDataBlocking() and the LPUART_DRV_ReceiveDataBlocking() functions.

The non-blocking (async) transmit and receive functions include the LPUART_DRV_SendData() and the LPUART_DRV_ReceiveData() functions.

When using DMA to transfer data, ensure that the data is consistent when there is cache for memory. This means, when reading/ writing the data from/to memory, the application should ensure that data from or to the memory device is not cached.

In all these cases, the functions are interrupt-driven.