XMC Peripheral Library for XMC4000 Family: UART

XMC Peripheral Library for XMC4000 Family

XMC Peripheral Library for XMC4000 Family  2.1.16

Data Structures

struct  XMC_UART_CH_CONFIG_t
 

Macros

#define XMC_UART0_CH0   XMC_USIC0_CH0
 
#define XMC_UART0_CH1   XMC_USIC0_CH1
 
#define XMC_UART1_CH0   XMC_USIC1_CH0
 
#define XMC_UART1_CH1   XMC_USIC1_CH1
 
#define XMC_UART2_CH0   XMC_USIC2_CH0
 
#define XMC_UART2_CH1   XMC_USIC2_CH1
 

Enumerations

Functions

void XMC_UART_CH_ClearStatusFlag (XMC_USIC_CH_t *const channel, const uint32_t flag)
 
void XMC_UART_CH_DisableDataTransmission (XMC_USIC_CH_t *const channel)
 
void XMC_UART_CH_DisableEvent (XMC_USIC_CH_t *const channel, const uint32_t event)
 
void XMC_UART_CH_DisableInputDigitalFilter (XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input)
 
void XMC_UART_CH_DisableInputInversion (XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input)
 
void XMC_UART_CH_DisableInputSync (XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input)
 
void XMC_UART_CH_EnableDataTransmission (XMC_USIC_CH_t *const channel)
 
void XMC_UART_CH_EnableEvent (XMC_USIC_CH_t *const channel, const uint32_t event)
 
void XMC_UART_CH_EnableInputDigitalFilter (XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input)
 
void XMC_UART_CH_EnableInputInversion (XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input)
 
void XMC_UART_CH_EnableInputSync (XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input)
 
uint16_t XMC_UART_CH_GetReceivedData (XMC_USIC_CH_t *const channel)
 
uint32_t XMC_UART_CH_GetStatusFlag (XMC_USIC_CH_t *const channel)
 
void XMC_UART_CH_Init (XMC_USIC_CH_t *const channel, const XMC_UART_CH_CONFIG_t *const config)
 
void XMC_UART_CH_SelectInterruptNodePointer (XMC_USIC_CH_t *const channel, const XMC_UART_CH_INTERRUPT_NODE_POINTER_t interrupt_node, const uint32_t service_request)
 
XMC_UART_CH_STATUS_t XMC_UART_CH_SetBaudrate (XMC_USIC_CH_t *const channel, uint32_t rate, uint32_t oversampling)
 
void XMC_UART_CH_SetFrameLength (XMC_USIC_CH_t *const channel, const uint8_t frame_length)
 
void XMC_UART_CH_SetInputSamplingFreq (XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input, const XMC_UART_CH_INPUT_SAMPLING_FREQ_t sampling_freq)
 
void XMC_UART_CH_SetInputSource (XMC_USIC_CH_t *const channel, const XMC_UART_CH_INPUT_t input, const uint8_t source)
 
void XMC_UART_CH_SetInterruptNodePointer (XMC_USIC_CH_t *const channel, const uint8_t service_request)
 
void XMC_UART_CH_SetPulseLength (XMC_USIC_CH_t *const channel, const uint8_t pulse_length)
 
void XMC_UART_CH_SetSamplePoint (XMC_USIC_CH_t *const channel, const uint32_t sample_point)
 
void XMC_UART_CH_SetWordLength (XMC_USIC_CH_t *const channel, const uint8_t word_length)
 
void XMC_UART_CH_Start (XMC_USIC_CH_t *const channel)
 
XMC_UART_CH_STATUS_t XMC_UART_CH_Stop (XMC_USIC_CH_t *const channel)
 
void XMC_UART_CH_Transmit (XMC_USIC_CH_t *const channel, const uint16_t data)
 
void XMC_UART_CH_TriggerServiceRequest (XMC_USIC_CH_t *const channel, const uint32_t service_request_line)
 

Detailed Description

The UART driver uses Universal Serial Interface Channel(USIC) module to implement UART protocol. It provides APIs to configure USIC channel for UART communication. The driver enables the user in getting the status of UART protocol events, configuring interrupt service requests, protocol related parameter configuration etc.

UART driver features:

  1. Configuration structure XMC_UART_CH_CONFIG_t and initialization function XMC_UART_CH_Init()
  2. Enumeration of events with their bit masks XMC_UART_CH_EVENT_t, XMC_UART_CH_STATUS_FLAG_t
  3. Allows the selection of input source for the DX0 input stage using the API XMC_UART_CH_SetInputSource()
  4. Allows configuration of baudrate using XMC_UART_CH_SetBaudrate() and configuration of data length using XMC_UART_CH_SetWordLength() and XMC_UART_CH_SetFrameLength()
  5. Provides the status of UART protocol events, XMC_UART_CH_GetStatusFlag()
  6. Allows transmission of data using XMC_UART_CH_Transmit() and gets received data using XMC_UART_CH_GetReceivedData()

Macro Definition Documentation

#define XMC_UART0_CH0   XMC_USIC0_CH0

USIC0 channel 0 base address

#define XMC_UART0_CH1   XMC_USIC0_CH1

USIC0 channel 1 base address

#define XMC_UART1_CH0   XMC_USIC1_CH0

USIC1 channel 0 base address

#define XMC_UART1_CH1   XMC_USIC1_CH1

USIC1 channel 1 base address

#define XMC_UART2_CH0   XMC_USIC2_CH0

USIC2 channel 0 base address

#define XMC_UART2_CH1   XMC_USIC2_CH1

USIC2 channel 1 base address

Enumeration Type Documentation

UART configuration events. The enums can be used for configuring events using the CCR register.

Enumerator
XMC_UART_CH_EVENT_RECEIVE_START 

Receive start event

XMC_UART_CH_EVENT_DATA_LOST 

Data lost event

XMC_UART_CH_EVENT_TRANSMIT_SHIFT 

Transmit shift event

XMC_UART_CH_EVENT_TRANSMIT_BUFFER 

Transmit buffer event

XMC_UART_CH_EVENT_STANDARD_RECEIVE 

Receive event

XMC_UART_CH_EVENT_ALTERNATIVE_RECEIVE 

Alternate receive event

XMC_UART_CH_EVENT_BAUD_RATE_GENERATOR 

Baudrate generator event

XMC_UART_CH_EVENT_SYNCHRONIZATION_BREAK 

Event synchronization break

XMC_UART_CH_EVENT_COLLISION 

Event collision

XMC_UART_CH_EVENT_RECEIVER_NOISE 

Event receiver noise

XMC_UART_CH_EVENT_FORMAT_ERROR 

Event format error

XMC_UART_CH_EVENT_FRAME_FINISHED 

Event frame finished

UART Input sampling frequency options

Enumerator
XMC_UART_CH_INPUT_SAMPLING_FREQ_FPERIPH 

Sampling frequency input fperiph

XMC_UART_CH_INPUT_SAMPLING_FREQ_FRACTIONAL_DIVIDER 

Sampling frequency input fractional divider

UART input stages

Enumerator
XMC_UART_CH_INPUT_RXD 

UART input stage DX0

XMC_UART_CH_INPUT_RXD1 

UART input stage DX3

XMC_UART_CH_INPUT_RXD2 

UART input stage DX5

UART channel interrupt node pointers

Enumerator
XMC_UART_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT 

Node pointer for transmit shift interrupt

XMC_UART_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER 

Node pointer for transmit buffer interrupt

XMC_UART_CH_INTERRUPT_NODE_POINTER_RECEIVE 

Node pointer for receive interrupt

XMC_UART_CH_INTERRUPT_NODE_POINTER_ALTERNATE_RECEIVE 

Node pointer for alternate receive interrupt

XMC_UART_CH_INTERRUPT_NODE_POINTER_PROTOCOL 

Node pointer for protocol related interrupts

UART portocol status. The enum values can be used for getting the status of UART channel.

Enumerator
XMC_UART_CH_STATUS_FLAG_TRANSMISSION_IDLE 

UART Protocol Status transmit IDLE

XMC_UART_CH_STATUS_FLAG_RECEPTION_IDLE 

UART Protocol Status receive IDLE

XMC_UART_CH_STATUS_FLAG_SYNCHRONIZATION_BREAK_DETECTED 

UART Protocol Status synchronization break detected

XMC_UART_CH_STATUS_FLAG_COLLISION_DETECTED 

UART Protocol Status collision detected

XMC_UART_CH_STATUS_FLAG_RECEIVER_NOISE_DETECTED 

UART Protocol Status receiver noise detected

XMC_UART_CH_STATUS_FLAG_FORMAT_ERROR_IN_STOP_BIT_0 

UART Protocol Status format error in stop bit 0

XMC_UART_CH_STATUS_FLAG_FORMAT_ERROR_IN_STOP_BIT_1 

UART Protocol Status format error in stop bit 1

XMC_UART_CH_STATUS_FLAG_RECEIVE_FRAME_FINISHED 

UART Protocol Status receive frame finished

XMC_UART_CH_STATUS_FLAG_TRANSMITTER_FRAME_FINISHED 

UART Protocol Status transmit frame finished

XMC_UART_CH_STATUS_FLAG_TRANSFER_STATUS_BUSY 

UART Protocol Status transfer status busy

XMC_UART_CH_STATUS_FLAG_RECEIVER_START_INDICATION 

UART Protocol Status receive start indication flag

XMC_UART_CH_STATUS_FLAG_DATA_LOST_INDICATION 

UART Protocol Status data lost indication flag

XMC_UART_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION 

UART Protocol Status transmit shift indication flag

XMC_UART_CH_STATUS_FLAG_TRANSMIT_BUFFER_INDICATION 

UART Protocol Status transmit buffer indication flag

XMC_UART_CH_STATUS_FLAG_RECEIVE_INDICATION 

UART Protocol Status receive indication flag

XMC_UART_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION 

UART Protocol Status alternative receive indication flag

XMC_UART_CH_STATUS_FLAG_BAUD_RATE_GENERATOR_INDICATION 

UART Protocol Status baudrate generator indication flag

UART driver status

Enumerator
XMC_UART_CH_STATUS_OK 

UART driver status : OK

XMC_UART_CH_STATUS_ERROR 

UART driver status : ERROR

XMC_UART_CH_STATUS_BUSY 

UART driver status : BUSY

Function Documentation

void XMC_UART_CH_ClearStatusFlag ( XMC_USIC_CH_t *const  channel,
const uint32_t  flag 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
flagUART events to be cleared.
Range: Use XMC_UART_CH_STATUS_FLAG_t enumerations for event bitmasks. XMC_UART_CH_STATUS_FLAG_TRANSMISSION_IDLE, XMC_UART_CH_STATUS_FLAG_RECEPTION_IDLE, XMC_UART_CH_STATUS_FLAG_SYNCHRONIZATION_BREAK_DETECTED etc.
Returns
None
Description
Clears the status of UART channel events.

Multiple events can be combined using the bitwise OR operation and configured in one function call. XMC_UART_CH_STATUS_FLAG_t enumerates multiple event bitmasks. These enumerations can be used as input to the API. Events are cleared by setting the bitmask to the PSCR register.
Related APIs:
XMC_UART_CH_DisableEvent(), XMC_UART_CH_GetStatusFlag()


void XMC_UART_CH_DisableDataTransmission ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Returns
None
Description
Disable data transmission.

Use this function in combination with XMC_UART_CH_EnableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. FIFO is filled using XMC_USIC_CH_TXFIFO_PutData().
Related APIs:
XMC_UART_CH_EnableDataTransmission()


void XMC_UART_CH_DisableEvent ( XMC_USIC_CH_t *const  channel,
const uint32_t  event 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
eventBitmask of events to disable. Use the type XMC_UART_CH_EVENT_t for naming events.
Range: XMC_UART_CH_EVENT_RECEIVE_START, XMC_UART_CH_EVENT_DATA_LOST, XMC_UART_CH_EVENT_TRANSMIT_SHIFT, XMC_UART_CH_EVENT_TRANSMIT_BUFFER, etc.
Returns
None
Description
Disables the interrupt events by clearing the bits in CCR register.

Multiple events can be combined using the bitwise OR operation and configured in one function call. XMC_UART_CH_EVENT_FLAG_t enumerates multiple event bitmasks. These enumerations can be used as input to the API.
Related APIs:
XMC_UART_CH_ClearStatusFlag(), XMC_UART_CH_EnableEvent()


void XMC_UART_CH_DisableInputDigitalFilter ( XMC_USIC_CH_t *const  channel,
const XMC_UART_CH_INPUT_t  input 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
inputUART channel input stage of type XMC_UART_CH_INPUT_t.
Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5).
Returns
None
Description
Disables the digital filter for UART input stage.

Related APIs:
XMC_UART_CH_EnableInputDigitalFilter()


void XMC_UART_CH_DisableInputInversion ( XMC_USIC_CH_t *const  channel,
const XMC_UART_CH_INPUT_t  input 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
inputUART channel input stage of type XMC_UART_CH_INPUT_t.
Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5).
Returns
None
Description
Disables input inversion for UART input data signal.

Resets the input data polarity for the UART input data signal.
Related APIs:
XMC_UART_CH_EnableInputInversion()


void XMC_UART_CH_DisableInputSync ( XMC_USIC_CH_t *const  channel,
const XMC_UART_CH_INPUT_t  input 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
inputUART channel input stage of type XMC_UART_CH_INPUT_t.
Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5).
Returns
None
Description
Disables synchronous input for the UART input stage.

Related APIs:
XMC_UART_CH_EnableInputSync(), XMC_UART_CH_EnableInputDigitalFilter()


void XMC_UART_CH_EnableDataTransmission ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Returns
None
Description
Enable data transmission.

Use this function in combination with XMC_UART_CH_DisableDataTransmission() to fill the FIFO and send the FIFO content without gaps in the transmission. FIFO is filled using XMC_USIC_CH_TXFIFO_PutData().
Note
If you need more control over the start of transmission use XMC_USIC_CH_SetStartTransmisionMode()
Related APIs:
XMC_UART_CH_DisableDataTransmission()


void XMC_UART_CH_EnableEvent ( XMC_USIC_CH_t *const  channel,
const uint32_t  event 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
eventEvent bitmasks to enable. Use the type XMC_UART_CH_EVENT_t for naming events.
Range: XMC_UART_CH_EVENT_RECEIVE_START, XMC_UART_CH_EVENT_DATA_LOST, XMC_UART_CH_EVENT_TRANSMIT_SHIFT, XMC_UART_CH_EVENT_TRANSMIT_BUFFER, etc.
Returns
None
Description
Enables interrupt events for UART communication.

Multiple events can be combined using the bitwise OR operation and configured in one function call. XMC_UART_CH_EVENT_t enumerates multiple event bitmasks. These enumerations can be used as input to the API. Events are configured by setting bits in the CCR register.
Related APIs:
XMC_UART_CH_DisableEvent(), XMC_UART_CH_SetInterruptNodePointer(), XMC_UART_CH_GetStatusFlag()


void XMC_UART_CH_EnableInputDigitalFilter ( XMC_USIC_CH_t *const  channel,
const XMC_UART_CH_INPUT_t  input 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
inputUART channel input stage of type XMC_UART_CH_INPUT_t.
Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5).
Returns
None
Description
Enables the digital filter for UART input stage.

Related APIs:
XMC_UART_CH_DisableInputDigitalFilter()


void XMC_UART_CH_EnableInputInversion ( XMC_USIC_CH_t *const  channel,
const XMC_UART_CH_INPUT_t  input 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
inputUART channel input stage of type XMC_UART_CH_INPUT_t.
Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5).
Returns
None
Description
Enables input inversion for UART input data signal.

Polarity of the input source can be changed to provide inverted data input.
Related APIs:
XMC_UART_CH_DisableInputInversion()


void XMC_UART_CH_EnableInputSync ( XMC_USIC_CH_t *const  channel,
const XMC_UART_CH_INPUT_t  input 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
inputUART channel input stage of type XMC_UART_CH_INPUT_t.
Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5).
Returns
None
Description
Enables synchronous input for the UART input stage.

Related APIs:
XMC_UART_CH_DisableInputSync(), XMC_UART_CH_EnableInputDigitalFilter()


uint16_t XMC_UART_CH_GetReceivedData ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Returns
uint16_t Received data over UART communication channel.
Description
Provides one word of data received over UART communication channel.

Based on the channel configuration, data is either read from the receive FIFO or RBUF register. Before returning the value, there is no check for data validity. User should check the appropriate data receive flags(standard receive/alternative receive/FIFO standard receive/FIFO alternative receive) before executing the API. Reading from an empty receive FIFO can generate a receive error event.
Related APIs:
XMC_UART_CH_GetStatusFlag(), XMC_UART_CH_Transmit()


uint32_t XMC_UART_CH_GetStatusFlag ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Returns
Status of UART channel events.
Range: Use XMC_UART_CH_STATUS_FLAG_t enumerations for event bitmasks. XMC_UART_CH_STATUS_FLAG_TRANSMISSION_IDLE, XMC_UART_CH_STATUS_FLAG_RECEPTION_IDLE, XMC_UART_CH_STATUS_FLAG_SYNCHRONIZATION_BREAK_DETECTED etc.
Description
Provides the status of UART channel events.

Status provided by the API represents the status of multiple events at their bit positions. The bitmasks can be obtained using the enumeration XMC_UART_CH_STATUS_FLAG_t. Event status is obtained by reading the register PSR_ASCMode.
Related APIs:
XMC_UART_CH_EnableEvent(), XMC_UART_CH_ClearStatusFlag()


void XMC_UART_CH_Init ( XMC_USIC_CH_t *const  channel,
const XMC_UART_CH_CONFIG_t *const  config 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0, XMC_UART1_CH1,XMC_UART2_CH0, XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
configConstant pointer to UART configuration structure of type XMC_UART_CH_CONFIG_t.
Returns
XMC_UART_CH_STATUS_t Status of initializing the USIC channel for UART protocol.
Range: XMC_UART_CH_STATUS_OK if initialization is successful.
XMC_UART_CH_STATUS_ERROR if configuration of baudrate failed.
Description
Initializes the USIC channel for UART protocol.

During the initialization, USIC channel is enabled, baudrate is configured with the defined oversampling value in the intialization structure. If the oversampling value is set to 0 in the structure, the default oversampling of 16 is considered. Sampling point for each symbol is configured at the half of sampling period. Symbol value is decided by the majority decision among 3 samples. Word length is configured with the number of data bits. If the value of frame_length is 0, then USIC channel frame length is set to the same value as word length. If frame_length is greater than 0, it is set as the USIC channel frame length. Parity mode is set to the value configured for parity_mode. The USIC channel should be set to UART mode by calling the XMC_UART_CH_Start() API after the initialization.
Related APIs:
XMC_UART_CH_Start(), XMC_UART_CH_Stop(), XMC_UART_CH_Transmit()


void XMC_UART_CH_SelectInterruptNodePointer ( XMC_USIC_CH_t *const  channel,
const XMC_UART_CH_INTERRUPT_NODE_POINTER_t  interrupt_node,
const uint32_t  service_request 
)
Parameters
channelPointer to USIC channel handler of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
interrupt_nodeInterrupt node pointer to be configured.
Range: XMC_UART_CH_INTERRUPT_NODE_POINTER_TRANSMIT_SHIFT, XMC_UART_CH_INTERRUPT_NODE_POINTER_TRANSMIT_BUFFER etc.
service_requestService request number.
Range: 0 to 5.
Returns
None
Description
Sets the interrupt node for USIC channel events.

For an event to generate interrupt, node pointer should be configured with service request(SR0, SR1..SR5). The NVIC node gets linked to the interrupt event by doing so.
Note: NVIC node should be separately enabled to generate the interrupt.
Related APIs:
XMC_UART_CH_EnableEvent()


XMC_UART_CH_STATUS_t XMC_UART_CH_SetBaudrate ( XMC_USIC_CH_t *const  channel,
uint32_t  rate,
uint32_t  oversampling 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1 ,XMC_UART1_CH0, XMC_UART1_CH1, XMC_UART2_CH0, XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
rateDesired baudrate.
Range: minimum value = 100, maximum value depends on the peripheral clock frequency
and oversampling. Maximum baudrate can be derived using the formula: (fperiph * 1023)/(1024 * oversampling)
oversamplingRequired oversampling. The value indicates the number of time quanta for one symbol of data.
This can be related to the number of samples for each logic state of the data signal.
Range: 4 to 32. Value should be chosen based on the protocol used.
Returns
XMC_UART_CH_STATUS_t Status indicating the baudrate configuration.
Range: XMC_USIC_CH_STATUS_OK if baudrate is successfully configured, XMC_USIC_CH_STATUS_ERROR if desired baudrate or oversampling is invalid.
Description:
Sets the bus speed in bits per second.

Derives the values of STEP and PDIV to arrive at the optimum realistic speed possible. oversampling is the number of samples to be taken for each symbol of UART protocol. Default oversampling of 16 is considered if the input oversampling is less than 4. It is recommended to keep a minimum oversampling of 4 for UART.
Related APIs:
XMC_UART_CH_Init(), XMC_UART_CH_Stop()
void XMC_UART_CH_SetFrameLength ( XMC_USIC_CH_t *const  channel,
const uint8_t  frame_length 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
frame_lengthNumber of data bits in each UART frame.
Range: minimum= 1, maximum= 64.
Returns
None
Description
Sets the number of data bits for UART communication.

The frame length is configured by setting the input value to SCTR register. The value of frame_length will be decremented by 1, before setting it to the register. Frame length should not be set to 64 for UART communication.
Related APIs:
XMC_UART_CH_SetWordLength()


void XMC_UART_CH_SetInputSamplingFreq ( XMC_USIC_CH_t *const  channel,
const XMC_UART_CH_INPUT_t  input,
const XMC_UART_CH_INPUT_SAMPLING_FREQ_t  sampling_freq 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
inputUART channel input stage of type XMC_UART_CH_INPUT_t.
Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5).
sampling_freqInput sampling frequency.
Range: XMC_UART_CH_INPUT_SAMPLING_FREQ_FPERIPH, XMC_UART_CH_INPUT_SAMPLING_FREQ_FRACTIONAL_DIVIDER.
Returns
None
Description
Sets the sampling frequency for the UART input stage.

Related APIs:
XMC_UART_CH_EnableInputSync(), XMC_UART_CH_EnableInputDigitalFilter()


void XMC_UART_CH_SetInputSource ( XMC_USIC_CH_t *const  channel,
const XMC_UART_CH_INPUT_t  input,
const uint8_t  source 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
inputUART channel input stage of type XMC_UART_CH_INPUT_t.
Range: XMC_UART_CH_INPUT_RXD (for DX0), XMC_UART_CH_INPUT_RXD1 (for DX3), XMC_UART_CH_INPUT_RXD2 (for DX5).
sourceInput source select for the input stage. The table provided below maps the decimal value with the input source.
0DXnA
1DXnB
2DXnC
3DXnD
4DXnE
5DXnF
6DXnG
7Always 1
Returns
None
Description
Sets input soource for the UART communication.

It is used for configuring the input stage for data reception. Selects the input data signal source among DXnA, DXnB.. DXnG for the input stage. The API can be used for the input stages DX0, DX3 and DX5.
Related APIs:
XMC_UART_CH_EnableInputInversion()


void XMC_UART_CH_SetInterruptNodePointer ( XMC_USIC_CH_t *const  channel,
const uint8_t  service_request 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
service_requestService request number for generating protocol interrupts.
Range: 0 to 5.
Returns
None
Description
Sets the interrupt node for UART channel protocol events.

For all the protocol events enlisted in the enumeration XMC_UART_CH_EVENT_t, one common interrupt gets generated. The service request connects the interrupt node to the UART protocol events. Note: NVIC node should be separately enabled to generate the interrupt.
Related APIs:
XMC_UART_CH_EnableEvent()


void XMC_UART_CH_SetPulseLength ( XMC_USIC_CH_t *const  channel,
const uint8_t  pulse_length 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
pulse_lengthLength of the zero pulse in number of time quanta.
Range: 0 to 7.
Returns
None
Description
Sets the length of zero pulse in number of time quanta. Value 0 indicates one time quanta.

Maximum possible is 8 time quanta with the value configured as 7.
The value is set to PCR_ASCMode register.
Related APIs:
XMC_UART_CH_EnableInputInversion(), XMC_UART_CH_SetSamplePoint()


void XMC_UART_CH_SetSamplePoint ( XMC_USIC_CH_t *const  channel,
const uint32_t  sample_point 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
sample_pointSample point among the number of samples.
Range: minimum= 0, maximum= oversampling (DCTQ).
Returns
None
Description
Sets the sample point among the multiple samples for each UART symbol.

The sample point is the one sample among number of samples set as oversampling. The value should be less than the oversampling value. XMC_UART_CH_Init() sets the sample point to the sample at the centre. For example if the oversampling is 16, then the sample point is set to 9.
Related APIs:
XMC_UART_CH_EnableInputInversion(), XMC_UART_CH_SetSamplePoint()


void XMC_UART_CH_SetWordLength ( XMC_USIC_CH_t *const  channel,
const uint8_t  word_length 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
word_lengthData word length.
Range: minimum= 1, maximum= 16.
Returns
None
Description
Sets the data word length in number of bits.

Word length can range from 1 to 16. It indicates the number of data bits in a data word. The value of word_length will be decremented by 1 before setting the value to SCTR register. If the UART data bits is more than 16, then the frame length should be set to the actual number of bits and word length should be configured with the number of bits expected in each transaction. For example, if number of data bits for UART communication is 20 bits, then the frame length should be set as 20. Word length can be set based on the transmit and receive handling. If data is stored as 8bit array, then the word length can be set to 8. In this case, a full message of UART data should be transmitted/ received as 3 data words.
Related APIs:
XMC_UART_CH_SetFrameLength()


void XMC_UART_CH_Start ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Returns
None
Description
Sets the USIC channel operation mode to UART mode.

CCR register bitfield Mode is set to 2(UART mode). This API should be called after configuring the USIC channel. Transmission and reception can happen only when the UART mode is set. This is an inline function.
Related APIs:
XMC_UART_CH_Stop(), XMC_UART_CH_Transmit()


XMC_UART_CH_STATUS_t XMC_UART_CH_Stop ( XMC_USIC_CH_t *const  channel)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Returns
XMC_UART_CH_STATUS_t Status to indicate if the communication channel is stopped successfully.
XMC_UART_CH_STATUS_OK if the communication channel is stopped. XMC_UART_CH_STATUS_BUSY if the communication channel is busy.
Description
Stops the UART communication.

CCR register bitfield Mode is reset. This disables the communication. Before starting the communication again, the channel has to be reconfigured.
Related APIs:
XMC_UART_CH_Init()


void XMC_UART_CH_Transmit ( XMC_USIC_CH_t *const  channel,
const uint16_t  data 
)
Parameters
channelConstant pointer to USIC channel handle of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
dataData to be transmitted.
Range: 16 bit unsigned data within the range 0 to 65535. Actual size of data transmitted depends on the configured number of bits for the UART protocol in the register SCTR.
Returns
None
Description
Transmits data over serial communication channel using UART protocol.

Based on the channel configuration, data is either put to the transmit FIFO or to TBUF register. Before putting data to TBUF, the API waits for TBUF to finish shifting its contents to shift register. So user can continuously execute the API without checking for TBUF busy status. Based on the number of data bits configured, the lower significant bits will be extracted for transmission.

Note: When FIFO is not configured, the API waits for the TBUF to be available. This makes the execution a blocking call.

Related APIs:
XMC_UART_CH_GetReceivedData()


void XMC_UART_CH_TriggerServiceRequest ( XMC_USIC_CH_t *const  channel,
const uint32_t  service_request_line 
)
Parameters
channelPointer to USIC channel handler of type XMC_USIC_CH_t
Range: XMC_UART0_CH0, XMC_UART0_CH1,XMC_UART1_CH0,XMC_UART1_CH1,XMC_UART2_CH0,XMC_UART2_CH1
Note
Availability of UART1 and UART2 depends on device selection
Parameters
service_request_lineservice request number of the event to be triggered.
Range: 0 to 5.
Returns
None
Description
Trigger a UART interrupt service request.

When the UART service request is triggered, the NVIC interrupt associated with it will be generated if enabled.
Related APIs:
XMC_UART_CH_SelectInterruptNodePointer()


Generated on Mon Aug 7 2017 11:33:57 for XMC Peripheral Library for XMC4000 Family by   doxygen 1.8.11