MSP430 DriverLib for MSP430i2xx Devices  2.91.13.01
cs

Macros

#define CS_DCO_FREQ   16384000
 

Functions

void CS_setupDCO (uint8_t mode)
 Sets up the DCO using the selected mode. More...
 
void CS_initClockSignal (uint8_t clockSource, uint8_t clockSourceDivider)
 Initializes a clock singal with a divider. More...
 
uint32_t CS_getACLK (void)
 Get the current ACLK frequency in Hz. More...
 
uint32_t CS_getSMCLK (void)
 Get the current SMCLK frequency in Hz. More...
 
uint32_t CS_getMCLK (void)
 Get the current MCLK frequency in Hz. More...
 
uint8_t CS_getFaultFlagStatus (uint8_t mask)
 Get the DCO fault flag status. More...
 

Detailed Description

Function Documentation

§ CS_getACLK()

uint32_t CS_getACLK ( void  )

Get the current ACLK frequency in Hz.

This API returns the current ACLK frequency in Hz. It does not work when the device is setup in DCO bypass mode. Also, CS_setupDCO() should be called before this API so that the DCO has been calibrated and this calculation is accurate.

Returns
Current ACLK frequency in Hz, 0 when in bypass mode

§ CS_getFaultFlagStatus()

uint8_t CS_getFaultFlagStatus ( uint8_t  mask)

Get the DCO fault flag status.

Reads and returns DCO fault flag. The DCO fault flag is set when the DCO is operating in external resistor mode and the DCO detects an abnormality. An abnormality could be if the ROSC pin is left open or shorted to ground, or if the resistance connected at the ROSC pin is far away from the recommended value. If the fault persists the DCO automatically switches to the internal resistor mode as a fail-safe mechanism.

Parameters
maskMask of fault flags to check Mask value is the logical OR of any of the following:
  • CS_DCO_FAULT_FLAG
Returns
Logical OR of any of the following:
  • CS_DCO_FAULT_FLAG
    indicating if the masked fault flags are set

§ CS_getMCLK()

uint32_t CS_getMCLK ( void  )

Get the current MCLK frequency in Hz.

This API returns the current MCLK frequency in Hz. It does not work when the device is setup in DCO bypass mode. Also, CS_setupDCO() should be called before this API so that the DCO has been calibrated and this calculation is accurate.

Returns
Current MCLK frequency in Hz, 0 when in bypass mode

§ CS_getSMCLK()

uint32_t CS_getSMCLK ( void  )

Get the current SMCLK frequency in Hz.

This API returns the current SMCLK frequency in Hz. It does not work when the device is setup in DCO bypass mode. Also, CS_setupDCO() should be called before this API so that the DCO has been calibrated and this calculation is accurate.

Returns
Current SMCLK frequency in Hz, 0 when in bypass mode

§ CS_initClockSignal()

void CS_initClockSignal ( uint8_t  clockSource,
uint8_t  clockSourceDivider 
)

Initializes a clock singal with a divider.

Sets up a clock signal with a divider. If the DCO is in bypass mode the frequency will be CLKIN / divider. If the DCO is not in bypass mode the frequency will 16.384MHz / divider.

Parameters
clockSourceClock signal to initialize Valid values are:
  • CS_MCLK
  • CS_SMCLK
clockSourceDividerDivider setting for the selected clock signal Valid values are:
  • CS_CLOCK_DIVIDER_1
  • CS_CLOCK_DIVIDER_2
  • CS_CLOCK_DIVIDER_4
  • CS_CLOCK_DIVIDER_8
  • CS_CLOCK_DIVIDER_16
Returns
None

§ CS_setupDCO()

void CS_setupDCO ( uint8_t  mode)

Sets up the DCO using the selected mode.

Sets up the DCO using the selected mode. If the bypass mode is selected than an external digital clock is required on the CLKIN pin to drive all clocks on the device. ACLK frequency is not programmable and is fixed to the bypass clock frequency divided by 512. For external resistor mode a 20kOhm resistor is recommended at the ROSC pin. External resistor mode offers higer clock accuracy in terms of absolute tolerance and temperature drift compared to the internal resistor mode. Please check your device datasheet for details and ratings for the differnt modes.

Parameters
modeMode to put the DCO into Valid values are:
  • CS_INTERNAL_RESISTOR - DCO operation with internal resistor
  • CS_EXTERNAL_RESISTOR - DCO operation with external resistor
  • CS_BYPASS_MODE - Bypass mode, provide external clock signal
Returns
None

Copyright 2020, Texas Instruments Incorporated