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

Macros

#define CC430_DEVICE
 
#define NOT_CC430_DEVICE
 

Functions

void UCS_setExternalClockSource (uint32_t XT1CLK_frequency, uint32_t XT2CLK_frequency)
 Sets the external clock source. More...
 
void UCS_initClockSignal (uint8_t selectedClockSignal, uint16_t clockSource, uint16_t clockSourceDivider)
 Initializes a clock signal. More...
 
void UCS_turnOnLFXT1 (uint16_t xt1drive, uint8_t xcap)
 Initializes the XT1 crystal oscillator in low frequency mode. More...
 
void UCS_turnOnHFXT1 (uint16_t xt1drive)
 Initializes the XT1 crystal oscillator in high frequency mode. More...
 
void UCS_bypassXT1 (uint8_t highOrLowFrequency)
 Bypass the XT1 crystal oscillator. More...
 
bool UCS_turnOnLFXT1WithTimeout (uint16_t xt1drive, uint8_t xcap, uint16_t timeout)
 Initializes the XT1 crystal oscillator in low frequency mode with timeout. More...
 
bool UCS_turnOnHFXT1WithTimeout (uint16_t xt1drive, uint16_t timeout)
 Initializes the XT1 crystal oscillator in high frequency mode with timeout. More...
 
bool UCS_bypassXT1WithTimeout (uint8_t highOrLowFrequency, uint16_t timeout)
 Bypasses the XT1 crystal oscillator with time out. More...
 
void UCS_turnOffXT1 (void)
 Stops the XT1 oscillator using the XT1OFF bit. More...
 
void UCS_turnOnXT2 (uint16_t xt2drive)
 Initializes the XT2 crystal oscillator. More...
 
void UCS_bypassXT2 (void)
 Bypasses the XT2 crystal oscillator. More...
 
bool UCS_turnOnXT2WithTimeout (uint16_t xt2drive, uint16_t timeout)
 Initializes the XT2 crystal oscillator with timeout. More...
 
bool UCS_bypassXT2WithTimeout (uint16_t timeout)
 Bypasses the XT2 crystal oscillator with timeout. More...
 
void UCS_turnOffXT2 (void)
 Stops the XT2 oscillator using the XT2OFF bit. More...
 
void UCS_initFLLSettle (uint16_t fsystem, uint16_t ratio)
 Initializes the DCO to operate a frequency that is a multiple of the reference frequency into the FLL. More...
 
void UCS_initFLL (uint16_t fsystem, uint16_t ratio)
 Initializes the DCO to operate a frequency that is a multiple of the reference frequency into the FLL. More...
 
void UCS_enableClockRequest (uint8_t selectClock)
 Enables conditional module requests. More...
 
void UCS_disableClockRequest (uint8_t selectClock)
 Disables conditional module requests. More...
 
uint8_t UCS_getFaultFlagStatus (uint8_t mask)
 Gets the current UCS fault flag status. More...
 
void UCS_clearFaultFlag (uint8_t mask)
 Clears the current UCS fault flag status for the masked bit. More...
 
void UCS_turnOffSMCLK (void)
 Turns off SMCLK using the SMCLKOFF bit. More...
 
void UCS_turnOnSMCLK (void)
 Turns ON SMCLK using the SMCLKOFF bit. More...
 
uint32_t UCS_getACLK (void)
 Get the current ACLK frequency. More...
 
uint32_t UCS_getSMCLK (void)
 Get the current SMCLK frequency. More...
 
uint32_t UCS_getMCLK (void)
 Get the current MCLK frequency. More...
 
uint16_t UCS_clearAllOscFlagsWithTimeout (uint16_t timeout)
 Clears all the Oscillator Flags. More...
 

Detailed Description

Macro Definition Documentation

#define CC430_DEVICE
Value:
(defined (__CC430F5133__) || defined(__CC430F5135__) || defined(__CC430F5137__) || \
defined(__CC430F6125__) || defined(__CC430F6126__) || defined(__CC430F6127__) || \
defined(__CC430F6135__) || defined(__CC430F6137__) || defined(__CC430F5123__) || \
defined(__CC430F5125__) || defined(__CC430F5143__) || defined(__CC430F5145__) || \
defined(__CC430F5147__) || defined(__CC430F6143__) || defined(__CC430F6145__) || \
defined(__CC430F6147__))
#define NOT_CC430_DEVICE
Value:
(!defined (__CC430F5133__) && !defined(__CC430F5135__) && !defined(__CC430F5137__) && \
!defined(__CC430F6125__) && !defined(__CC430F6126__) && !defined(__CC430F6127__) && \
!defined(__CC430F6135__) && !defined(__CC430F6137__) && !defined(__CC430F5123__) && \
!defined(__CC430F5125__) && !defined(__CC430F5143__) && !defined(__CC430F5145__) && \
!defined(__CC430F5147__) && !defined(__CC430F6143__) && !defined(__CC430F6145__) && \
!defined(__CC430F6147__))

Function Documentation

void UCS_bypassXT1 ( uint8_t  highOrLowFrequency)

Bypass the XT1 crystal oscillator.

Bypasses the XT1 crystal oscillator. Loops until all oscillator fault flags are cleared, with no timeout.

Parameters
highOrLowFrequencyselects high frequency or low frequency mode for XT1. Valid values are:
  • UCS_XT1_HIGH_FREQUENCY
  • UCS_XT1_LOW_FREQUENCY [Default]

Modified bits of UCSCTL7 register, bits of UCSCTL6 register and bits of SFRIFG register.

Returns
None
bool UCS_bypassXT1WithTimeout ( uint8_t  highOrLowFrequency,
uint16_t  timeout 
)

Bypasses the XT1 crystal oscillator with time out.

Bypasses the XT1 crystal oscillator with time out. Loops until all oscillator fault flags are cleared or until a timeout counter is decremented and equals to zero.

Parameters
highOrLowFrequencyselects high frequency or low frequency mode for XT1. Valid values are:
  • UCS_XT1_HIGH_FREQUENCY
  • UCS_XT1_LOW_FREQUENCY [Default]
timeoutis the count value that gets decremented every time the loop that clears oscillator fault flags gets executed.

Modified bits of UCSCTL7 register, bits of UCSCTL6 register and bits of SFRIFG register.

Returns
STATUS_SUCCESS or STATUS_FAIL
void UCS_bypassXT2 ( void  )

Bypasses the XT2 crystal oscillator.

Bypasses the XT2 crystal oscillator, which supports crystal frequencies between 4 MHz and 32 MHz. Loops until all oscillator fault flags are cleared, with no timeout.

Modified bits of UCSCTL7 register, bits of UCSCTL6 register and bits of SFRIFG register.

Returns
None
bool UCS_bypassXT2WithTimeout ( uint16_t  timeout)

Bypasses the XT2 crystal oscillator with timeout.

Bypasses the XT2 crystal oscillator, which supports crystal frequencies between 4 MHz and 32 MHz. Loops until all oscillator fault flags are cleared or until a timeout counter is decremented and equals to zero.

Parameters
timeoutis the count value that gets decremented every time the loop that clears oscillator fault flags gets executed.

Modified bits of UCSCTL7 register, bits of UCSCTL6 register and bits of SFRIFG register.

Returns
STATUS_SUCCESS or STATUS_FAIL
uint16_t UCS_clearAllOscFlagsWithTimeout ( uint16_t  timeout)

Clears all the Oscillator Flags.

Parameters
timeoutis the count value that gets decremented every time the loop that clears oscillator fault flags gets executed.
Returns
Logical OR of any of the following:
  • UCS_XT2OFFG XT2 oscillator fault flag
  • UCS_XT1HFOFFG XT1 oscillator fault flag (HF mode)
  • UCS_XT1LFOFFG XT1 oscillator fault flag (LF mode)
  • UCS_DCOFFG DCO fault flag
    indicating the status of the oscillator fault flags
void UCS_clearFaultFlag ( uint8_t  mask)

Clears the current UCS fault flag status for the masked bit.

Parameters
maskis the masked interrupt flag status to be returned. mask parameter can be any one of the following Valid values are:
  • UCS_XT2OFFG - XT2 oscillator fault flag
  • UCS_XT1HFOFFG - XT1 oscillator fault flag (HF mode)
  • UCS_XT1LFOFFG - XT1 oscillator fault flag (LF mode)
  • UCS_DCOFFG - DCO fault flag

Modified bits of UCSCTL7 register.

Returns
None
void UCS_disableClockRequest ( uint8_t  selectClock)

Disables conditional module requests.

Parameters
selectClockselects specific request disable Valid values are:
  • UCS_ACLK
  • UCS_SMCLK
  • UCS_MCLK
  • UCS_MODOSC

Modified bits of UCSCTL8 register.

Returns
None
void UCS_enableClockRequest ( uint8_t  selectClock)

Enables conditional module requests.

Parameters
selectClockselects specific request enables Valid values are:
  • UCS_ACLK
  • UCS_SMCLK
  • UCS_MCLK
  • UCS_MODOSC

Modified bits of UCSCTL8 register.

Returns
None
uint32_t UCS_getACLK ( void  )

Get the current ACLK frequency.

Get the current ACLK frequency. The user of this API must ensure that UCS_setExternalClockSource API was invoked before in case XT1 or XT2 is being used.

Returns
Current ACLK frequency in Hz
uint8_t UCS_getFaultFlagStatus ( uint8_t  mask)

Gets the current UCS fault flag status.

Parameters
maskis the masked interrupt flag status to be returned. Mask parameter can be either any of the following selection. Valid values are:
  • UCS_XT2OFFG - XT2 oscillator fault flag
  • UCS_XT1HFOFFG - XT1 oscillator fault flag (HF mode)
  • UCS_XT1LFOFFG - XT1 oscillator fault flag (LF mode)
  • UCS_DCOFFG - DCO fault flag
uint32_t UCS_getMCLK ( void  )

Get the current MCLK frequency.

Get the current MCLK frequency. The user of this API must ensure that UCS_setExternalClockSource API was invoked before in case XT1 or XT2 is being used.

Returns
Current MCLK frequency in Hz
uint32_t UCS_getSMCLK ( void  )

Get the current SMCLK frequency.

Get the current SMCLK frequency. The user of this API must ensure that UCS_setExternalClockSource API was invoked before in case XT1 or XT2 is being used.

Returns
Current SMCLK frequency in Hz
void UCS_initClockSignal ( uint8_t  selectedClockSignal,
uint16_t  clockSource,
uint16_t  clockSourceDivider 
)

Initializes a clock signal.

This function initializes each of the clock signals. The user must ensure that this function is called for each clock signal. If not, the default state is assumed for the particular clock signal. Refer MSP430Ware documentation for UCS module or Device Family User's Guide for details of default clock signal states.

Parameters
selectedClockSignalselected clock signal Valid values are:
  • UCS_ACLK
  • UCS_MCLK
  • UCS_SMCLK
  • UCS_FLLREF
clockSourceis clock source for the selectedClockSignal Valid values are:
  • UCS_XT1CLK_SELECT
  • UCS_VLOCLK_SELECT
  • UCS_REFOCLK_SELECT
  • UCS_DCOCLK_SELECT
  • UCS_DCOCLKDIV_SELECT
  • UCS_XT2CLK_SELECT
clockSourceDividerselected the clock divider to calculate clocksignal from clock source. Valid values are:
  • UCS_CLOCK_DIVIDER_1 [Default]
  • UCS_CLOCK_DIVIDER_2
  • UCS_CLOCK_DIVIDER_4
  • UCS_CLOCK_DIVIDER_8
  • UCS_CLOCK_DIVIDER_12 - [Valid only for UCS_FLLREF]
  • UCS_CLOCK_DIVIDER_16
  • UCS_CLOCK_DIVIDER_32 - [Not valid for UCS_FLLREF]

Modified bits of UCSCTL5 register, bits of UCSCTL4 register and bits of UCSCTL3 register.

Returns
None
void UCS_initFLL ( uint16_t  fsystem,
uint16_t  ratio 
)

Initializes the DCO to operate a frequency that is a multiple of the reference frequency into the FLL.

Initializes the DCO to operate a frequency that is a multiple of the reference frequency into the FLL. Loops until all oscillator fault flags are cleared, with no timeout. If the frequency is greater than 16 MHz, the function sets the MCLK and SMCLK source to the undivided DCO frequency. Otherwise, the function sets the MCLK and SMCLK source to the DCOCLKDIV frequency. The function PMM_setVCore() is required to call first if the target frequency is beyond current Vcore supported frequency range.

Parameters
fsystemis the target frequency for MCLK in kHz
ratiois the ratio x/y, where x = fsystem and y = FLL reference frequency.

Modified bits of UCSCTL0 register, bits of UCSCTL4 register, bits of UCSCTL7 register, bits of UCSCTL1 register, bits of SFRIFG1 register and bits of UCSCTL2 register.

Returns
None

Referenced by UCS_initFLLSettle().

void UCS_initFLLSettle ( uint16_t  fsystem,
uint16_t  ratio 
)

Initializes the DCO to operate a frequency that is a multiple of the reference frequency into the FLL.

Initializes the DCO to operate a frequency that is a multiple of the reference frequency into the FLL. Loops until all oscillator fault flags are cleared, with a timeout. If the frequency is greater than 16 MHz, the function sets the MCLK and SMCLK source to the undivided DCO frequency. Otherwise, the function sets the MCLK and SMCLK source to the DCOCLKDIV frequency. This function executes a software delay that is proportional in length to the ratio of the target FLL frequency and the FLL reference. The function PMM_setVCore() is required to call first if the target frequency is beyond current Vcore supported frequency range.

Parameters
fsystemis the target frequency for MCLK in kHz
ratiois the ratio x/y, where x = fsystem and y = FLL reference frequency.

Modified bits of UCSCTL0 register, bits of UCSCTL4 register, bits of UCSCTL7 register, bits of UCSCTL1 register, bits of SFRIFG1 register and bits of UCSCTL2 register.

Returns
None

References UCS_initFLL().

void UCS_setExternalClockSource ( uint32_t  XT1CLK_frequency,
uint32_t  XT2CLK_frequency 
)

Sets the external clock source.

This function sets the external clock sources XT1 and XT2 crystal oscillator frequency values. This function must be called if an external crystal XT1 or XT2 is used and the user intends to call UCS_getMCLK, UCS_getSMCLK or UCS_getACLK APIs. If not, it is not necessary to invoke this API.

Parameters
XT1CLK_frequencyis the XT1 crystal frequencies in Hz
XT2CLK_frequencyis the XT2 crystal frequencies in Hz
Returns
None
void UCS_turnOffSMCLK ( void  )

Turns off SMCLK using the SMCLKOFF bit.

Modified bits of UCSCTL6 register.

Returns
None
void UCS_turnOffXT1 ( void  )

Stops the XT1 oscillator using the XT1OFF bit.

Returns
None
void UCS_turnOffXT2 ( void  )

Stops the XT2 oscillator using the XT2OFF bit.

Modified bits of UCSCTL6 register.

Returns
None
void UCS_turnOnHFXT1 ( uint16_t  xt1drive)

Initializes the XT1 crystal oscillator in high frequency mode.

Initializes the XT1 crystal oscillator in high frequency mode. Loops until all oscillator fault flags are cleared, with no timeout. See the device- specific data sheet for appropriate drive settings.

Parameters
xt1driveis the target drive strength for the XT1 crystal oscillator. Valid values are:
  • UCS_XT1_DRIVE_0
  • UCS_XT1_DRIVE_1
  • UCS_XT1_DRIVE_2
  • UCS_XT1_DRIVE_3 [Default]

Modified bits of UCSCTL7 register, bits of UCSCTL6 register and bits of SFRIFG register.

Returns
None
bool UCS_turnOnHFXT1WithTimeout ( uint16_t  xt1drive,
uint16_t  timeout 
)

Initializes the XT1 crystal oscillator in high frequency mode with timeout.

Initializes the XT1 crystal oscillator in high frequency mode with timeout. Loops until all oscillator fault flags are cleared or until a timeout counter is decremented and equals to zero. See the device-specific data sheet for appropriate drive settings.

Parameters
xt1driveis the target drive strength for the XT1 crystal oscillator. Valid values are:
  • UCS_XT1_DRIVE_0
  • UCS_XT1_DRIVE_1
  • UCS_XT1_DRIVE_2
  • UCS_XT1_DRIVE_3 [Default]
timeoutis the count value that gets decremented every time the loop that clears oscillator fault flags gets executed.

Modified bits of UCSCTL7 register, bits of UCSCTL6 register and bits of SFRIFG register.

Returns
STATUS_SUCCESS or STATUS_FAIL
void UCS_turnOnLFXT1 ( uint16_t  xt1drive,
uint8_t  xcap 
)

Initializes the XT1 crystal oscillator in low frequency mode.

Initializes the XT1 crystal oscillator in low frequency mode. Loops until all oscillator fault flags are cleared, with no timeout. See the device- specific data sheet for appropriate drive settings.

Parameters
xt1driveis the target drive strength for the XT1 crystal oscillator. Valid values are:
  • UCS_XT1_DRIVE_0
  • UCS_XT1_DRIVE_1
  • UCS_XT1_DRIVE_2
  • UCS_XT1_DRIVE_3 [Default]
    Modified bits are XT1DRIVE of UCSCTL6 register.
xcapis the selected capacitor value. This parameter selects the capacitors applied to the LF crystal (XT1) or resonator in the LF mode. The effective capacitance (seen by the crystal) is Ceff. (CXIN
  • 2 pF)/2. It is assumed that CXIN = CXOUT and that a parasitic capacitance of 2 pF is added by the package and the printed circuit board. For details about the typical internal and the effective capacitors, refer to the device-specific data sheet. Valid values are:
  • UCS_XCAP_0
  • UCS_XCAP_1
  • UCS_XCAP_2
  • UCS_XCAP_3 [Default]

Modified bits are XCAP of UCSCTL6 register.

Returns
None
bool UCS_turnOnLFXT1WithTimeout ( uint16_t  xt1drive,
uint8_t  xcap,
uint16_t  timeout 
)

Initializes the XT1 crystal oscillator in low frequency mode with timeout.

Initializes the XT1 crystal oscillator in low frequency mode with timeout. Loops until all oscillator fault flags are cleared or until a timeout counter is decremented and equals to zero. See the device-specific datasheet for appropriate drive settings.

Parameters
xt1driveis the target drive strength for the XT1 crystal oscillator. Valid values are:
  • UCS_XT1_DRIVE_0
  • UCS_XT1_DRIVE_1
  • UCS_XT1_DRIVE_2
  • UCS_XT1_DRIVE_3 [Default]
xcapis the selected capacitor value. This parameter selects the capacitors applied to the LF crystal (XT1) or resonator in the LF mode. The effective capacitance (seen by the crystal) is Ceff. (CXIN
  • 2 pF)/2. It is assumed that CXIN = CXOUT and that a parasitic capacitance of 2 pF is added by the package and the printed circuit board. For details about the typical internal and the effective capacitors, refer to the device-specific data sheet. Valid values are:
  • UCS_XCAP_0
  • UCS_XCAP_1
  • UCS_XCAP_2
  • UCS_XCAP_3 [Default]
timeoutis the count value that gets decremented every time the loop that clears oscillator fault flags gets executed.

Modified bits of UCSCTL7 register, bits of UCSCTL6 register and bits of SFRIFG register.

Returns
STATUS_SUCCESS or STATUS_FAIL
void UCS_turnOnSMCLK ( void  )

Turns ON SMCLK using the SMCLKOFF bit.

Modified bits of UCSCTL6 register.

Returns
None
void UCS_turnOnXT2 ( uint16_t  xt2drive)

Initializes the XT2 crystal oscillator.

Initializes the XT2 crystal oscillator, which supports crystal frequencies between 4 MHz and 32 MHz, depending on the selected drive strength. Loops until all oscillator fault flags are cleared, with no timeout. See the device-specific data sheet for appropriate drive settings.

Parameters
xt2driveis the target drive strength for the XT2 crystal oscillator. Valid values are:
  • UCS_XT2_DRIVE_4MHZ_8MHZ
  • UCS_XT2_DRIVE_8MHZ_16MHZ
  • UCS_XT2_DRIVE_16MHZ_24MHZ
  • UCS_XT2_DRIVE_24MHZ_32MHZ [Default]

Modified bits of UCSCTL7 register, bits of UCSCTL6 register and bits of SFRIFG register.

Returns
None
bool UCS_turnOnXT2WithTimeout ( uint16_t  xt2drive,
uint16_t  timeout 
)

Initializes the XT2 crystal oscillator with timeout.

Initializes the XT2 crystal oscillator, which supports crystal frequencies between 4 MHz and 32 MHz, depending on the selected drive strength. Loops until all oscillator fault flags are cleared or until a timeout counter is decremented and equals to zero. See the device-specific data sheet for appropriate drive settings.

Parameters
xt2driveis the target drive strength for the XT2 crystal oscillator. Valid values are:
  • UCS_XT2_DRIVE_4MHZ_8MHZ
  • UCS_XT2_DRIVE_8MHZ_16MHZ
  • UCS_XT2_DRIVE_16MHZ_24MHZ
  • UCS_XT2_DRIVE_24MHZ_32MHZ [Default]
timeoutis the count value that gets decremented every time the loop that clears oscillator fault flags gets executed.

Modified bits of UCSCTL7 register, bits of UCSCTL6 register and bits of SFRIFG register.

Returns
STATUS_SUCCESS or STATUS_FAIL

Copyright 2015, Texas Instruments Incorporated