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... | |
#define CC430_DEVICE |
#define NOT_CC430_DEVICE |
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.
highOrLowFrequency | selects high frequency or low frequency mode for XT1. Valid values are:
|
Modified bits of UCSCTL7 register, bits of UCSCTL6 register and bits of SFRIFG register.
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.
highOrLowFrequency | selects high frequency or low frequency mode for XT1. Valid values are:
|
timeout | is 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.
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.
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.
timeout | is 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.
uint16_t UCS_clearAllOscFlagsWithTimeout | ( | uint16_t | timeout | ) |
Clears all the Oscillator Flags.
timeout | is the count value that gets decremented every time the loop that clears oscillator fault flags gets executed. |
void UCS_clearFaultFlag | ( | uint8_t | mask | ) |
Clears the current UCS fault flag status for the masked bit.
mask | is the masked interrupt flag status to be returned. mask parameter can be any one of the following Valid values are:
|
Modified bits of UCSCTL7 register.
void UCS_disableClockRequest | ( | uint8_t | selectClock | ) |
Disables conditional module requests.
selectClock | selects specific request disable Valid values are:
|
Modified bits of UCSCTL8 register.
void UCS_enableClockRequest | ( | uint8_t | selectClock | ) |
Enables conditional module requests.
selectClock | selects specific request enables Valid values are:
|
Modified bits of UCSCTL8 register.
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.
uint8_t UCS_getFaultFlagStatus | ( | uint8_t | mask | ) |
Gets the current UCS fault flag status.
mask | is the masked interrupt flag status to be returned. Mask parameter can be either any of the following selection. Valid values are:
|
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.
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.
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.
selectedClockSignal | selected clock signal Valid values are:
|
clockSource | is clock source for the selectedClockSignal Valid values are:
|
clockSourceDivider | selected the clock divider to calculate clocksignal from clock source. Valid values are:
|
Modified bits of UCSCTL5 register, bits of UCSCTL4 register and bits of UCSCTL3 register.
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.
fsystem | is the target frequency for MCLK in kHz |
ratio | is 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.
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.
fsystem | is the target frequency for MCLK in kHz |
ratio | is 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.
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.
XT1CLK_frequency | is the XT1 crystal frequencies in Hz |
XT2CLK_frequency | is the XT2 crystal frequencies in Hz |
void UCS_turnOffSMCLK | ( | void | ) |
Turns off SMCLK using the SMCLKOFF bit.
Modified bits of UCSCTL6 register.
void UCS_turnOffXT1 | ( | void | ) |
Stops the XT1 oscillator using the XT1OFF bit.
void UCS_turnOffXT2 | ( | void | ) |
Stops the XT2 oscillator using the XT2OFF bit.
Modified bits of UCSCTL6 register.
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.
xt1drive | is the target drive strength for the XT1 crystal oscillator. Valid values are:
|
Modified bits of UCSCTL7 register, bits of UCSCTL6 register and bits of SFRIFG register.
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.
xt1drive | is the target drive strength for the XT1 crystal oscillator. Valid values are:
|
timeout | is 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.
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.
xt1drive | is the target drive strength for the XT1 crystal oscillator. Valid values are:
|
xcap | is 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
|
Modified bits are XCAP of UCSCTL6 register.
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.
xt1drive | is the target drive strength for the XT1 crystal oscillator. Valid values are:
|
xcap | is 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
|
timeout | is 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.
void UCS_turnOnSMCLK | ( | void | ) |
Turns ON SMCLK using the SMCLKOFF bit.
Modified bits of UCSCTL6 register.
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.
xt2drive | is the target drive strength for the XT2 crystal oscillator. Valid values are:
|
Modified bits of UCSCTL7 register, bits of UCSCTL6 register and bits of SFRIFG register.
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.
xt2drive | is the target drive strength for the XT2 crystal oscillator. Valid values are:
|
timeout | is 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.