Functions | |
void | CS_setExternalClockSource (uint32_t XT1CLK_frequency) |
Sets the external clock source. More... | |
void | CS_initClockSignal (uint8_t selectedClockSignal, uint16_t clockSource, uint16_t clockSourceDivider) |
Initializes a clock signal. More... | |
void | CS_turnOnXT1LF (uint16_t xt1Drive) |
Intializes the XT1 crystal oscillator in low frequency mode. More... | |
void | CS_bypassXT1 (void) |
Bypass the XT1 crystal oscillator. More... | |
bool | CS_turnOnXT1LFWithTimeout (uint16_t xt1Drive, uint16_t timeout) |
Initializes the XT1 crystal oscillator in low frequency mode with timeout. More... | |
bool | CS_bypassXT1WithTimeout (uint16_t timeout) |
Bypasses the XT1 crystal oscillator with time out. More... | |
void | CS_turnOffXT1 (void) |
Stops the XT1 oscillator using the XT1AUTOOFF bit. More... | |
void | CS_turnOnXT1HF (uint16_t xt1Drive, uint16_t xt1HFFreq) |
Intializes the XT1 crystal oscillator in high frequency mode. More... | |
bool | CS_turnOnXT1HFWithTimeout (uint16_t xt1Drive, uint16_t xt1HFFreq, uint16_t timeout) |
Initializes the XT1 crystal oscillator in high frequency mode with timeout. More... | |
void | CS_turnOnSMCLK (void) |
Turn On SMCLK. More... | |
void | CS_turnOffSMCLK (void) |
Turn Off SMCLK. More... | |
void | CS_enableVLOAutoOff (void) |
VLO is turned off when not used. More... | |
void | CS_disableVLOAutoOff (void) |
VLO is always on. More... | |
bool | CS_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... | |
bool | CS_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. This function performs DCO Factory Trim. More... | |
bool | CS_initFLLCalculateTrim (uint16_t fsystem, uint16_t ratio, CS_initFLLParam *param) |
Performs same function as initFLLSettle in addition to setting the proper DCOFTRIM according to clock frequency. This function performs DCO Software Trim and saves the trim value into initFLLParam. More... | |
bool | CS_initFLLLoadTrim (uint16_t fsystem, uint16_t ratio, CS_initFLLParam *param) |
Performs same function as initFLLCalculateTrim without the overhead of calculating the trim, but rather using the one specified in param. This function corresponds with the DCO Software Trim. More... | |
void | CS_enableClockRequest (uint8_t selectClock) |
Enables conditional module requests. More... | |
void | CS_disableClockRequest (uint8_t selectClock) |
Disables conditional module requests. More... | |
uint8_t | CS_getFaultFlagStatus (uint8_t mask) |
Gets the current CS fault flag status. More... | |
void | CS_clearFaultFlag (uint8_t mask) |
Clears the current CS fault flag status for the masked bit. More... | |
uint32_t | CS_getACLK (void) |
Get the current ACLK frequency. More... | |
uint32_t | CS_getSMCLK (void) |
Get the current SMCLK frequency. More... | |
uint32_t | CS_getMCLK (void) |
Get the current MCLK frequency. More... | |
uint16_t | CS_clearAllOscFlagsWithTimeout (uint16_t timeout) |
Clears all the Oscillator Flags. More... | |
void | CS_enableXT1AutomaticGainControl (void) |
Enables XT1 automatic gain control. More... | |
void | CS_disableXT1AutomaticGainControl (void) |
Disables XT1 automatic gain control. More... | |
void | CS_enableFLLUnlock (void) |
Enables FLL unlock interrupt. More... | |
void | CS_disableFLLUnlock (void) |
Disables FLL unlock interrupt. More... | |
void | CS_enableREFOLP (void) |
Enable low-power REFO. More... | |
void | CS_disableREFOLP (void) |
Disable low-power REFO. More... | |
bool | CS_getREFOLP (void) |
Get status of low-power REFO. More... | |
void | CS_enableXT1FaultOff (void) |
Turns off switching from XT1 to REFO when XT1 fails. More... | |
void | CS_disableXT1FaultOff (void) |
Turns on switching from XT1 to REFO when XT1 fails. More... | |
bool | CS_getXT1FaultOff (void) |
Get status of XT1 fault switching. More... | |
bool | CS_getREFOReady (void) |
Get status indication of low-power REFO switching. More... | |
void CS_bypassXT1 | ( | void | ) |
Bypass the XT1 crystal oscillator.
Bypasses the XT1 crystal oscillator. Loops until all oscillator fault flags are cleared, with no timeout.
Modified bits of SFRIFG1 register, bits of CSCTL7 register and bits of CSCTL6 register.
bool CS_bypassXT1WithTimeout | ( | 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.
timeout | is the count value that gets decremented every time the loop that clears oscillator fault flags gets executed. |
Modified bits of SFRIFG1 register, bits of CSCTL7 register and bits of CSCTL6 register.
uint16_t CS_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 CS_clearFaultFlag | ( | uint8_t | mask | ) |
Clears the current CS 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 CSCTL7 register.
void CS_disableClockRequest | ( | uint8_t | selectClock | ) |
Disables conditional module requests.
selectClock | selects specific request disable Valid values are:
|
Modified bits of CSCTL8 register.
void CS_disableFLLUnlock | ( | void | ) |
Disables FLL unlock interrupt.
Modified bits are FLLULIE of CSCTL7 register.
void CS_disableREFOLP | ( | void | ) |
Disable low-power REFO.
Modified bits are REFOLP of CSCTL3 register.
void CS_disableVLOAutoOff | ( | void | ) |
VLO is always on.
void CS_disableXT1AutomaticGainControl | ( | void | ) |
Disables XT1 automatic gain control.
Modified bits of CSCTL6 register.
void CS_disableXT1FaultOff | ( | void | ) |
Turns on switching from XT1 to REFO when XT1 fails.
Modified bits are XT1FAULTOFF of CSCTL6 register.
void CS_enableClockRequest | ( | uint8_t | selectClock | ) |
Enables conditional module requests.
selectClock | selects specific request enables Valid values are:
|
Modified bits of CSCTL8 register.
void CS_enableFLLUnlock | ( | void | ) |
Enables FLL unlock interrupt.
Modified bits are FLLULIE of CSCTL7 register.
void CS_enableREFOLP | ( | void | ) |
Enable low-power REFO.
Modified bits are REFOLP of CSCTL3 register.
void CS_enableVLOAutoOff | ( | void | ) |
VLO is turned off when not used.
void CS_enableXT1AutomaticGainControl | ( | void | ) |
Enables XT1 automatic gain control.
Modified bits of CSCTL6 register.
void CS_enableXT1FaultOff | ( | void | ) |
Turns off switching from XT1 to REFO when XT1 fails.
Modified bits are XT1FAULTOFF of CSCTL6 register.
uint32_t CS_getACLK | ( | void | ) |
Get the current ACLK frequency.
Get the current ACLK frequency. The user of this API must ensure that CS_setExternalClockSource API was invoked before in case XT1 is being used.
uint8_t CS_getFaultFlagStatus | ( | uint8_t | mask | ) |
Gets the current CS 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:
|
Modified bits of CSCTL7 register.
uint32_t CS_getMCLK | ( | void | ) |
Get the current MCLK frequency.
Get the current MCLK frequency. The user of this API must ensure that CS_setExternalClockSource API was invoked before in case XT1 is being used.
bool CS_getREFOLP | ( | void | ) |
Get status of low-power REFO.
bool CS_getREFOReady | ( | void | ) |
Get status indication of low-power REFO switching.
uint32_t CS_getSMCLK | ( | void | ) |
Get the current SMCLK frequency.
Get the current SMCLK frequency. The user of this API must ensure that CS_setExternalClockSource API was invoked before in case XT1 is being used.
bool CS_getXT1FaultOff | ( | void | ) |
Get status of XT1 fault switching.
void CS_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. Please check the device specific data sheet for details on the following: Some devices do not support divider settings for CS_FLLREF. VLO is only a valid clock source for ACLK on some devices.
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 CSCTL3 register, bits of CSCTL5 register and bits of CSCTL4 register.
bool CS_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. This function performs DCO Factory Trim.
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 clock system allows, the function sets the MCLK and SMCLK source to the undivided DCO frequency and returns false. Otherwise, the function sets the MCLK and SMCLK source to the DCOCLKDIV frequency.
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 CSCTL1 register, bits of CSCTL0 register, bits of CSCTL2 register, bits of CSCTL4 register, bits of CSCTL7 register and bits of SFRIFG1 register.
Referenced by CS_initFLLSettle().
bool CS_initFLLCalculateTrim | ( | uint16_t | fsystem, |
uint16_t | ratio, | ||
CS_initFLLParam * | param | ||
) |
Performs same function as initFLLSettle in addition to setting the proper DCOFTRIM according to clock frequency. This function performs DCO Software Trim and saves the trim value into initFLLParam.
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 clock system allows, the function sets the MCLK and SMCLK source to the undivided DCO frequency and returns false. 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. It also calibrates the DCOFTRIM value according to clock frequency. Lastly, it saves the DCOTAP and DCOFTRIM values for future use.
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 CSCTL1 register, bits of CSCTL0 register, bits of CSCTL2 register, bits of CSCTL4 register, bits of CSCTL7 register and bits of SFRIFG1 register.
References CS_initFLLParam::fsystem.
bool CS_initFLLLoadTrim | ( | uint16_t | fsystem, |
uint16_t | ratio, | ||
CS_initFLLParam * | param | ||
) |
Performs same function as initFLLCalculateTrim without the overhead of calculating the trim, but rather using the one specified in param. This function corresponds with the DCO Software Trim.
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 clock system allows, the function sets the MCLK and SMCLK source to the undivided DCO frequency and returns false. 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. Lastly, it uses the saved DCOTAP and DCOFTRIM values from the param to avoid overhead in recalculation.
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 CSCTL1 register, bits of CSCTL0 register, bits of CSCTL2 register, bits of CSCTL4 register, bits of CSCTL7 register and bits of SFRIFG1 register.
References CS_initFLLParam::csCtl0, CS_initFLLParam::csCtl1, and CS_initFLLParam::fsystem.
bool CS_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 clock system allows, the function sets the MCLK and SMCLK source to the undivided DCO frequency and returns false. 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.
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 CSCTL1 register, bits of CSCTL0 register, bits of CSCTL2 register, bits of CSCTL4 register, bits of CSCTL7 register and bits of SFRIFG1 register.
References CS_initFLL().
void CS_setExternalClockSource | ( | uint32_t | XT1CLK_frequency | ) |
Sets the external clock source.
This function sets the external clock sources XT1 crystal oscillator frequency values. This function must be called if an external crystal XT1 is used and the user intends to call CS_getMCLK, CS_getSMCLK or CS_getACLK APIs. If not, it is not necessary to invoke this API.
XT1CLK_frequency | is the XT1 crystal frequencies in Hz |
void CS_turnOffSMCLK | ( | void | ) |
Turn Off SMCLK.
void CS_turnOffXT1 | ( | void | ) |
Stops the XT1 oscillator using the XT1AUTOOFF bit.
Modified bits are XT1AUTOOFF of CSCTL6 register.
void CS_turnOnSMCLK | ( | void | ) |
Turn On SMCLK.
void CS_turnOnXT1HF | ( | uint16_t | xt1Drive, |
uint16_t | xt1HFFreq | ||
) |
Intializes 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:
|
xt1HFFreq | is the high frequency range selection. Valid values are:
|
bool CS_turnOnXT1HFWithTimeout | ( | uint16_t | xt1Drive, |
uint16_t | xt1HFFreq, | ||
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 datasheet for appropriate drive settings.
xt1Drive | is the target drive strength for the XT1 crystal oscillator. Valid values are:
|
xt1HFFreq | is the high frequency range selection. 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 SFRIFG1 register, bits of CSCTL7 register and bits of CSCTL6 register.
void CS_turnOnXT1LF | ( | uint16_t | xt1Drive | ) |
Intializes 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:
|
bool CS_turnOnXT1LFWithTimeout | ( | uint16_t | xt1Drive, |
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:
|
timeout | is the count value that gets decremented every time the loop that clears oscillator fault flags gets executed. |
Modified bits of SFRIFG1 register, bits of CSCTL7 register and bits of CSCTL6 register.