MSP430 DriverLib for MSP430F5xx_6xx Devices  2.10.00.09
 All Data Structures Functions Variables Modules Pages
usci_a_uart

Functions

bool USCI_A_UART_init (uint16_t baseAddress, USCI_A_UART_initParam *param)
 Advanced initialization routine for the UART block. The values to be written into the clockPrescalar, firstModReg, secondModReg and overSampling parameters should be pre-computed and passed into the initialization function. More...
 
void USCI_A_UART_transmitData (uint16_t baseAddress, uint8_t transmitData)
 Transmits a byte from the UART Module. More...
 
uint8_t USCI_A_UART_receiveData (uint16_t baseAddress)
 Receives a byte that has been sent to the UART Module. More...
 
void USCI_A_UART_enableInterrupt (uint16_t baseAddress, uint8_t mask)
 Enables individual UART interrupt sources. More...
 
void USCI_A_UART_disableInterrupt (uint16_t baseAddress, uint8_t mask)
 Disables individual UART interrupt sources. More...
 
uint8_t USCI_A_UART_getInterruptStatus (uint16_t baseAddress, uint8_t mask)
 Gets the current UART interrupt status. More...
 
void USCI_A_UART_clearInterrupt (uint16_t baseAddress, uint8_t mask)
 Clears UART interrupt sources. More...
 
void USCI_A_UART_enable (uint16_t baseAddress)
 Enables the UART block. More...
 
void USCI_A_UART_disable (uint16_t baseAddress)
 Disables the UART block. More...
 
uint8_t USCI_A_UART_queryStatusFlags (uint16_t baseAddress, uint8_t mask)
 Gets the current UART status flags. More...
 
void USCI_A_UART_setDormant (uint16_t baseAddress)
 Sets the UART module in dormant mode. More...
 
void USCI_A_UART_resetDormant (uint16_t baseAddress)
 Re-enables UART module from dormant mode. More...
 
void USCI_A_UART_transmitAddress (uint16_t baseAddress, uint8_t transmitAddress)
 Transmits the next byte to be transmitted marked as address depending on selected multiprocessor mode. More...
 
void USCI_A_UART_transmitBreak (uint16_t baseAddress)
 Transmit break. More...
 
uint32_t USCI_A_UART_getReceiveBufferAddressForDMA (uint16_t baseAddress)
 Returns the address of the RX Buffer of the UART for the DMA module. More...
 
uint32_t USCI_A_UART_getTransmitBufferAddressForDMA (uint16_t baseAddress)
 Returns the address of the TX Buffer of the UART for the DMA module. More...
 

Detailed Description

Function Documentation

void USCI_A_UART_clearInterrupt ( uint16_t  baseAddress,
uint8_t  mask 
)

Clears UART interrupt sources.

The UART interrupt source is cleared, so that it no longer asserts. The highest interrupt flag is automatically cleared when an interrupt vector generator is used.

Parameters
baseAddressis the base address of the USCI_A_UART module.
maskis a bit mask of the interrupt sources to be cleared. Mask value is the logical OR of any of the following:
  • USCI_A_UART_RECEIVE_INTERRUPT_FLAG - Receive interrupt flag
  • USCI_A_UART_TRANSMIT_INTERRUPT_FLAG - Transmit interrupt flag

Modified bits of UCAxIFG register.

Returns
None
void USCI_A_UART_disable ( uint16_t  baseAddress)

Disables the UART block.

This will disable operation of the UART block.

Parameters
baseAddressis the base address of the USCI_A_UART module.

Modified bits are UCSWRST of UCAxCTL1 register.

Returns
None
void USCI_A_UART_disableInterrupt ( uint16_t  baseAddress,
uint8_t  mask 
)

Disables individual UART interrupt sources.

Disables the indicated UART interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Parameters
baseAddressis the base address of the USCI_A_UART module.
maskis the bit mask of the interrupt sources to be disabled. Mask value is the logical OR of any of the following:
  • USCI_A_UART_RECEIVE_INTERRUPT - Receive interrupt
  • USCI_A_UART_TRANSMIT_INTERRUPT - Transmit interrupt
  • USCI_A_UART_RECEIVE_ERRONEOUSCHAR_INTERRUPT - Receive erroneous-character interrupt enable
  • USCI_A_UART_BREAKCHAR_INTERRUPT - Receive break character interrupt enable

Modified bits of UCAxCTL1 register and bits of UCAxIE register.

Returns
None
void USCI_A_UART_enable ( uint16_t  baseAddress)

Enables the UART block.

This will enable operation of the UART block.

Parameters
baseAddressis the base address of the USCI_A_UART module.

Modified bits are UCSWRST of UCAxCTL1 register.

Returns
None
void USCI_A_UART_enableInterrupt ( uint16_t  baseAddress,
uint8_t  mask 
)

Enables individual UART interrupt sources.

Enables the indicated UART interrupt sources. The interrupt flag is first and then the corresponding interrupt is enabled. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor. Does not clear interrupt flags.

Parameters
baseAddressis the base address of the USCI_A_UART module.
maskis the bit mask of the interrupt sources to be enabled. Mask value is the logical OR of any of the following:
  • USCI_A_UART_RECEIVE_INTERRUPT - Receive interrupt
  • USCI_A_UART_TRANSMIT_INTERRUPT - Transmit interrupt
  • USCI_A_UART_RECEIVE_ERRONEOUSCHAR_INTERRUPT - Receive erroneous-character interrupt enable
  • USCI_A_UART_BREAKCHAR_INTERRUPT - Receive break character interrupt enable

Modified bits of UCAxCTL1 register and bits of UCAxIE register.

Returns
None
uint8_t USCI_A_UART_getInterruptStatus ( uint16_t  baseAddress,
uint8_t  mask 
)

Gets the current UART interrupt status.

This returns the interrupt status for the UART module based on which flag is passed.

Parameters
baseAddressis the base address of the USCI_A_UART module.
maskis the masked interrupt flag status to be returned. Mask value is the logical OR of any of the following:
  • USCI_A_UART_RECEIVE_INTERRUPT_FLAG - Receive interrupt flag
  • USCI_A_UART_TRANSMIT_INTERRUPT_FLAG - Transmit interrupt flag

Modified bits of UCAxIFG register.

Returns
Logical OR of any of the following:
  • USCI_A_UART_RECEIVE_INTERRUPT_FLAG Receive interrupt flag
  • USCI_A_UART_TRANSMIT_INTERRUPT_FLAG Transmit interrupt flag
    indicating the status of the masked flags
uint32_t USCI_A_UART_getReceiveBufferAddressForDMA ( uint16_t  baseAddress)

Returns the address of the RX Buffer of the UART for the DMA module.

Returns the address of the UART RX Buffer. This can be used in conjunction with the DMA to store the received data directly to memory.

Parameters
baseAddressis the base address of the USCI_A_UART module.
Returns
Address of RX Buffer
uint32_t USCI_A_UART_getTransmitBufferAddressForDMA ( uint16_t  baseAddress)

Returns the address of the TX Buffer of the UART for the DMA module.

Returns the address of the UART TX Buffer. This can be used in conjunction with the DMA to obtain transmitted data directly from memory.

Parameters
baseAddressis the base address of the USCI_A_UART module.
Returns
Address of TX Buffer
bool USCI_A_UART_init ( uint16_t  baseAddress,
USCI_A_UART_initParam param 
)

Advanced initialization routine for the UART block. The values to be written into the clockPrescalar, firstModReg, secondModReg and overSampling parameters should be pre-computed and passed into the initialization function.

Upon successful initialization of the UART block, this function will have initialized the module, but the UART block still remains disabled and must be enabled with USCI_A_UART_enable(). To calculate values for clockPrescalar, firstModReg, secondModReg and overSampling please use the link below.

https://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSP430BaudRateConverter/index.html

Parameters
baseAddressis the base address of the USCI_A_UART module.
paramis the pointer to struct for initialization.

Modified bits are UCPEN, UCPAR, UCMSB, UC7BIT, UCSPB, UCMODEx and UCSYNC of UCAxCTL0 register; bits UCSSELx and UCSWRST of UCAxCTL1 register.

Returns
STATUS_SUCCESS or STATUS_FAIL of the initialization process

References USCI_A_UART_initParam::clockPrescalar, USCI_A_UART_initParam::firstModReg, USCI_A_UART_initParam::msborLsbFirst, USCI_A_UART_initParam::numberofStopBits, USCI_A_UART_initParam::overSampling, USCI_A_UART_initParam::parity, USCI_A_UART_initParam::secondModReg, USCI_A_UART_initParam::selectClockSource, and USCI_A_UART_initParam::uartMode.

uint8_t USCI_A_UART_queryStatusFlags ( uint16_t  baseAddress,
uint8_t  mask 
)

Gets the current UART status flags.

This returns the status for the UART module based on which flag is passed.

Parameters
baseAddressis the base address of the USCI_A_UART module.
maskis the masked interrupt flag status to be returned. Mask value is the logical OR of any of the following:
  • USCI_A_UART_LISTEN_ENABLE
  • USCI_A_UART_FRAMING_ERROR
  • USCI_A_UART_OVERRUN_ERROR
  • USCI_A_UART_PARITY_ERROR
  • USCI_A_UART_BREAK_DETECT
  • USCI_A_UART_RECEIVE_ERROR
  • USCI_A_UART_ADDRESS_RECEIVED
  • USCI_A_UART_IDLELINE
  • USCI_A_UART_BUSY

Modified bits of UCAxSTAT register.

Returns
Logical OR of any of the following:
  • USCI_A_UART_LISTEN_ENABLE
  • USCI_A_UART_FRAMING_ERROR
  • USCI_A_UART_OVERRUN_ERROR
  • USCI_A_UART_PARITY_ERROR
  • USCI_A_UART_BREAK_DETECT
  • USCI_A_UART_RECEIVE_ERROR
  • USCI_A_UART_ADDRESS_RECEIVED
  • USCI_A_UART_IDLELINE
  • USCI_A_UART_BUSY
    indicating the status of the masked interrupt flags
uint8_t USCI_A_UART_receiveData ( uint16_t  baseAddress)

Receives a byte that has been sent to the UART Module.

This function reads a byte of data from the UART receive data Register.

Parameters
baseAddressis the base address of the USCI_A_UART module.

Modified bits of UCAxRXBUF register.

Returns
Returns the byte received from by the UART module, cast as an uint8_t.
void USCI_A_UART_resetDormant ( uint16_t  baseAddress)

Re-enables UART module from dormant mode.

Not dormant. All received characters set UCRXIFG.

Parameters
baseAddressis the base address of the USCI_A_UART module.

Modified bits are UCDORM of UCAxCTL1 register.

Returns
None
void USCI_A_UART_setDormant ( uint16_t  baseAddress)

Sets the UART module in dormant mode.

Puts USCI in sleep mode. Only characters that are preceded by an idle-line or with address bit set UCRXIFG. In UART mode with automatic baud-rate detection, only the combination of a break and sync field sets UCRXIFG.

Parameters
baseAddressis the base address of the USCI_A_UART module.

Modified bits of UCAxCTL1 register.

Returns
None
void USCI_A_UART_transmitAddress ( uint16_t  baseAddress,
uint8_t  transmitAddress 
)

Transmits the next byte to be transmitted marked as address depending on selected multiprocessor mode.

Parameters
baseAddressis the base address of the USCI_A_UART module.
transmitAddressis the next byte to be transmitted

Modified bits of UCAxTXBUF register and bits of UCAxCTL1 register.

Returns
None
void USCI_A_UART_transmitBreak ( uint16_t  baseAddress)

Transmit break.

Transmits a break with the next write to the transmit buffer. In UART mode with automatic baud-rate detection, USCI_A_UART_AUTOMATICBAUDRATE_SYNC(0x55) must be written into UCAxTXBUF to generate the required break/sync fields. Otherwise, DEFAULT_SYNC(0x00) must be written into the transmit buffer. Also ensures module is ready for transmitting the next data.

Parameters
baseAddressis the base address of the USCI_A_UART module.

Modified bits of UCAxTXBUF register and bits of UCAxCTL1 register.

Returns
None
void USCI_A_UART_transmitData ( uint16_t  baseAddress,
uint8_t  transmitData 
)

Transmits a byte from the UART Module.

This function will place the supplied data into UART transmit data register to start transmission

Parameters
baseAddressis the base address of the USCI_A_UART module.
transmitDatadata to be transmitted from the UART module

Modified bits of UCAxTXBUF register.

Returns
None

Copyright 2015, Texas Instruments Incorporated