BSP430  20141115
Board Support Package for MSP430 microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Macros
cs4.h File Reference

Hardware presentation/abstraction for Clock System (CS) on FR4xx/2xx chips. More...

#include <bsp430/clock.h>
#include <bsp430/periph.h>

Go to the source code of this file.

Macros

#define BSP430_MODULE_CS4   (BSP430_PERIPH_CS_IS_CS4 - 0)
 
#define BSP430_CS4_FLL_SELREF   SELREF__XT1CLK
 
#define BSP430_CS4_DCO_IS_FAULTED_NI()   (CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1))
 
#define BSP430_CS4_LFXT1_IS_FAULTED_NI()   (CSCTL7 & XT1OFFG)
 
#define BSP430_CS4_XT2_IS_FAULTED_NI()   0
 
#define BSP430_CLOCK_LFXT1_IS_FAULTED_NI()   BSP430_CS4_LFXT1_IS_FAULTED_NI()
 
#define BSP430_CLOCK_XT2_IS_FAULTED_NI()   (1)
 
#define BSP430_CS4_CLEAR_FAULTS_NI()
 
#define BSP430_CLOCK_CLEAR_FAULTS_NI()
 
#define BSP430_CLOCK_NOMINAL_VLOCLK_HZ   10000U
 
#define BSP430_CLOCK_PUC_MCLK_HZ   1048576UL
 
#define BSP430_CS4_NOMINAL_XT1CLK_HZ   32768U
 
#define BSP430_CS4_NOMINAL_REFOCLK_HZ   32768U
 
#define BSP430_CS4_NOMINAL_MODCLK_HZ   5000000UL
 

Detailed Description

Hardware presentation/abstraction for Clock System (CS) on FR4xx/2xx chips.

The Clock System (CS) in FR4xx/2xx-family devices is completely different from the CS system in FR5xx-family devices but it is most same as a UCS peripheral in the F5xx/6xx-family devices cross-bred with an FLL+ peripheral from the 4xx family.

Module Configuration Options

Hardware Presentation Layer

As there can be only one instance of CS4 on any MCU, there is no structure supporting a CS4 HPL. Manipulate the peripheral through its registers directly.

Hardware Adaptation Layer

As there can be only one instance of CS4 on any MCU, there is no structure supporting a CS4 HAL.

The standard set of capabilities in the bsp430/clocks.h header are supported, with the following details:

Homepage
http://github.com/pabigot/bsp430

Macro Definition Documentation

#define BSP430_CLOCK_CLEAR_FAULTS_NI ( )
Value:
do { \
} while (0)
#define BSP430_CLOCK_OSC_CLEAR_FAULT_NI()
Definition: clock.h:230
#define BSP430_CS4_CLEAR_FAULTS_NI()
Definition: cs4.h:134

Clear all clock faults.

This definition overrides the generic definition to clear the crystal-specific flags as well as the system flag.

Defaulted:
The value here is superseded by previously encountered definitions.
#define BSP430_CLOCK_LFXT1_IS_FAULTED_NI ( )    BSP430_CS4_LFXT1_IS_FAULTED_NI()

Check whether the CS4-controlled LFXT1 crystal has a fault condition.

Note
Oscillator fault flags are not set unless a fault has been detected. If the crystal has never been enabled, no fault will have been detected. On power-up, the XIN function is not enabled and CSCTL6.XT1OFF is set, and BSP430 treats CSCTL6.XT1OFF as an indication that the pins are not configured for crystal use, either because LFXT1 has not been configured or has been configured and found to be faulted. Although it is perfectly acceptable to have CSCTL6.XT1OFF set and the crystal working fine, the complexity of detecting that case is not supported by this implementation.
Defaulted:
The value here is superseded by previously encountered definitions.
See also
BSP430_CS4_LFXT1_IS_FAULTED_NI()
#define BSP430_CLOCK_NOMINAL_VLOCLK_HZ   10000U

Unconditional define for peripheral-specific constant

#define BSP430_CLOCK_PUC_MCLK_HZ   1048576UL

Unconditional define for peripheral-specific constant

#define BSP430_CLOCK_XT2_IS_FAULTED_NI ( )    (1)

CS4 does not support XT2 so it is always in fault.

See also
BSP430_CS4_XT2_IS_FAULTED_NI()
#define BSP430_CS4_CLEAR_FAULTS_NI ( )
Value:
do { \
CSCTL7 &= ~(FLLUNLOCKHIS0 | FLLUNLOCKHIS1 | FLLULIFG | XT1OFFG | DCOFFG); \
} while (0)

Clear all CS4-specific faults.

#define BSP430_CS4_DCO_IS_FAULTED_NI ( )    (CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1))

CS4-specific check for DCO fault condition

#define BSP430_CS4_FLL_SELREF   SELREF__XT1CLK

Preferred source for FLL clock

This should be a constant denoting the bits to be set in the CS4 control register for SELREF selecting the FLL reference clock. The default value selects XT1CLK, which will internally fall back to REFOCLK if XT1CLK is faulted.

C Preprocessor Only:
This macro may have a value that restricts its use to C preprocessor conditional directives.
#define BSP430_CS4_LFXT1_IS_FAULTED_NI ( )    (CSCTL7 & XT1OFFG)

CS4-specific check for LFXT1 crystal fault condition.

This checks exactly for the fault condition.

Note
A crystal that has never been enabled will not register as faulted.
#define BSP430_CS4_NOMINAL_MODCLK_HZ   5000000UL

The CS4 module supports an internal low-precision high-frequency module clock source running at a nominal 5 MHz rate, for use where SMCLK is unsuitable. Its rate varies with temperature, voltage, and individual device.

Defaulted:
The value here is superseded by previously encountered definitions.
#define BSP430_CS4_NOMINAL_REFOCLK_HZ   32768U

The CS4 module supports an internally trimmed reference oscillator running at a nominal 32 KiHz rate, for use where XT1 is not populated.

#define BSP430_CS4_NOMINAL_XT1CLK_HZ   32768U

The CS4 module supports an external crystal which is normally low-frequency. On some devices it may be allowed to be high-frequency.

#define BSP430_CS4_XT2_IS_FAULTED_NI ( )    0

CS4-specific check for XT2 crystal fault condition.

If the platform does not support an XT2 crystal no fault is diagnosed.

Note
A crystal that has never been enabled will not register as faulted.
#define BSP430_MODULE_CS4   (BSP430_PERIPH_CS_IS_CS4 - 0)

Defined on inclusion of <bsp430/periph/cs4.h>. The value evaluates to true if the target MCU supports the CS peripheral of the FR4xx/2xx devices, and false if it does not.

C Preprocessor Only:
This macro may have a value that restricts its use to C preprocessor conditional directives.