Functions | |
void | CS_setExternalClockSource (uint32_t XT1CLK_frequency, uint32_t XT2CLK_frequency) |
Sets the external clock source. More... | |
void | CS_initClockSignal (uint8_t selectedClockSignal, uint16_t clockSource, uint16_t clockSourceDivider) |
Initializes clock signal. More... | |
void | CS_turnOnXT1 (uint16_t xt1drive) |
Initializes the XT1 crystal oscillator in low frequency mode. More... | |
void | CS_bypassXT1 (void) |
Bypasses the XT1 crystal oscillator. More... | |
bool | CS_turnOnXT1WithTimeout (uint16_t xt1drive, uint32_t timeout) |
Initializes the XT1 crystal oscillator in low frequency mode with timeout. More... | |
bool | CS_bypassXT1WithTimeout (uint32_t timeout) |
Bypasses the XT1 crystal oscillator with timeout. More... | |
void | CS_turnOffXT1 (void) |
Stops the XT1 oscillator using the XT1OFF bit. More... | |
void | CS_turnOnXT2 (uint16_t xt2drive) |
Starts the XT2 crystal. More... | |
void | CS_bypassXT2 (void) |
Bypasses the XT2 crystal oscillator. More... | |
bool | CS_turnOnXT2WithTimeout (uint16_t xt2drive, uint32_t timeout) |
Initializes the XT2 crystal oscillator with timeout. More... | |
bool | CS_bypassXT2WithTimeout (uint32_t timeout) |
Bypasses the XT2 crystal oscillator with timeout. More... | |
void | CS_turnOffXT2 (void) |
Stops the XT2 oscillator using the XT2OFF bit. 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 (uint32_t timeout) |
Clears all the Oscillator Flags. More... | |
void | CS_setDCOFreq (uint16_t dcorsel, uint16_t dcofsel) |
Set DCO frequency. More... | |
void CS_bypassXT1 | ( | void | ) |
Bypasses the XT1 crystal oscillator.
Loops until all oscillator fault flags are cleared, with no timeout. IMPORTANT: User must call CS_setExternalClockSource function to set frequency of external clocks before calling this function.
Modified bits of CSCTL0 register, bits of CSCTL5 register, bits of CSCTL4 register and bits of SFRIFG register.
bool CS_bypassXT1WithTimeout | ( | uint32_t | timeout | ) |
Bypasses the XT1 crystal oscillator with timeout.
Loops until all oscillator fault flags are cleared or until a timeout counter is decremented and equals to zero.IMPORTANT: User must call CS_setExternalClockSource to set frequency of external clocks before calling this function
timeout | is the count value that gets decremented every time the loop that clears oscillator fault flags gets executed. |
Modified bits of CSCTL0 register, bits of CSCTL5 register, bits of CSCTL4 register and bits of SFRIFG register.
void CS_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. NOTE: User must call CS_setExternalClockSource to set frequency of external clocks before calling this function.
Modified bits of CSCTL5 register, bits of CSCTL4 register and bits of SFRIFG register.
bool CS_bypassXT2WithTimeout | ( | uint32_t | timeout | ) |
Bypasses the XT2 crystal oscillator with timeout.
Bypasses the XT2 crystal oscillator with timeout, 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. NOTE: User must call CS_setExternalClockSource to set frequency of external clocks before calling this function.
timeout | is the count value that gets decremented every time the loop that clears oscillator fault flags gets executed. |
Modified bits of CSCTL5 register, bits of CSCTL4 register and bits of SFRIFG1 register.
uint16_t CS_clearAllOscFlagsWithTimeout | ( | uint32_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. |
Modified bits of CSCTL5 register and bits of SFRIFG1 register.
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 value is the logical OR of any of the following:
|
Modified bits of CSCTL5 register.
void CS_disableClockRequest | ( | uint8_t | selectClock | ) |
Disables conditional module requests.
selectClock | selects specific request enables. Valid values are:
|
Modified bits of CSCTL6 register.
void CS_enableClockRequest | ( | uint8_t | selectClock | ) |
Enables conditional module requests.
selectClock | selects specific request enables. Valid values are:
|
Modified bits of CSCTL6 register.
uint32_t CS_getACLK | ( | void | ) |
Get the current ACLK frequency.
If a oscillator fault is set, the frequency returned will be based on the fail safe mechanism of CS module. The user of this API must ensure that CS_externalClockSourceInit API was invoked before in case XT1 or XT2 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 value is the logical OR of any of the following:
|
uint32_t CS_getMCLK | ( | void | ) |
Get the current MCLK frequency.
If a oscillator fault is set, the frequency returned will be based on the fail safe mechanism of CS module. The user of this API must ensure that CS_externalClockSourceInit API was invoked before in case XT1 or XT2 is being used.
uint32_t CS_getSMCLK | ( | void | ) |
Get the current SMCLK frequency.
If a oscillator fault is set, the frequency returned will be based on the fail safe mechanism of CS module. The user of this API must ensure that CS_externalClockSourceInit API was invoked before in case XT1 or XT2 is being used.
void CS_initClockSignal | ( | uint8_t | selectedClockSignal, |
uint16_t | clockSource, | ||
uint16_t | clockSourceDivider | ||
) |
Initializes 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 to MSP430ware documentation for CS module or Device Family User's Guide for details of default clock signal states.
selectedClockSignal | is the selected clock signal Valid values are:
|
clockSource | is Clock source for the selectedClock Valid values are:
|
clockSourceDivider | selects the clock divider to calculate clock signal from clock source. Valid values are:
|
Modified bits of CSCTL0 register, bits of CSCTL3 register and bits of CSCTL2 register.
void CS_setDCOFreq | ( | uint16_t | dcorsel, |
uint16_t | dcofsel | ||
) |
Set DCO frequency.
dcorsel | selects frequency range option. Valid options are: CS_DCORSEL_0 [Default] CS_DCORSEL_1 Valid values are:
|
dcofsel | selects valid frequency options based on dco frequency range selection (dcorsel). Valid values are:
|
void CS_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 CS_getMCLK, CS_getSMCLK, CS_getACLK and turnOnXT1, XT1ByPass, turnOnXT1WithTimeout, XT1ByPassWithTimeout.
XT1CLK_frequency | is the XT1 crystal frequencies in Hz |
XT2CLK_frequency | is the XT2 crystal frequencies in Hz |
void CS_turnOffXT1 | ( | void | ) |
Stops the XT1 oscillator using the XT1OFF bit.
Modified bits of CSCTL4 register.
void CS_turnOffXT2 | ( | void | ) |
Stops the XT2 oscillator using the XT2OFF bit.
Modified bits of CSCTL4 register.
void CS_turnOnXT1 | ( | uint16_t | xt1drive | ) |
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. IMPORTANT: User must call CS_setExternalClockSource function to set frequency of external clocks before calling this function.
xt1drive | is the target drive strength for the XT1 crystal oscillator. Valid values are:
|
Modified bits of CSCTL0 register, bits of CSCTL5 register, bits of CSCTL4 register and bits of SFRIFG1 register.
bool CS_turnOnXT1WithTimeout | ( | uint16_t | xt1drive, |
uint32_t | 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. IMPORTANT: User must call CS_setExternalClockSource function to set frequency of external clocks before calling this function.
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 CSCTL0 register, bits of CSCTL5 register, bits of CSCTL4 register and bits of SFRIFG1 register.
void CS_turnOnXT2 | ( | uint16_t | xt2drive | ) |
Starts the XT2 crystal.
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. NOTE: User must call CS_setExternalClockSource to set frequency of external clocks before calling this function.
xt2drive | is the target drive strength for the XT2 crystal oscillator. Valid values are:
|
Modified bits of CSCTL0 register, bits of CSCTL5 register, bits of CSCTL4 register and bits of SFRIFG1 register.
bool CS_turnOnXT2WithTimeout | ( | uint16_t | xt2drive, |
uint32_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. NOTE: User must call CS_setExternalClockSource to set frequency of external clocks before calling this function.
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 CSCTL5 register, bits of CSCTL4 register and bits of SFRIFG1 register.