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

Overview

Enumerations

enum  lin_lpuart_stop_bit_count_t {
  kLPUART_OneStopBit = 0U,
  kLPUART_TwoStopBit = 1U
}
 
enum  _lin_lpuart_flags {
  kLPUART_TxDataRegEmptyFlag,
  kLPUART_TransmissionCompleteFlag,
  kLPUART_RxDataRegFullFlag,
  kLPUART_IdleLineFlag = (LPUART_STAT_IDLE_MASK),
  kLPUART_RxOverrunFlag = (LPUART_STAT_OR_MASK),
  kLPUART_NoiseErrorFlag = (LPUART_STAT_NF_MASK),
  kLPUART_FramingErrorFlag,
  kLPUART_ParityErrorFlag = (LPUART_STAT_PF_MASK),
  kLPUART_LinBreakFlag = (int)(LPUART_STAT_LBKDIF_MASK),
  kLPUART_RxActiveEdgeFlag,
  kLPUART_RxActiveFlag,
  kLPUART_DataMatch1Flag = LPUART_STAT_MA1F_MASK,
  kLPUART_DataMatch2Flag = LPUART_STAT_MA2F_MASK,
  kLPUART_NoiseErrorInRxDataRegFlag,
  kLPUART_ParityErrorInRxDataRegFlag,
  kLPUART_TxFifoEmptyFlag = (LPUART_FIFO_TXEMPT_MASK >> 16),
  kLPUART_RxFifoEmptyFlag = (LPUART_FIFO_RXEMPT_MASK >> 16),
  kLPUART_TxFifoOverflowFlag,
  kLPUART_RxFifoUnderflowFlag
}
 
enum  _lin_lpuart_interrupt_enable {
  kLPUART_LinBreakInterruptEnable = (LPUART_BAUD_LBKDIE_MASK >> 8),
  kLPUART_RxActiveEdgeInterruptEnable = (LPUART_BAUD_RXEDGIE_MASK >> 8),
  kLPUART_TxDataRegEmptyInterruptEnable = (LPUART_CTRL_TIE_MASK),
  kLPUART_TransmissionCompleteInterruptEnable = (LPUART_CTRL_TCIE_MASK),
  kLPUART_RxDataRegFullInterruptEnable = (LPUART_CTRL_RIE_MASK),
  kLPUART_IdleLineInterruptEnable = (LPUART_CTRL_ILIE_MASK),
  kLPUART_RxOverrunInterruptEnable = (LPUART_CTRL_ORIE_MASK),
  kLPUART_NoiseErrorInterruptEnable = (LPUART_CTRL_NEIE_MASK),
  kLPUART_FramingErrorInterruptEnable = (LPUART_CTRL_FEIE_MASK),
  kLPUART_ParityErrorInterruptEnable = (LPUART_CTRL_PEIE_MASK),
  kLPUART_TxFifoOverflowInterruptEnable = (LPUART_FIFO_TXOFE_MASK >> 8),
  kLPUART_RxFifoUnderflowInterruptEnable = (LPUART_FIFO_RXUFE_MASK >> 8)
}
 
enum  _lin_lpuart_status {
  kStatus_LPUART_TxBusy = MAKE_STATUS(kStatusGroup_LPUART, 0),
  kStatus_LPUART_RxBusy = MAKE_STATUS(kStatusGroup_LPUART, 1),
  kStatus_LPUART_TxIdle = MAKE_STATUS(kStatusGroup_LPUART, 2),
  kStatus_LPUART_RxIdle = MAKE_STATUS(kStatusGroup_LPUART, 3),
  kStatus_LPUART_TxWatermarkTooLarge = MAKE_STATUS(kStatusGroup_LPUART, 4),
  kStatus_LPUART_RxWatermarkTooLarge = MAKE_STATUS(kStatusGroup_LPUART, 5),
  kStatus_LPUART_FlagCannotClearManually = MAKE_STATUS(kStatusGroup_LPUART, 6),
  kStatus_LPUART_Error = MAKE_STATUS(kStatusGroup_LPUART, 7),
  kStatus_LPUART_RxRingBufferOverrun,
  kStatus_LPUART_RxHardwareOverrun = MAKE_STATUS(kStatusGroup_LPUART, 9),
  kStatus_LPUART_NoiseError = MAKE_STATUS(kStatusGroup_LPUART, 10),
  kStatus_LPUART_FramingError = MAKE_STATUS(kStatusGroup_LPUART, 11),
  kStatus_LPUART_ParityError = MAKE_STATUS(kStatusGroup_LPUART, 12)
}
 
enum  lin_lpuart_bit_count_per_char_t {
  LPUART_8_BITS_PER_CHAR = 0x0U,
  LPUART_9_BITS_PER_CHAR = 0x1U,
  LPUART_10_BITS_PER_CHAR = 0x2U
}
 

Functions

static bool LIN_LPUART_GetRxDataPolarity (const LPUART_Type *base)
 Initializes an LIN_LPUART instance for LIN Network. More...
 
lin_status_t LIN_LPUART_Deinit (LPUART_Type *base)
 Shuts down the LIN_LPUART by disabling interrupts and transmitter/receiver. More...
 
lin_status_t LIN_LPUART_SendFrameDataBlocking (LPUART_Type *base, const uint8_t *txBuff, uint8_t txSize, uint32_t timeoutMSec)
 Sends Frame data out through the LIN_LPUART module using blocking method. More...
 
lin_status_t LIN_LPUART_SendFrameData (LPUART_Type *base, const uint8_t *txBuff, uint8_t txSize)
 Sends frame data out through the LIN_LPUART module using non-blocking method. More...
 
lin_status_t LIN_LPUART_GetTransmitStatus (LPUART_Type *base, uint8_t *bytesRemaining)
 Get status of an on-going non-blocking transmission While sending frame data using non-blocking method, users can use this function to get status of that transmission. More...
 
lin_status_t LIN_LPUART_RecvFrmDataBlocking (LPUART_Type *base, uint8_t *rxBuff, uint8_t rxSize, uint32_t timeoutMSec)
 Receives frame data through the LIN_LPUART module using blocking method. More...
 
lin_status_t LIN_LPUART_RecvFrmData (LPUART_Type *base, uint8_t *rxBuff, uint8_t rxSize)
 Receives frame data through the LIN_LPUART module using non- blocking method. More...
 
lin_status_t LIN_LPUART_AbortTransferData (LPUART_Type *base)
 Aborts an on-going non-blocking transmission/reception. More...
 
lin_status_t LIN_LPUART_GetReceiveStatus (LPUART_Type *base, uint8_t *bytesRemaining)
 Get status of an on-going non-blocking reception While receiving frame data using non-blocking method, users can use this function to get status of that receiving. More...
 
lin_status_t LIN_LPUART_GoToSleepMode (LPUART_Type *base)
 This function puts current node to sleep mode This function changes current node state to LIN_NODE_STATE_SLEEP_MODE. More...
 
lin_status_t LIN_LPUART_GotoIdleState (LPUART_Type *base)
 Puts current LIN node to Idle state This function changes current node state to LIN_NODE_STATE_IDLE. More...
 
lin_status_t LIN_LPUART_SendWakeupSignal (LPUART_Type *base)
 Sends a wakeup signal through the LIN_LPUART interface. More...
 
lin_status_t LIN_LPUART_MasterSendHeader (LPUART_Type *base, uint8_t id)
 Sends frame header out through the LIN_LPUART module using a non-blocking method. More...
 
lin_status_t LIN_LPUART_EnableIRQ (LPUART_Type *base)
 Enables LIN_LPUART hardware interrupts. More...
 
lin_status_t LIN_LPUART_DisableIRQ (LPUART_Type *base)
 Disables LIN_LPUART hardware interrupts. More...
 
lin_status_t LIN_LPUART_AutoBaudCapture (uint32_t instance)
 This function capture bits time to detect break char, calculate baudrate from sync bits and enable transceiver if autobaud successful. More...
 
void LIN_LPUART_IRQHandler (LPUART_Type *base)
 LIN_LPUART RX TX interrupt handler. More...
 

Enumeration Type Documentation

Enumerator
kLPUART_OneStopBit 

One stop bit.

kLPUART_TwoStopBit 

Two stop bits.

Enumerator
kLPUART_TxDataRegEmptyFlag 

Transmit data register empty flag, sets when transmit buffer is empty.

kLPUART_TransmissionCompleteFlag 

Transmission complete flag, sets when transmission activity complete.

kLPUART_RxDataRegFullFlag 

Receive data register full flag, sets when the receive data buffer is full.

kLPUART_IdleLineFlag 

Idle line detect flag, sets when idle line detected.

kLPUART_RxOverrunFlag 

Receive Overrun, sets when new data is received before data is read from receive register.

kLPUART_NoiseErrorFlag 

Receive takes 3 samples of each received bit.

If any of these samples differ, noise flag sets

kLPUART_FramingErrorFlag 

Frame error flag, sets if logic 0 was detected where stop bit expected.

kLPUART_ParityErrorFlag 

If parity enabled, sets upon parity error detection.

kLPUART_LinBreakFlag 

LIN break detect interrupt flag, sets when LIN break char detected and LIN circuit enabled.

kLPUART_RxActiveEdgeFlag 

Receive pin active edge interrupt flag, sets when active edge detected.

kLPUART_RxActiveFlag 

Receiver Active Flag (RAF), sets at beginning of valid start bit.

kLPUART_DataMatch1Flag 

The next character to be read from LPUART_DATA matches MA1.

kLPUART_DataMatch2Flag 

The next character to be read from LPUART_DATA matches MA2.

kLPUART_NoiseErrorInRxDataRegFlag 

NOISY bit, sets if noise detected in current data word.

kLPUART_ParityErrorInRxDataRegFlag 

PARITY bit, sets if noise detected in current data word.

kLPUART_TxFifoEmptyFlag 

TXEMPT bit, sets if transmit buffer is empty.

kLPUART_RxFifoEmptyFlag 

RXEMPT bit, sets if receive buffer is empty.

kLPUART_TxFifoOverflowFlag 

TXOF bit, sets if transmit buffer overflow occurred.

kLPUART_RxFifoUnderflowFlag 

RXUF bit, sets if receive buffer underflow occurred.

Enumerator
kLPUART_LinBreakInterruptEnable 

LIN break detect.

kLPUART_RxActiveEdgeInterruptEnable 

Receive Active Edge.

kLPUART_TxDataRegEmptyInterruptEnable 

Transmit data register empty.

kLPUART_TransmissionCompleteInterruptEnable 

Transmission complete.

kLPUART_RxDataRegFullInterruptEnable 

Receiver data register full.

kLPUART_IdleLineInterruptEnable 

Idle line.

kLPUART_RxOverrunInterruptEnable 

Receiver Overrun.

kLPUART_NoiseErrorInterruptEnable 

Noise error flag.

kLPUART_FramingErrorInterruptEnable 

Framing error flag.

kLPUART_ParityErrorInterruptEnable 

Parity error flag.

kLPUART_TxFifoOverflowInterruptEnable 

Transmit FIFO Overflow.

kLPUART_RxFifoUnderflowInterruptEnable 

Receive FIFO Underflow.

Enumerator
kStatus_LPUART_TxBusy 

TX busy.

kStatus_LPUART_RxBusy 

RX busy.

kStatus_LPUART_TxIdle 

LPUART transmitter is idle.

kStatus_LPUART_RxIdle 

LPUART receiver is idle.

kStatus_LPUART_TxWatermarkTooLarge 

TX FIFO watermark too large.

kStatus_LPUART_RxWatermarkTooLarge 

RX FIFO watermark too large.

kStatus_LPUART_FlagCannotClearManually 

Some flag can't manually clear.

kStatus_LPUART_Error 

Error happens on LPUART.

kStatus_LPUART_RxRingBufferOverrun 

LPUART RX software ring buffer overrun.

kStatus_LPUART_RxHardwareOverrun 

LPUART RX receiver overrun.

kStatus_LPUART_NoiseError 

LPUART noise error.

kStatus_LPUART_FramingError 

LPUART framing error.

kStatus_LPUART_ParityError 

LPUART parity error.

Enumerator
LPUART_8_BITS_PER_CHAR 

8-bit data characters

LPUART_9_BITS_PER_CHAR 

9-bit data characters

LPUART_10_BITS_PER_CHAR 

10-bit data characters

Function Documentation

static bool LIN_LPUART_GetRxDataPolarity ( const LPUART_Type *  base)
inlinestatic

The caller provides memory for the driver state structures during initialization. The user must select the LIN_LPUART clock source in the application to initialize the LIN_LPUART. This function initializes a LPUART instance for operation. This function will initialize the run-time state structure to keep track of the on-going transfers, initialize the module to user defined settings and default settings, set break field length to be 13 bit times minimum, enable the break detect interrupt, Rx complete interrupt, frame error detect interrupt, and enable the LPUART module transmitter and receiver

Parameters
instanceLIN_LPUART instance number
linUserConfiguser configuration structure of type lin_user_config_t
linCurrentStatepointer to the LIN_LPUART driver state structure
Returns
An error code or lin_status_t
lin_status_t LIN_LPUART_Deinit ( LPUART_Type *  base)
Parameters
instanceLIN_LPUART instance number
Returns
An error code or lin_status_t
lin_status_t LIN_LPUART_SendFrameDataBlocking ( LPUART_Type *  base,
const uint8_t *  txBuff,
uint8_t  txSize,
uint32_t  timeoutMSec 
)

This function will calculate the checksum byte and send it with the frame data. Blocking means that the function does not return until the transmission is complete.

Parameters
instanceLIN_LPUART instance number
txBuffsource buffer containing 8-bit data chars to send
txSizethe number of bytes to send
timeoutMSectimeout value in milli seconds
Returns
An error code or lin_status_t
lin_status_t LIN_LPUART_SendFrameData ( LPUART_Type *  base,
const uint8_t *  txBuff,
uint8_t  txSize 
)

This enables an a-sync method for transmitting data. Non-blocking means that the function returns immediately. The application has to get the transmit status to know when the transmit is complete. This function will calculate the checksum byte and send it with the frame data.

Parameters
instanceLIN_LPUART instance number
txBuffsource buffer containing 8-bit data chars to send
txSizethe number of bytes to send
Returns
An error code or lin_status_t
lin_status_t LIN_LPUART_GetTransmitStatus ( LPUART_Type *  base,
uint8_t *  bytesRemaining 
)

This function return LIN_TX_BUSY while sending, or LIN_TIMEOUT if timeout has occurred, or return LIN_SUCCESS when the transmission is complete. The bytesRemaining shows number of bytes that still needed to transmit.

Parameters
instanceLIN_LPUART instance number
bytesRemainingNumber of bytes still needed to transmit
Returns
lin_status_t LIN_TX_BUSY, LIN_SUCCESS or LIN_TIMEOUT
lin_status_t LIN_LPUART_RecvFrmDataBlocking ( LPUART_Type *  base,
uint8_t *  rxBuff,
uint8_t  rxSize,
uint32_t  timeoutMSec 
)

This function will check the checksum byte. If the checksum is correct, it will receive the frame data. Blocking means that the function does not return until the reception is complete.

Parameters
instanceLIN_LPUART instance number
rxBuffbuffer containing 8-bit received data
rxSizethe number of bytes to receive
timeoutMSectimeout value in milli seconds
Returns
An error code or lin_status_t
lin_status_t LIN_LPUART_RecvFrmData ( LPUART_Type *  base,
uint8_t *  rxBuff,
uint8_t  rxSize 
)

This function will check the checksum byte. If the checksum is correct, it will receive it with the frame data. Non-blocking means that the function returns immediately. The application has to get the receive status to know when the reception is complete.

Parameters
instanceLIN_LPUART instance number
rxBuffbuffer containing 8-bit received data
rxSizethe number of bytes to receive
Returns
An error code or lin_status_t
lin_status_t LIN_LPUART_AbortTransferData ( LPUART_Type *  base)

While performing a non-blocking transferring data, users can call this function to terminate immediately the transferring.

Parameters
instanceLIN_LPUART instance number
Returns
An error code or lin_status_t
lin_status_t LIN_LPUART_GetReceiveStatus ( LPUART_Type *  base,
uint8_t *  bytesRemaining 
)

This function return the current event ID, LIN_RX_BUSY while receiving and return LIN_SUCCESS, or timeout (LIN_TIMEOUT) when the reception is complete. The bytesRemaining shows number of bytes that still needed to receive.

Parameters
instanceLIN_LPUART instance number
bytesRemainingNumber of bytes still needed to receive
Returns
lin_status_t LIN_RX_BUSY, LIN_TIMEOUT or LIN_SUCCESS
lin_status_t LIN_LPUART_GoToSleepMode ( LPUART_Type *  base)
Parameters
instanceLIN_LPUART instance number
Returns
An error code or lin_status_t
lin_status_t LIN_LPUART_GotoIdleState ( LPUART_Type *  base)
Parameters
instanceLIN_LPUART instance number
Returns
An error code or lin_status_t
lin_status_t LIN_LPUART_SendWakeupSignal ( LPUART_Type *  base)
Parameters
instanceLIN_LPUART instance number
Returns
An error code or lin_status_t
lin_status_t LIN_LPUART_MasterSendHeader ( LPUART_Type *  base,
uint8_t  id 
)

This function sends LIN Break field, sync field then the ID with correct parity.

Parameters
instanceLIN_LPUART instance number
idFrame Identifier
Returns
An error code or lin_status_t
lin_status_t LIN_LPUART_EnableIRQ ( LPUART_Type *  base)
Parameters
instanceLIN_LPUART instance number
Returns
An error code or lin_status_t
lin_status_t LIN_LPUART_DisableIRQ ( LPUART_Type *  base)
Parameters
instanceLIN_LPUART instance number
Returns
An error code or lin_status_t
lin_status_t LIN_LPUART_AutoBaudCapture ( uint32_t  instance)

This function should only be used in Slave. The timer should be in mode input capture of both rising and falling edges. The timer input capture pin should be externally connected to RXD pin.

Parameters
instanceLPUART instance
Returns
lin_status_t
void LIN_LPUART_IRQHandler ( LPUART_Type *  base)
Parameters
instanceLIN_LPUART instance number
Returns
void