XMC Peripheral Library for XMC4000 Family
2.1.16
|
Data Structures | |
struct | XMC_SCU_CLOCK_CONFIG_t |
struct | XMC_SCU_CLOCK_SYSPLL_CONFIG_t |
Macros | |
#define | XMC_SCU_INTERRUPT_EVENT_DLR_OVERRUN SCU_INTERRUPT_SRSTAT_DLROVR_Msk |
#define | XMC_SCU_INTERRUPT_EVENT_HDCLR_UPDATED SCU_INTERRUPT_SRSTAT_HDCLR_Msk |
#define | XMC_SCU_INTERRUPT_EVENT_HDCR_UPDATED SCU_INTERRUPT_SRSTAT_HDCR_Msk |
#define | XMC_SCU_INTERRUPT_EVENT_HDSET_UPDATED SCU_INTERRUPT_SRSTAT_HDSET_Msk |
#define | XMC_SCU_INTERRUPT_EVENT_OSCSICTRL_UPDATED SCU_INTERRUPT_SRSTAT_OSCSICTRL_Msk |
#define | XMC_SCU_INTERRUPT_EVENT_OSCULCTRL_UPDATED SCU_INTERRUPT_SRSTAT_OSCULCTRL_Msk |
#define | XMC_SCU_INTERRUPT_EVENT_RMX_UPDATED SCU_INTERRUPT_SRSTAT_RMX_Msk |
#define | XMC_SCU_INTERRUPT_EVENT_RTC_ALARM SCU_INTERRUPT_SRSTAT_AI_Msk |
#define | XMC_SCU_INTERRUPT_EVENT_RTC_PERIODIC SCU_INTERRUPT_SRSTAT_PI_Msk |
#define | XMC_SCU_INTERRUPT_EVENT_RTCATIM0_UPDATED SCU_INTERRUPT_SRSTAT_RTC_ATIM0_Msk |
#define | XMC_SCU_INTERRUPT_EVENT_RTCATIM1_UPDATED SCU_INTERRUPT_SRSTAT_RTC_ATIM1_Msk |
#define | XMC_SCU_INTERRUPT_EVENT_RTCCTR_UPDATED SCU_INTERRUPT_SRSTAT_RTC_CTR_Msk |
#define | XMC_SCU_INTERRUPT_EVENT_RTCTIM0_UPDATED SCU_INTERRUPT_SRSTAT_RTC_TIM0_Msk |
#define | XMC_SCU_INTERRUPT_EVENT_RTCTIM1_UPDATED SCU_INTERRUPT_SRSTAT_RTC_TIM1_Msk |
#define | XMC_SCU_INTERRUPT_EVENT_WDT_WARN SCU_INTERRUPT_SRSTAT_PRWARN_Msk |
Typedefs | |
typedef void(* | XMC_SCU_INTERRUPT_EVENT_HANDLER_t) (void) |
typedef uint32_t | XMC_SCU_INTERRUPT_EVENT_t |
Enumerations |
Detailed Description
System control unit is the SoC power, reset and a clock manager with additional responsibility of providing system stability protection and other auxiliary functions.
SCU provides the following features,
- Power control
- Hibernate control
- Reset control
- Clock control
- Miscellaneous control(boot mode, system interrupts etc.)
The SCU driver is divided in to clock control logic, reset control logic, system interrupt control logic , hibernate control logic, trap control logic, parity control logic and miscellaneous control logic.
Clock driver features:
- Allows clock configuration using the structure XMC_SCU_CLOCK_CONFIG_t and API XMC_SCU_CLOCK_Init()
- Provides structure XMC_SCU_CLOCK_SYSPLL_CONFIG_t for configuring the system PLL
- Allows selection of clock source for system PLL, XMC_SCU_CLOCK_GetSystemPllClockSource()
- Provides APIs for configuring different module clock frequencies XMC_SCU_CLOCK_SetWdtClockDivider(), XMC_SCU_CLOCK_SetUsbClockDivider()
- Allows selection of clock source for external output, XMC_SCU_CLOCK_SetExternalOutputClockSource()
- Provides APIs for enabling external high power oscillator and ultra low power oscillator, XMC_SCU_CLOCK_EnableHighPerformanceOscillator(), XMC_SCU_CLOCK_EnableLowPowerOscillator()
- Provides APIs for getting various clock frequencies XMC_SCU_CLOCK_GetPeripheralClockFrequency(), XMC_SCU_CLOCK_GetCpuClockFrequency(), XMC_SCU_CLOCK_GetSystemClockFrequency()
Reset driver features:
- Allows to handle peripheral reset XMC_SCU_RESET_AssertPeripheralReset(), XMC_SCU_RESET_DeassertPeripheralReset()
- Allows configuration of NMI generation for selected events, XMC_SCU_INTERRUPT_EnableNmiRequest()
Interrupt driver features:
- Provides APIs for enabling/ disabling interrupt event generation XMC_SCU_INTERRUPT_EnableEvent(), XMC_SCU_INTERRUPT_DisableEvent()
- Provides API for registering callback function for events XMC_SCU_INTERRUPT_SetEventHandler()
Hibernate driver features:
- Allows configuration of hibernate domain XMC_SCU_HIB_EnableHibernateDomain(), XMC_SCU_HIB_DisableHibernateDomain()
- Allows selection of standby clock source, XMC_SCU_HIB_SetStandbyClockSource()
- Allows selection of RTC clock source, XMC_SCU_HIB_SetRtcClockSource()
- Provides API for enabling slow internal clock used for backup clock, XMC_SCU_HIB_EnableInternalSlowClock()
Trap driver features:
- Allows handling of trap XMC_SCU_TRAP_Enable(), XMC_SCU_TRAP_GetStatus(), XMC_SCU_TRAP_Trigger()
Parity driver features:
- Parity error generated by on-chip RAM can be monitored, XMC_SCU_PARITY_Enable(), XMC_SCU_PARITY_GetStatus()
- Allows configuration of trap generation on detection of parity error, XMC_SCU_PARITY_EnableTrapGeneration()
Power driver features:
- Allows to power the USB module XMC_SCU_POWER_EnableUsb(), XMC_SCU_POWER_DisableUsb()
Miscellaneous features:
- Allows to trigger multiple capture compare unit(CCU) channels to be started together XMC_SCU_SetCcuTriggerHigh()
- Enables configuration of out of range comparator (ORC) XMC_SCU_EnableOutOfRangeComparator()
- Enables configuration of die temperature sensor XMC_SCU_EnableTemperatureSensor(), XMC_SCU_CalibrateTemperatureSensor()
- Enables configuration of device boot mode XMC_SCU_SetBootMode()
Macro Definition Documentation
#define XMC_SCU_INTERRUPT_EVENT_DLR_OVERRUN SCU_INTERRUPT_SRSTAT_DLROVR_Msk |
DLR overrun event.
#define XMC_SCU_INTERRUPT_EVENT_HDCLR_UPDATED SCU_INTERRUPT_SRSTAT_HDCLR_Msk |
HIB HDCLR register update event.
#define XMC_SCU_INTERRUPT_EVENT_HDCR_UPDATED SCU_INTERRUPT_SRSTAT_HDCR_Msk |
HIB HDCR register update event.
#define XMC_SCU_INTERRUPT_EVENT_HDSET_UPDATED SCU_INTERRUPT_SRSTAT_HDSET_Msk |
HIB HDSET register update event.
#define XMC_SCU_INTERRUPT_EVENT_OSCSICTRL_UPDATED SCU_INTERRUPT_SRSTAT_OSCSICTRL_Msk |
HIB OSCSICTRL register update event.
#define XMC_SCU_INTERRUPT_EVENT_OSCULCTRL_UPDATED SCU_INTERRUPT_SRSTAT_OSCULCTRL_Msk |
HIB OSCULCTRL register update event.
#define XMC_SCU_INTERRUPT_EVENT_RMX_UPDATED SCU_INTERRUPT_SRSTAT_RMX_Msk |
HIB RMX register update event.
#define XMC_SCU_INTERRUPT_EVENT_RTC_ALARM SCU_INTERRUPT_SRSTAT_AI_Msk |
RTC alarm event.
#define XMC_SCU_INTERRUPT_EVENT_RTC_PERIODIC SCU_INTERRUPT_SRSTAT_PI_Msk |
RTC periodic interrupt.
#define XMC_SCU_INTERRUPT_EVENT_RTCATIM0_UPDATED SCU_INTERRUPT_SRSTAT_RTC_ATIM0_Msk |
HIB RTCATIM0 register update event.
#define XMC_SCU_INTERRUPT_EVENT_RTCATIM1_UPDATED SCU_INTERRUPT_SRSTAT_RTC_ATIM1_Msk |
HIB RTCATIM1 register update event.
#define XMC_SCU_INTERRUPT_EVENT_RTCCTR_UPDATED SCU_INTERRUPT_SRSTAT_RTC_CTR_Msk |
HIB RTCCTR register update event.
#define XMC_SCU_INTERRUPT_EVENT_RTCTIM0_UPDATED SCU_INTERRUPT_SRSTAT_RTC_TIM0_Msk |
HIB TIM0 register update event.
#define XMC_SCU_INTERRUPT_EVENT_RTCTIM1_UPDATED SCU_INTERRUPT_SRSTAT_RTC_TIM1_Msk |
HIB TIM1 register update event.
#define XMC_SCU_INTERRUPT_EVENT_WDT_WARN SCU_INTERRUPT_SRSTAT_PRWARN_Msk |
Watchdog prewarning event.
Typedef Documentation
typedef void(* XMC_SCU_INTERRUPT_EVENT_HANDLER_t) (void) |
Function pointer type used for registering callback functions on SCU event occurrence.
typedef uint32_t XMC_SCU_INTERRUPT_EVENT_t |
Defines enumerations for events which can lead to interrupt. These enumeration values represent the status of one of the bits in SRSTAT register. Use type XMC_SCU_INTERRUPT_EVENT_t for accessing these enum parameters.
Enumeration Type Documentation
enum XMC_SCU_BOOTMODE_t |
Defines options for selecting device boot mode. These enums are used to configure SWCON bits of STCON register. User can choose among various boot modes by configuring SWCON bits. Use type XMC_SCU_BOOTMODE_t for accessing these enum parameters.
Defines Capture/Compare unit timer slice trigger, that enables synchronous start function available on the SCU, CCUCON register. Use type XMC_SCU_CCU_TRIGGER_t for accessing these enum parameters.
Enumerator | |
---|---|
XMC_SCU_CCU_TRIGGER_CCU40 |
Trigger mask used for Global Start Control of CCU40 peripheral. |
XMC_SCU_CCU_TRIGGER_CCU80 |
Trigger mask used for Global Start Control of CCU80 peripheral. |
Defines the source of the system clock and peripherals clock gating in DEEPSLEEP state. In addition the state of FLASH, PLL and PLLVCO during DEEPSLEEP state. Use this enum as parameter of XMC_SCU_CLOCK_SetDeepSleepConfig before going to DEEPSLEEP state.
The DEEPSLEEP state of the system corresponds to the DEEPSLEEP state of the CPU. The state is entered via WFI or WFE instruction of the CPU. In this state the clock to the CPU is stopped.
In Deep Sleep state the OSC_HP and the PLL may be switched off. The wake-up logic in the NVIC is still clocked by a free-running clock. Peripherals are only clocked when configured to stay enabled. Configuration of peripherals and any SRAM content is preserved. The Flash module can be put into low-power mode to achieve a further power reduction. On wake-up Flash module will be restarted again before instructions or data access is possible. Any interrupt will bring the system back to operation via the NVIC.The clock setup before entering Deep Sleep state is restored upon wake-up.
Defines options for selecting the source of external clock out (fEXT). These enums are used to configure ECKSEL bits of EXTCLKCR register. User can choose either fSYS or fPLL or fUSBPLL clock as a source for external clock out (fEXT). Use type XMC_SCU_CLOCK_EXTOUTCLKSRC_t for accessing these enum parameters.
Defines options for backup clock trimming. These enums are used to configure AOTREN FOTR bits of PLLCON0 register. Use type XMC_SCU_CLOCK_BACKUP_TRIM_t for accessing these enum parameters.
Defines the source of the system clock and peripherals clock gating in SLEEP state. Use this enum as parameter of XMC_SCU_CLOCK_SetSleepConfig before going to SLEEP state.
The SLEEP state of the system corresponds to the SLEEP state of the CPU. The state is entered via WFI or WFE instruction of the CPU. In this state the clock to the CPU is stopped. Peripherals are only clocked when configured to stay enabled.
Peripherals can continue to operate unaffected and eventually generate an event to wake-up the CPU. Any interrupt to the NVIC will bring the CPU back to operation. The clock tree upon exit from SLEEP state is restored to what it was before entry into SLEEP state.
Defines options for system clock (fSYS) source. These enums are used to configure SYSSEL bits of SYSCLKCR Clock Control Register. Use type XMC_SCU_CLOCK_SYSCLKSRC_t for accessing these enum parameters.
Enumerator | |
---|---|
XMC_SCU_CLOCK_SYSCLKSRC_OFI |
Internal Fast Clock (fOFI) as a source for system clock (fSYS). |
XMC_SCU_CLOCK_SYSCLKSRC_PLL |
PLL output (fPLL) as a source for system clock (fSYS). |
Defines various PLL modes of operation. These enums are used to configure VCOBYP bit of PLLCON0 register. User can choose either normal or prescalar mode by configuring VCOBYP bit. Use type XMC_SCU_PLL_MODE_t for accessing these enum parameters.
Defines options for selecting the P-Divider input frequency. These enums are used to configure PINSEL bits of PLLCON2 register. Use type XMC_SCU_CLOCK_OSCCLKSRC_t for accessing these enum parameters.
Enumerator | |
---|---|
XMC_SCU_CLOCK_SYSPLLCLKSRC_OSCHP |
External crystal oscillator (fOHP) as the source for P-Divider. |
XMC_SCU_CLOCK_SYSPLLCLKSRC_OFI |
Backup clock(fOFI) as the source for P-Divider. |
enum XMC_SCU_CLOCK_t |
Defines enumerations for disabling the clocks sources of peripherals. Disabling of the peripheral clock is configured via the CLKCLR registers. Use type XMC_SCU_PERIPHERAL_CLOCK_t for accessing these enum parameters.
Defines options for selecting the USB clock source(fUSB/fSDMMC). These enums are used to configure USBSEL bits of USBCLKCR register. User can choose either fPLL or fUSBPLL clock as a source for USB clock. Use type XMC_SCU_CLOCK_USBCLKSRC_t for accessing these enum parameters.
Enumerator | |
---|---|
XMC_SCU_CLOCK_USBCLKSRC_USBPLL |
USB PLL(fUSB PLL) as a source for USB clock (fUSB/fSDMMC). |
XMC_SCU_CLOCK_USBCLKSRC_SYSPLL |
Main PLL output (fPLL) as a source for USB clock (fUSB/fSDMMC). |
Defines options for selecting the source of WDT clock(fWDT). These enums are used to configure WDTSEL bits of WDTCLKCR register. User can choose either fOFI or fPLL or fSTDBY clock as a source for WDT clock. Use type XMC_SCU_CLOCK_USBCLKSRC_t for accessing these enum parameters.
enum XMC_SCU_HIB_EVENT_t |
Hibernate domain event status
enum XMC_SCU_HIB_IO_t |
Hibernate domain dedicated pins
HIB LPAC input selection
HIB LPAC status
HIB LPAC start trigger selection for selected inputs
HIB_IOx pin I/O control
Defines options for selecting the source of RTC Clock (fRTC). These enums are used to configure RCS bit of HDCR register. User can choose either fOSI or fULP clock as a source for RTC Clock (fRTC). Use type XMC_SCU_HIB_RTCCLKSRC_t for accessing these enum parameters.
Enumerator | |
---|---|
XMC_SCU_HIB_RTCCLKSRC_OSI |
Internal Slow Clock (fOSI) as the source for RTC Clock (fRTC). |
XMC_SCU_HIB_RTCCLKSRC_ULP |
Ultra Low Power Clock (fULP) as the source for RTC Clock (fRTC). |
Selects input signal HIB_SR0 of ERU0
Defines options for selecting the source of Standby Clock (fSTDBY). These enums are used to configure STDBYSEL bit of HDCR register. User can choose either fOSI or fULP clock as a source for Standby Clock (fSTDBY). Use type XMC_SCU_HIB_STDBYCLKSRC_t for accessing these enum parameters.
enum XMC_SCU_NMIREQ_t |
Defines enumeration for the events that can generate non maskable interrupt(NMI). The NMI generation can be enabled with NMIREQEN register. The event will be reflected in SRSTAT or will be mirrored in the TRAPSTAT register. These enums can be used to configure NMI request generation bits of NMIREQEN register. Once configured, these events can generate non maskable interrupt. All the enum items are tabulated as per bits present in NMIREQEN register. Use type XMC_SCU_NMIREQ_t for accessing these enum parameters.
enum XMC_SCU_PARITY_t |
Defines enumerations for different parity event generating modules that in turn generate a trap. Parity can be enabled with PETE register in order to get the trap flag reflected in TRAPRAW register. These enums are used to configure parity error trap generation mechanism bits of PETE register. All the enum items are tabulated as per bits present in PETE register. Use type XMC_SCU_PARITY_t for accessing these enum parameters.
Defines enumeration for peripherals that support clock gating. The enumerations can be used for gating or ungating the peripheral clocks. All the enum items are tabulated as per bits present in CGATSTAT0 register. Use type XMC_SCU_PERIPHERAL_CLOCK_t for accessing these enum parameters.
Defines enumeration representing different peripheral reset bits in the PRSTAT registers. All the enum items are tabulated as per bits present in PRSTAT0, PRSTAT1, PRSTAT2, PRSTAT3 registers. Use type XMC_SCU_PERIPHERAL_RESET_t for accessing these enum parameters. Note: Release of reset should be prevented when the peripheral clock is gated in cases where kernel clock and bus interface clocks are shared, in order to avoid system hang-up.
enum XMC_SCU_POWER_MODE_t |
Defines the different causes for last reset. The cause of the last reset gets automatically stored in the SCU_RSTSTAT register and can be checked by user software to determine the state of the system and for debuggging purpose. All the enum items are tabulated as per bits present in SCU_RSTSTAT register. Use type XMC_SCU_RESET_REASON_t for accessing these enum parameters.
enum XMC_SCU_STATUS_t |
Defines the status of SCU API execution, used to verify the SCU related API calls.
enum XMC_SCU_TRAP_t |
Defines enumerations representing the status of trap cause. The cause of the trap gets automatically stored in the TRAPSTAT register and can be checked by user software to determine the state of the system and for debug purpose. Use type XMC_SCU_TRAP_t for accessing these enum parameters.
Function Documentation
void XMC_SCU_CalibrateTemperatureSensor | ( | uint32_t | offset, |
uint32_t | gain | ||
) |
- Parameters
-
offset Offset value for calibrating the DTS result.
Range: 0 to 127.gain Gain value for calibrating the DTS conversion result.
Range: 0 to 63.
- Returns
- None
- Description
- Calibrates the measurement of temperature by configuring the values of offset and gain of DTSCON register.
Allows to improve the accuracy of the temperature measurement with the adjustment of OFFSET and GAIN bit fields in the DTSCON register. Offset adjustment is defined as a shift of the conversion result. The range of the offset adjustment is 7 bits with a resolution that corresponds to +/- 12.5�C. The offset value gets added to the measure result. Offset is considered as a signed value. Gain adjustment helps in minimizing gain error. When the gain value is 0, result is generated with maximum gain. When the gain value is 63, result is generated with least gain, i.e, RESULT - 63 at the highest measured temperature.
It is recommended to use following steps:
- Call XMC_SCU_StopTempMeasurement to stop temperature measurement if it was started previously.
- Call XMC_SCU_CalibrateTempMonitor with desired offset and gain calibration values to the DTS.
- Call XMC_SCU_SetRawTempLimits with desired lower and upper temperature threshold limit values if it is needed.
- Call XMC_SCU_StartTempMeasurement to start temperature measurement.
- Check whether Die Temperature Sensor (DTS) is busy in conversion by calling XMC_SCU_IsTemperatureSensorBusy() and wait till conversion complete.
- Read the die temperature value using XMC_SCU_GetTemperatureMeasurement API.
- Call XMC_SCU_StopTempMeasurement to stop temperature measurement if it was started previously.
void XMC_SCU_CLOCK_DisableClock | ( | const XMC_SCU_CLOCK_t | clock | ) |
- Parameters
-
clock Peripheral for which the clock has to be disabled.
Range: Use type XMC_SCU_CLOCK_t to select the peripheral.
- Returns
- None
- Description
- Disables source clock for the peripheral selected.
The various outputs of Clock Generation Unit (CGU) can be individually disabled by setting the peripheral specific bits in the CLKCLR register.
It is recommended to use following steps to verify whether clock source of the peripheral is enabled/disabled:
- Call XMC_SCU_CLOCK_DisableClock with desired peripheral identifier.
- Call XMC_SCU_CLOCK_IsClockEnabled with same peripheral identifier to verify whether peripheral is enabled/disabled.
- Call XMC_SCU_CLOCK_DisableClock with desired peripheral identifier.
void XMC_SCU_CLOCK_DisableHighPerformanceOscillator | ( | void | ) |
- Returns
- None
- Description
- Disables the high precision oscillator by disabling the external oscillator.
The API configures MODE bits of OSCHPCTRL register to 1, there by disabling the external oscillator.
- Related APIs:
- XMC_SCU_CLOCK_EnableHighPerformanceOscillator()
void XMC_SCU_CLOCK_DisableHighPerformanceOscillatorGeneralPurposeInput | ( | void | ) |
- Returns
- None
- Description
- Disables XTAL1 input of OSC_ULP as general purpose input.
void XMC_SCU_CLOCK_DisableLowPowerOscillator | ( | void | ) |
- Returns
- None
- Description
- Disables ultra low power oscillator.
It is disabled by setting the MODE bits of OSCULCTRL register to value 2. By default on power up, the ultra low power osciallator is disabled.
- Related APIs:
- XMC_SCU_CLOCK_EnableLowPowerOscillator()
void XMC_SCU_CLOCK_DisableLowPowerOscillatorGeneralPurposeInput | ( | void | ) |
- Returns
- None
- Description
- Disables XTAL1 input of OSC_ULP as general purpose input.
- Related APIs:
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
void XMC_SCU_CLOCK_DisableSystemPll | ( | void | ) |
- Returns
- None
- Description
- Disables main PLL for system clock.
System PLL is disabled by setting the PLLPWD and VCOPWD bits of PLLCON0 register. By default the system PLL is in power saving mode. If the system PLL is explicitly enabled, the API disables the PLL and the voltage controlled oscillator(VCO) associated with it.
- Related APIs:
- XMC_SCU_CLOCK_EnableSystemPll(), XMC_SCU_CLOCK_StopSystemPll()
void XMC_SCU_CLOCK_DisableUsbPll | ( | void | ) |
- Returns
- None
- Description
- Disables USB PLL for USB clock.
USB PLL is disabled by setting the PLLPWD and VCOPWD bits of USBPLLCON register. By default the USB PLL is in power saving mode. If the USB PLL is explicitly enabled, the API disables the PLL and the voltage controlled oscillator(VCO) associated with it.
- Related APIs:
- XMC_SCU_CLOCK_EnableUsbPll(), XMC_SCU_CLOCK_StopUsbPll()
void XMC_SCU_CLOCK_EnableClock | ( | const XMC_SCU_CLOCK_t | clock | ) |
- Parameters
-
clock Peripheral for which the clock has to be enabled.
Range: Use type XMC_SCU_CLOCK_t to select the peripheral.
- Returns
- None
- Description
- Enables the source clock for selected peripheral.
The various outputs of Clock Generation Unit (CGU) can be individually enabled by setting the peripheral specific bit in the CLKSET register.
It is recommended to use following steps to verify whether a source clock of peripheral is enabled/disabled:
- Call XMC_SCU_CLOCK_EnableClock() with desired peripheral identifier.
- Call XMC_SCU_CLOCK_IsClockEnabled() with same peripheral identifier to verify whether the clock is enabled.
- Call XMC_SCU_CLOCK_EnableClock() with desired peripheral identifier.
void XMC_SCU_CLOCK_EnableHighPerformanceOscillator | ( | void | ) |
- Returns
- None
- Description
- Enables the high precision oscillator by configuring external crystal mode.
The API configures MODE bits of OSCHPCTRL register to 0, there by configuring the external clock input. The System Oscillator Watchdog is enabled. The user should check the status of the oscillator using XMC_SCU_CLOCK_IsHighPerformanceOscillatorStable()
- Related APIs:
- XMC_SCU_CLOCK_DisableHighPerformanceOscillator()
void XMC_SCU_CLOCK_EnableHighPerformanceOscillatorGeneralPurposeInput | ( | void | ) |
- Returns
- None
- Description
- Enables XTAL1 input of OSC_ULP as general purpose input. Use XMC_SCU_CLOCK_GetHighPerformanceOscillatorGeneralPurposeInputStatus to monitor the status of OSC_HP XTAL1 pin. OSC_ULP should be disabled previously using XMC_SCU_CLOCK_DisableHighPerformanceOscillator().
- Related APIs:
- XMC_SCU_CLOCK_DisableHighPerformanceOscillator()
void XMC_SCU_CLOCK_EnableLowPowerOscillator | ( | void | ) |
- Returns
- None
- Description
- Enables ultra low power oscillator(ULP).
It enables the hibernate domain, configures the ultra low power oscillator uisng the MODE bits of the OSCULCTRL register. The Mode bits will be reset to 0 to enable the low power oscillator. Mirror register update delays are handled internally. The OSC_ULP Oscillator Watchdog is enabled. The user should check the status of the oscillator using XMC_SCU_CLOCK_IsLowPowerOscillatorStable()
void XMC_SCU_CLOCK_EnableLowPowerOscillatorGeneralPurposeInput | ( | void | ) |
- Returns
- None
- Description
- Enables XTAL1 input of OSC_ULP as general purpose input. Use XMC_SCU_CLOCK_GetLowPowerOscillatorGeneralPurposeInputStatus to monitor the status of OSC_ULP XTAL1 pin. OSC_ULP should be disabled previously using XMC_SCU_CLOCK_DisableLowPowerOscillator().
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Related APIs:
- XMC_SCU_CLOCK_DisableLowPowerOscillator()
void XMC_SCU_CLOCK_EnableSystemPll | ( | void | ) |
- Returns
- None
- Description
- Enables main PLL for system clock.
System PLL is enabled by clearing the PLLPWD and VCOPWD bits of PLLCON0 register. By default the system PLL is in power saving mode. The API enables the PLL and the voltage controlled oscillator associated with it.
void XMC_SCU_CLOCK_EnableUsbPll | ( | void | ) |
- Returns
- None
- Description
- Enables USB PLL for USB clock.
USB PLL is enabled by clearing the PLLPWD and VCOPWD bits of USBPLLCON register. By default the USB PLL is in power saving mode. The API enables the PLL and the voltage controlled oscillator associated with it.
- Related APIs:
- XMC_SCU_CLOCK_DisableUsbPll(), XMC_SCU_CLOCK_StartUsbPll()
void XMC_SCU_CLOCK_GatePeripheralClock | ( | const XMC_SCU_PERIPHERAL_CLOCK_t | peripheral | ) |
- Parameters
-
peripheral The peripheral for which the clock has to be gated. Range: Use type XMC_SCU_PERIPHERAL_CLOCK_t to identify the peripheral clock to be gated.
- Returns
- None
- Description
- Blocks the supply of clock to the selected peripheral.
Clock gating helps in reducing the power consumption. User can selectively gate the clocks of unused peripherals. fPERI is the source of clock to various peripherals. Some peripherals support clock gate. Such a gate blocks the clock supply for the selected peripheral. Software can request for individual gating of such peripheral clocks by enabling one of the SCU_CGATSET0, SCU_CGATSET1 or SCU_CGATSET2 register bitfields.
Note: Clock gating shall not be activated unless the module is in reset state. So use XMC_SCU_CLOCK_IsPeripheralClockGated() API before enabling the gating of any peripheral.
uint32_t XMC_SCU_CLOCK_GetCcuClockDivider | ( | void | ) |
- Returns
- uint32_t Ratio of fCCU clock source to the value of fCCU. Range: 0 or 1.
0-> fCCU= fSYS
1-> fCCU= fSYS/2.
- Description
- Provides the ratio of CCU clock(fCCU) to system clock(fSYS).
The value is obtained by reading CCUDIV bit of CCUCLKCR register.
- Related APIs:
- XMC_SCU_CLOCK_SetCcuClockDivider()
uint32_t XMC_SCU_CLOCK_GetCcuClockFrequency | ( | void | ) |
- Returns
- uint32_t CCU clock frequency in Hertz.
- Description
- Provides the frequency of clock(fCPU) used for CCU4, CCU8, POSIF and HRPWM.
The value is obtained from CCUDIV bits of CCUCLKCR register and system clock (fSYS) frequency. Based on these values, fCCU clock frequency is calculated using following formula:
fCCU = fSYS >> CCUDIV.
uint32_t XMC_SCU_CLOCK_GetCpuClockDivider | ( | void | ) |
- Returns
- uint32_t Ratio between system clock(fSYS) and CPU clock(fCPU). Range: 0 or 1.
0-> fCPU= fSYS.
1-> fCPU= fSYS/2.
- Description
- Provides the ratio between system clock(fSYS) and CPU clock(fCPU).
The value is obtained by reading CPUDIV bit of CPUCLKCR register.
- Related APIs:
- XMC_SCU_CLOCK_SetCpuClockDivider()
uint32_t XMC_SCU_CLOCK_GetCpuClockFrequency | ( | void | ) |
- Returns
- uint32_t Value of CPU clock frequency.
- Description
- Provides the vlaue of CPU clock frequency.
The value is stored in a global variable SystemCoreClock. It is updated when the clock configuration is done using the SCU LLD APIs. The value represents the frequency of clock used for CPU operation. Range: Value is of type uint32_t, and gives the value of frequency in Hertz.
uint32_t XMC_SCU_CLOCK_GetEbuClockDivider | ( | void | ) |
- Returns
- uint32_t Ratio of PLL clock(fPLL) to EBU clock(fEBU).
Range: 0 to 63.
- Description
- Provides the ratio between PLL clock(fPLL) and EBU clock(fEBU).
The value is obtained by reading EBUDIV bits of EBUCLKCR register.
- Related APIs:
- XMC_SCU_CLOCK_SetEbuClockDivider()
uint32_t XMC_SCU_CLOCK_GetEbuClockFrequency | ( | void | ) |
- Returns
- uint32_t EBU clock frequency in Hertz.
- Description
- Provides the frequency of EBU clock(fEBU).
The value is derived from system PLL clock frequency(fPLL) by applying the EBU divider. It is calculated using the following formula:
fETH = fPLL /(EBUDIV+1)
uint32_t XMC_SCU_CLOCK_GetECATClockDivider | ( | void | ) |
- Returns
- uint32_t Ratio between the source of ECAT clock and the ECAT clock.
Range: 0 to 3.
- Description
- Provides the ratio between the ECAT parent clock and the ECAT clock.
The value is obtained by reading ECADIV bits of ECATCLKCR register.
XMC_SCU_CLOCK_ECATCLKSRC_t XMC_SCU_CLOCK_GetECATClockSource | ( | void | ) |
- Returns
- XMC_SCU_CLOCK_ECATCLKSRC_t Source of ECAT clock.
Range: Use type XMC_SCU_CLOCK_ECATCLKSRC_t to identify the clock source.
XMC_SCU_CLOCK_ECATCLKSRC_USBPLL - USB PLL (fUSBPLL) as a source for ECAT clock.
XMC_SCU_CLOCK_ECATCLKSRC_SYSPLL - Main PLL output (fPLL) as a source for ECAT clock.
- Description
- Provides the source of ECAT clock (fECAT). The value is obtained by reading ECATSEL bit of ECATCLKCR register.
- Related APIs:
- XMC_SCU_HIB_SetRtcClockSource()
uint32_t XMC_SCU_CLOCK_GetEthernetClockFrequency | ( | void | ) |
- Returns
- uint32_t Ethernet clock frequency in Hertz.
- Description
- Provides the frequency of Ethernet clock(fETH).
The value is derived from system clock frequency(fSYS). It is calculated using the following formula:
fETH = fSYS >> 1;
- Related APIs:
- XMC_SCU_CLOCK_GetSystemClockFrequency()
uint32_t XMC_SCU_CLOCK_GetExternalOutputClockDivider | ( | void | ) |
- Returns
- uint32_t Ratio between the external output parent clock selected and the output clock.
Range: 0 to 511.
- Description
- Provides the divider value applied on parent clock before the generation of external output clock.
The value is obtained by reading EXTDIV bit of EXTCLKCR register.
uint32_t XMC_SCU_CLOCK_GetExternalOutputClockFrequency | ( | void | ) |
- Returns
- uint32_t External clock out frequency in Hertz.
- Description
- Provides the frequency of external output clock(fEXT).
The value is derived using ECKDIV bits of EXCLKCR register and external clock out source. Based on these values, it is calculated using the following formula:
if external clock out source = System clock: fEXT = fSYS.
if external clock out source = PLL: fEXT = fPLL/(ECKDIV + 1).
if external clock out source = USBPLL: fEXT = fUSBPLL/(ECKDIV + 1).
XMC_SCU_CLOCK_EXTOUTCLKSRC_t XMC_SCU_CLOCK_GetExternalOutputClockSource | ( | void | ) |
- Returns
- XMC_SCU_CLOCK_EXTOUTCLKSRC_t Source of external clock output(fEXT).
Range: Use type XMC_SCU_CLOCK_EXTOUTCLKSRC_t to identify the clock.
XMC_SCU_CLOCK_EXTOUTCLKSRC_SYS - system clock fSYS.
XMC_SCU_CLOCK_EXTOUTCLKSRC_USB - USB clock fUSB.
XMC_SCU_CLOCK_EXTOUTCLKSRC_PLL - PLL output fPLL.
- Description
- Provides the source of external clock output(fEXT).
The value is obtained by reading ECKSEL bits of EXTCLKCR register.
uint32_t XMC_SCU_CLOCK_GetHighPerformanceOscillatorGeneralPurposeInputStatus | ( | void | ) |
- Returns
- Status OSC_HP XTAL1 pin
- Description
- Monitor the status of OSC_HP XTAL1 pin.
uint32_t XMC_SCU_CLOCK_GetLowPowerOscillatorGeneralPurposeInputStatus | ( | void | ) |
- Returns
- Status OSC_ULP XTAL1 pin
- Description
- Monitor the status of OSC_ULP XTAL1 pin.
uint32_t XMC_SCU_CLOCK_GetPeripheralClockDivider | ( | void | ) |
- Returns
- uint32_t Ratio of peripheral clock source to the value of peripheral clock.
Range: 0 or 1.
0-> fPERIPH= fCPU.
1-> fPERIPH= fCPU/2.
- Description
- Provides the ratio of CPU clock(fCPU) to peripheral clock(fPERIPH).
The value is obtained by reading PBDIV bit of PBCLKCR register.
- Related APIs:
- XMC_SCU_CLOCK_SetPeripheralClockDivider()
uint32_t XMC_SCU_CLOCK_GetPeripheralClockFrequency | ( | void | ) |
- Returns
- uint32_t Value of peripheral clock frequency in Hertz.
- Description
- Provides the vlaue of clock frequency at which the peripherals are working.
The value is derived from the CPU frequency. Range: Value is of type uint32_t. It is represented in Hertz.
uint32_t XMC_SCU_CLOCK_GetSystemClockDivider | ( | void | ) |
- Returns
- uint32_t Ratio of fSYS clock source to the value of fSYS. Range: 0 to 255.
- Description
- Provides the value of ratio between the source of system clock to the the value of system clock frequency.
The value is obtained by reading SYSDIV bits of SYSCLKCR register.
uint32_t XMC_SCU_CLOCK_GetSystemClockFrequency | ( | void | ) |
- Returns
- uint32_t System clock frequency in Hertz.
- Description
- Provides the frequency of system clock (fSYS).
The value obtained by dividing CPUDIV bits information of CPUCLKCR register with SystemCoreClock (fCPU) value.
Based on these values, fSYS clock frequency is derived using the following formula:
fSYS = fCPU << CPUDIV.
- Related APIs:
- XMC_SCU_CLOCK_GetUsbPllClockFrequency()
XMC_SCU_CLOCK_SYSCLKSRC_t XMC_SCU_CLOCK_GetSystemClockSource | ( | void | ) |
- Returns
- XMC_SCU_CLOCK_SYSCLKSRC_t Source of clock for fSYS.
Range: Use type XMC_SCU_CLOCK_SYSCLKSRC_t to select the source of clock.
XMC_SCU_CLOCK_SYSCLKSRC_OFI - internal fast clock selected as fSYS.
XMC_SCU_CLOCK_SYSCLKSRC_PLL - output of PLL fPLL selected as fSYS.
- Description
- Provides the selected source of system clock (fSYS).
Selected source of fSYS is obtained by reading SYSSEL bits of SYSCLKCR register.
uint32_t XMC_SCU_CLOCK_GetSystemPllClockFrequency | ( | void | ) |
- Returns
- uint32_t System frequency in Hertz.
Range: clock frequency in Hertz. Range of the value depends on the source clock frequency and the configured values of dividers.
- Description
- Provides the value of system PLL output clock frequency(fPLL).
The API uses N-DIV, P-DIV, K1-DIV, K2-DIV bits information from PLLCON1 register and VCOBYP bit information from PLLCON0 register. It calculates frequency of system pll clock using following formula: If normal Mode : fPLL = (fOSC * N)/(P * K2). If prescaler mode: fPLL = fOSC/ K1.
- Related APIs:
- XMC_SCU_CLOCK_SetSystemClockSource()
XMC_SCU_CLOCK_SYSPLLCLKSRC_t XMC_SCU_CLOCK_GetSystemPllClockSource | ( | void | ) |
- Returns
- XMC_SCU_CLOCK_OSCCLKSRC_t Source of clock for system PLL.
Range: Use type XMC_SCU_CLOCK_SYSPLLCLKSRC_t for identifying the clock source.
XMC_SCU_CLOCK_SYSPLLCLKSRC_OSCHP - External High performance oscillator(fOHP).
XMC_SCU_CLOCK_SYSPLLCLKSRC_OFI - Internal fast clock (fOFI).
- Description
- Provides the source of system PLL clock (fPLL).
The value is obtained by reading VCOBYP bit of PLLCON0 register.
uint32_t XMC_SCU_CLOCK_GetSystemPllClockSourceFrequency | ( | void | ) |
- Returns
- uint32_t Source clock used for deriving system clock.
Range: fOHP frequency if external high precision frequency is used.
fOFI fast internal clock frequency.
- Description
- Provides the value of the input clock frequency for deriving the system clock. The API retrieves frequency of system PLL input clock (fPLLin). Based on PINSEL bits information from PLLCON2 register, the parent clock source is obtained. This bit field specifies if fOHP or fOFI is used for deriving system clock. System clock frequency is obtained by dividing the source clock frequency with different divider values.
- Related APIs:
- XMC_SCU_CLOCK_GetSystemPllClockFrequency()
uint32_t XMC_SCU_CLOCK_GetUsbClockDivider | ( | void | ) |
- Returns
- uint32_t Ratio of PLL output clock(fPLL) to USB clock(fUSB). Range: 0 to 7.
- Description
- Provides the ratio between PLL output frequency(fPLL) and USB clock(fUSB).
The value is obtained by reading USBDIV bit of USBCLKCR register.
uint32_t XMC_SCU_CLOCK_GetUsbClockFrequency | ( | void | ) |
- Returns
- uint32_t USB clock frequency in Hertz.
- Description
- Provides the frequency of USB and SDMMC clock(fUSB/fSDMMC).
The value is obtained from USBDIV bits of USBCLKCR register and USB clock source. Based on these values fUSB/fSDMMC clock frequency is calculated using following formula:
if USB clock source = USBPLL: fUSB/fSDMMC = fUSBPLL/(USBDIV + 1).
if USB clock source = PLL: fUSB/fSDMMC = fPLL/(USBDIV + 1).
XMC_SCU_CLOCK_USBCLKSRC_t XMC_SCU_CLOCK_GetUsbClockSource | ( | void | ) |
- Returns
- XMC_SCU_CLOCK_USBCLKSRC_t Source of clock for USB and SDMMC(fUSB/SDMMC).
Range: Use type XMC_SCU_CLOCK_USBCLKSRC_t to identify the source of clock.
XMC_SCU_CLOCK_USBCLKSRC_USBPLL - output of USB PLL is selected as source of USB clock(fUSB/SDMMC).
XMC_SCU_CLOCK_USBCLKSRC_SYSPLL - output of PLL fPLL is selected as source of USB clock(fUSB/SDMMC).
- Description
- Provides the selected source of USB and SDMMC clock frequency.
The clock source is read from from the USBSEL bits of USBCLKCR register.
uint32_t XMC_SCU_CLOCK_GetUsbPllClockFrequency | ( | void | ) |
- Returns
- uint32_t USB PLL output clock frequency.
- Description
- Provides the frequency of USB PLL output clock (fUSBPLL).
It obtains the VCOBYP bits information from USBPLLCON register and decides if USB PLL mode is used. If USB PLL mode is used, the USB clock frequency is obtained by dividing the source clock by USB PLL dividers.
The frequency is obtained using following formula:
If Normal Mode : fUSBPLL = (fOSC * N)/(P * 2).
If Prescaler mode: fPLL = fOSC.
- Related APIs:
- XMC_SCU_CLOCK_GetSystemPllClockSourceFrequency()
uint32_t XMC_SCU_CLOCK_GetWdtClockDivider | ( | void | ) |
- Returns
- uint32_t Ratio between the source of WDT clock and the WDT clock.
Range: 0 to 255.
- Description
- Provides the ratio between the WDT parent clock and the WDT clock.
The value is obtained by reading WDTDIV bits of WDTCLKCR register. Ensure that the WDT parent clock is considered before using the value of the divider value.
uint32_t XMC_SCU_CLOCK_GetWdtClockFrequency | ( | void | ) |
- Returns
- uint32_t WDT clock frequency in Hertz.
- Description
- Provides the frequency of WDT clock(fWDT).
The value is derived using WDTDIV bits of WDTCLKCR register and WDT clock source. Based on these values it is calculated using the following formula:
if WDT clock source = PLL: fWDT = fUSBPLL/(WDTDIV + 1).
if WDT clock source = OFI: fWDT = fOFI/(WDTDIV + 1).
if WDT clock source = Standby: fWDT = fSTDBY/(WDTDIV + 1).
XMC_SCU_CLOCK_WDTCLKSRC_t XMC_SCU_CLOCK_GetWdtClockSource | ( | void | ) |
- Returns
- XMC_SCU_CLOCK_WDTCLKSRC_t Clock source configured for watchdog timer.
Range: Use type XMC_SCU_CLOCK_WDTCLKSRC_t to identify the clock source.
XMC_SCU_CLOCK_WDTCLKSRC_OFI - internal fast oscillator (fOFI)
XMC_SCU_CLOCK_WDTCLKSRC_STDBY - backup standby clock (fSTDBY)
XMC_SCU_CLOCK_WDTCLKSRC_PLL - PLL output clock (fPLL)
- Description
- Provides the source of clock used for watchdog timer.
The value is obtained by reading WDTSEL bits of WDTCLKCR register. The time for timeout or pre-warning of watchdog has to be calculated based on the clock source selected.
void XMC_SCU_CLOCK_Init | ( | const XMC_SCU_CLOCK_CONFIG_t *const | config | ) |
- Parameters
-
config Pointer to structure holding the clock prescaler values and divider values for configuring clock generators and clock tree.
Range: Configure the members of structure XMC_SCU_CLOCK_CONFIG_t for various parameters of clock setup.
- Returns
- None
- Description
- Initializes clock generators and clock tree.
Enables the high precision oscillator(fOHP) input and configures the system and peripheral clock frequencies. Based on the system clock source selected in config, either fPLL or fOFI will be chosen as system clock. Based on PLL mode(normal or prescaler mode) used, PLL ramps up in steps to achieve target frequency. The clock dividers for CPU, CCU and peripheral clocks will be set based on the input configuration. The SystemCoreClock variable is set with the value of system clock frequency.
bool XMC_SCU_CLOCK_IsClockEnabled | ( | const XMC_SCU_CLOCK_t | clock | ) |
- Parameters
-
clock Peripheral for which the clock status has to be checked.
Range: Use type XMC_SCU_CLOCK_t to select the peripheral.
- Returns
- bool Status of peripheral clock.
Range: true if peripheral clock is enabled. false if peripheral clock is disabled.
- Description
- Checks the status of peripheral source clock.
The status of peripheral source clock is read from the CLKSTATn register. Returns true if clock is enabled and returns false otherwise.
- Related APIs:
- XMC_SCU_CLOCK_EnableClock(), XMC_SCU_CLOCK_DisableClock()
bool XMC_SCU_CLOCK_IsHighPerformanceOscillatorStable | ( | void | ) |
- Returns
- Status of high performance oscillator
- Description
- Checks if the OSC_HP oscillator is stable and usable
- Related APIs:
- XMC_SCU_CLOCK_EnableHighPerformanceOscillator()
bool XMC_SCU_CLOCK_IsLowPowerOscillatorStable | ( | void | ) |
- Returns
- Status of low power oscillator
- Description
- Checks if the OSC_ULP oscillator is stable and usable
- Related APIs:
- XMC_SCU_CLOCK_EnableLowPowerOscillator()
bool XMC_SCU_CLOCK_IsPeripheralClockGated | ( | const XMC_SCU_PERIPHERAL_CLOCK_t | peripheral | ) |
- Parameters
-
peripheral The peripheral for which the check for clock gating has to be done. Range: Use type XMC_SCU_PERIPHERAL_CLOCK_t to identify the peripheral.
- Returns
- bool Status of the peripheral clock gating. Range: true if the peripheral clock is gated. false if the peripheral clock ungated(gate de-asserted).
- Description
- Gives the status of peripheral clock gating.
Checks the status of peripheral clock gating using one of CGATSTAT0, CGATSTAT1 or CGATSTAT2 registers. It is recommended to use this API before enabling the gating of any peripherals through XMC_SCU_CLOCK_GatePeripheralClock() API.
bool XMC_SCU_CLOCK_IsSystemPllLocked | ( | void | ) |
- Parameters
-
None
- Returns
- Boolean value indicating if System PLL is locked
- Description
- Return status of System PLL VCO.
- Related APIs:
- XMC_SCU_CLOCK_StartSystemPll()
bool XMC_SCU_CLOCK_IsUsbPllLocked | ( | void | ) |
- Parameters
-
None
- Returns
- Boolean value indicating if USB PLL is locked
- Description
- Return status of USB PLL VCO.
- Related APIs:
- XMC_SCU_CLOCK_StartUsbPll()
void XMC_SCU_CLOCK_SetBackupClockCalibrationMode | ( | XMC_SCU_CLOCK_FOFI_CALIBRATION_MODE_t | mode | ) |
- Parameters
-
mode Backup clock calibration mode.
Range: Use type XMC_SCU_CLOCK_FOFI_CALIBRATION_MODE_t to identify the calibration mode.
XMC_SCU_CLOCK_FOFI_CALIBRATION_MODE_FACTORY- Force trimming of internal oscillator with firmware configured values.
XMC_SCU_CLOCK_FOFI_CALIBRATION_MODE_AUTOMATIC- Calibrate internal oscillator automatically using standby clock(fSTDBY).
- Returns
- None
- Description
- Configures the calibration mode of internal oscillator.
Based on the calibration mode selected, the internal oscillator calibration will be configured. The calibration is useful while using fast internal clock(fOFI). When factory mode calibration is used, the internal oscillator is trimmed using the firmware configured values. If automatic calibration is selected, the internal oscillator will be monitored using the backup clock.
- Related APIs:
- XMC_SCU_CLOCK_SetSystemClockSource()
void XMC_SCU_CLOCK_SetCcuClockDivider | ( | const uint32_t | ratio | ) |
- Parameters
-
ratio Ratio of fCCU clock source to the value of fCCU. Range: 1 or 2.
1-> fCCU= fSYS
2-> fCCU= fSYS/2.
- Returns
- None
- Description
- Configures the divider for CCU clock source.
Capture compare unit(CCU) can take either fSYS or fSYS/2 as the source of clock. The configuration is set to CCUDIV bit of CCUCLKCR register. The CCUDIV bit is 1 bit wide.
- Related APIs:
- XMC_SCU_CLOCK_GetCcuClockDivider()
void XMC_SCU_CLOCK_SetCpuClockDivider | ( | const uint32_t | ratio | ) |
- Parameters
-
ratio Ratio between system clock(fSYS) and CPU clock(fCPU). Range: 1 or 2.
1-> fCPU= fSYS.
2-> fCPU= fSYS/2.
- Returns
- None
- Description
- Configures the CPU clock by setting the divider value for the system clock.
The value is set to the CPUDIV bit of CPUCLKCR register.
- Related APIs:
- XMC_SCU_CLOCK_GetCpuClockDivider()
void XMC_SCU_CLOCK_SetDeepSleepConfig | ( | int32_t | config | ) |
- Parameters
-
config Defines the source of the system clock and peripherals clock gating in DEEPSLEEP state. XMC_SCU_CLOCK_DEEPSLEEP_MODE_CONFIG_t
- Returns
- None
- Description
- Defines the source of the system clock and peripherals clock gating in DEEPSLEEP state. In addition the state of FLASH, PLL and PLLVCO during DEEPSLEEP state. Use this enum as parameter of XMC_SCU_CLOCK_SetDeepSleepConfig before going to DEEPSLEEP state.
The DEEPSLEEP state of the system corresponds to the DEEPSLEEP state of the CPU. The state is entered via WFI or WFE instruction of the CPU. In this state the clock to the CPU is stopped.
In Deep Sleep state the OSC_HP and the PLL may be switched off. The wake-up logic in the NVIC is still clocked by a free-running clock. Peripherals are only clocked when configured to stay enabled. Configuration of peripherals and any SRAM content is preserved. The Flash module can be put into low-power mode to achieve a further power reduction. On wake-up Flash module will be restarted again before instructions or data access is possible. Any interrupt will bring the system back to operation via the NVIC.The clock setup before entering Deep Sleep state is restored upon wake-up.
- Related APIs:
- XMC_SCU_CLOCK_Init()
void XMC_SCU_CLOCK_SetEbuClockDivider | ( | const uint32_t | ratio | ) |
- Parameters
-
ratio Ratio of PLL clock(fPLL) to EBU clock(fEBU).
Range: 1 to 64.
- Returns
- None
- Description
- Configures the EBU clock(fEBU) by setting the divider value.
The clock divider is configured to the EBUDIV bits of EBUCLKCR register.
- Related APIs:
- XMC_SCU_CLOCK_GetEbuClockDivider()
void XMC_SCU_CLOCK_SetECATClockDivider | ( | const uint32_t | divider | ) |
- Parameters
-
ratio Ratio between the source of ECAT clock and the ECAT clock.
Range: 1 to 4.
- Returns
- None
- Description
- Configures the ECAT clock by setting the clock divider for the ECAT clock source.
The value is configured to ECADIV bits of ECATCLKCR register. The value of divider is decremented by 1 before configuring.
void XMC_SCU_CLOCK_SetECATClockSource | ( | const XMC_SCU_CLOCK_ECATCLKSRC_t | source | ) |
- Parameters
-
source Source of ECAT clock.
Range: Use type XMC_SCU_CLOCK_ECATCLKSRC_t to identify the clock source.
XMC_SCU_CLOCK_ECATCLKSRC_USBPLL - USB PLL (fUSBPLL) as a source for ECAT clock.
XMC_SCU_CLOCK_ECATCLKSRC_SYSPLL - Main PLL output (fPLL) as a source for ECAT clock.
- Returns
- None
- Description
- Selects the source of ECAT clock (fECAT).
The value is configured to ECATSEL bit of ECATCLKCR register.
- Related APIs:
- XMC_SCU_CLOCK_GetECATClockSource()
void XMC_SCU_CLOCK_SetExternalOutputClockDivider | ( | const uint32_t | ratio | ) |
- Parameters
-
ratio Ratio between the external output parent clock selected and the output clock.
Range: 1 to 512.
- Returns
- None
- Description
- Configures the external output clock by setting the divider value for the parent clock.
The value will be configured to ECKDIV bits of EXTCLKCR register. The divider value is decremented by 1 before storing it to the bit fields. Ensure that the source of external output clock is configured appropriately using the API XMC_SCU_CLOCK_SetExternalOutputClockSource().
void XMC_SCU_CLOCK_SetExternalOutputClockSource | ( | const XMC_SCU_CLOCK_EXTOUTCLKSRC_t | clock | ) |
- Parameters
-
clock Source of external clock output(fEXT).
Range: Use type XMC_SCU_CLOCK_EXTOUTCLKSRC_t to identify the clock.
XMC_SCU_CLOCK_EXTOUTCLKSRC_SYS - system clock fSYS.
XMC_SCU_CLOCK_EXTOUTCLKSRC_USB - USB clock fUSB.
XMC_SCU_CLOCK_EXTOUTCLKSRC_PLL - PLL output fPLL.
- Returns
- None
- Description
- Selects the source of external clock out (fEXT).
The value will be configured to ECKSEL bits of EXTCLKCR register.
void XMC_SCU_CLOCK_SetPeripheralClockDivider | ( | const uint32_t | ratio | ) |
- Parameters
-
ratio Ratio of peripheral clock source to the value of peripheral clock.
Range: 1 or 2.
1-> fPERIPH= fCPU.
2-> fPERIPH= fCPU/2.
- Returns
- None
- Description
- Configures the peripheral clock by setting the divider for CPU clock(fCPU).
The peripheral clock can be equal to either fCPU or fCPU/2. The value is configured to PBDIV bit of PBCLKCR register.
- Related APIs:
- XMC_SCU_CLOCK_GetPeripheralClockDivider()
void XMC_SCU_CLOCK_SetSleepConfig | ( | int32_t | config | ) |
- Parameters
-
config Defines the source of the system clock and peripherals clock gating in SLEEP state. XMC_SCU_CLOCK_SLEEP_MODE_CONFIG_t
- Returns
- None
- Description
- Defines the source of the system clock and peripherals clock gating in SLEEP state.
The SLEEP state of the system corresponds to the SLEEP state of the CPU. The state is entered via WFI or WFE instruction of the CPU. In this state the clock to the CPU is stopped. Peripherals are only clocked when configured to stay enabled.
Peripherals can continue to operate unaffected and eventually generate an event to wake-up the CPU. Any interrupt to the NVIC will bring the CPU back to operation. The clock tree upon exit from SLEEP state is restored to what it was before entry into SLEEP state.
- Related APIs:
- XMC_SCU_CLOCK_Init()
void XMC_SCU_CLOCK_SetSystemClockDivider | ( | const uint32_t | divider | ) |
- Parameters
-
divider Ratio of fSYS clock source to the value of fSYS. Range: 1 to 256.
- Returns
- None
- Description
- Configures the ratio of system clock source to the value of system clock frequency.
The value is configured as SYSDIV bits of SYSCLKCR register. The divider value is decremented by 1 before configuring.
void XMC_SCU_CLOCK_SetSystemClockSource | ( | const XMC_SCU_CLOCK_SYSCLKSRC_t | source | ) |
- Parameters
-
source Source of clock for fSYS.
Range: Use type XMC_SCU_CLOCK_SYSCLKSRC_t to select the source of clock.
XMC_SCU_CLOCK_SYSCLKSRC_OFI for selecting internal fast clock as fSYS.
XMC_SCU_CLOCK_SYSCLKSRC_PLL for selecting the output of PLL fPLL as fSYS.
- Returns
- None
- Description
- Selects the source for system clock (fSYS).
System clock is selected by setting SYSSEL bits in the SYSCLKCR register. If XMC_SCU_CLOCK_SYSCLKSRC_PLL is selected, then the dividers of the PLL have to be additionally configured to achieve the required system clock frequency.
void XMC_SCU_CLOCK_SetSystemPllClockSource | ( | const XMC_SCU_CLOCK_SYSPLLCLKSRC_t | source | ) |
- Parameters
-
source Source of clock for system PLL.
Range: Use type XMC_SCU_CLOCK_SYSPLLCLKSRC_t for identifying the clock source.
XMC_SCU_CLOCK_SYSPLLCLKSRC_OSCHP - External High performance oscillator(fOHP).
XMC_SCU_CLOCK_SYSPLLCLKSRC_OFI - Internal fast clock (fOFI).
- Returns
- None
- Description
- Selects the source of system PLL.
The value is configured to VCOBYP bit of PLLCON0 register. If XMC_SCU_CLOCK_SYSPLLCLKSRC_OSCHP is selected, ensure that the high performance oscillator is enabled by using the API XMC_SCU_CLOCK_EnableHighPerformanceOscillator().
- Related APIs:
- XMC_SCU_CLOCK_EnableHighPerformanceOscillator()
void XMC_SCU_CLOCK_SetUsbClockDivider | ( | const uint32_t | ratio | ) |
- Parameters
-
ratio Ratio of PLL output clock(fPLL) to USB clock(fUSB). Range: 1 to 8.
- Returns
- None
- Description
- Configures the USB clock(fUSB) by setting the USB clock divider.
The value is decremented by 1 before setting it to USBDIV bits of USBCLKCR register.
void XMC_SCU_CLOCK_SetUsbClockSource | ( | const XMC_SCU_CLOCK_USBCLKSRC_t | source | ) |
- Parameters
-
source Source of clock for USB and SDMMC(fUSB/SDMMC).
Range: Use type XMC_SCU_CLOCK_USBCLKSRC_t to select the source of clock.
XMC_SCU_CLOCK_USBCLKSRC_USBPLL - output of USB PLL as source of USB clock(fUSB/SDMMC).
XMC_SCU_CLOCK_USBCLKSRC_SYSPLL - output of PLL fPLL as source of USB clock(fUSB/SDMMC).
- Returns
- None
- Description
- Selects the source of USB/SDMMC clock (fUSB/SDMMC).
USB and SDMMC use a common clock source. They can either use fUSB PLL or fPLL as the source of clock. The selection is done by configuring the USBSEL bits of USBCLKCR register.
void XMC_SCU_CLOCK_SetWdtClockDivider | ( | const uint32_t | ratio | ) |
- Parameters
-
ratio Ratio between the source of WDT clock and the WDT clock.
Range: 1 to 256.
- Returns
- None
- Description
- Configures the WDT clock by setting the clock divider for the WDT clock source.
The value is configured to WDTDIV bits of WDTCLKCR register. The value of divider is decremented by 1 before configuring. Check the selected clock source for the WDT clock before configuring the divider using the API XMC_SCU_CLOCK_SetWdtClockSource().
void XMC_SCU_CLOCK_SetWdtClockSource | ( | const XMC_SCU_CLOCK_WDTCLKSRC_t | source | ) |
- Parameters
-
source Clock source for watchdog timer.
Range: Use type XMC_SCU_CLOCK_WDTCLKSRC_t to identify the clock source.
XMC_SCU_CLOCK_WDTCLKSRC_OFI - internal fast oscillator (fOFI)
XMC_SCU_CLOCK_WDTCLKSRC_STDBY - backup standby clock (fSTDBY)
XMC_SCU_CLOCK_WDTCLKSRC_PLL - PLL output clock (fPLL)
- Returns
- None
- Description
- Selects the source of WDT clock (fWDT).
The selected value is configured to the WDTSEL bits of WDTCLKCR register. The watchdog timer counts at the frequency selected using this API. So the time for timeout or pre-warning of watchdog has to be calculated based on this selection.
void XMC_SCU_CLOCK_StartSystemPll | ( | XMC_SCU_CLOCK_SYSPLLCLKSRC_t | source, |
XMC_SCU_CLOCK_SYSPLL_MODE_t | mode, | ||
uint32_t | pdiv, | ||
uint32_t | ndiv, | ||
uint32_t | kdiv | ||
) |
- Parameters
-
source PLL clock source.
Range: Use type XMC_SCU_CLOCK_SYSPLLCLKSRC_t to identify the clock source.
XMC_SCU_CLOCK_SYSPLLCLKSRC_OSCHP- External high precision oscillator input. XMC_SCU_CLOCK_SYSPLLCLKSRC_OFI- Internal fast clock input.mode Mode of PLL operation.
Range: Use type XMC_SCU_CLOCK_SYSPLL_MODE_t to identify the PLL mode.
XMC_SCU_CLOCK_SYSPLL_MODE_NORMAL- PLL frequency obtained from output of VCO(fVCO).
XMC_SCU_CLOCK_SYSPLL_MODE_PRESCALAR- VCO is bypassed. Frequency obtained from fOSC.
pdiv Input divider. Represents (PDIV+1) applied to external reference frequency.
Range: 1 to 16.
ndiv Feedback divider. Represents(NDIV+1)
Range: 1 to 128.
kdiv Output divider. Represents (K2DIV+1) in normal PLL mode or (K1DIV+1) in prescaler mode.
Range: 1 to 128.
- Returns
- None
- Description
- Enables system PLL.
Based on the selected source of clock, either external frequency fOHP or internal clock fOFI will be used. Based on the selected PLL mode, either voltage controlled oscillator(VCO) output(fVCO) or direct input frequency is used for the output dividers.
The API implements the following sequence:
- Store the value of TRAPDIS register into a temporary variable before disabling all traps.
- Clear all PLL related traps.
- If external fOHP is selected as source, wait for the external oscillator to stabilize.
- If PLL normal mode is selected, calculate the value of K2DIV and configure the PDIV, NDIV and K2DIV values.
- Ramp up the PLL frequency in steps.
- If prescaler mode is selected, configure the value of K1DIV.
- Wait for LOCK.
- Restore the trap configuration from stored temporary variable.
- Store the value of TRAPDIS register into a temporary variable before disabling all traps.
void XMC_SCU_CLOCK_StartUsbPll | ( | uint32_t | pdiv, |
uint32_t | ndiv | ||
) |
- Parameters
-
pdiv Input divider value. Represents (PDIV+1) divider for the USB PLL.
Range: 1 to 16.ndiv VCO feedback divider for USB PLL. Represents (NDIV+1) feedback divider.
Range: 1 to 128.
- Returns
- None
- Description
- Configures USB PLL dividers and enables the PLL.
The API follows the required sequence for safely configuring the divider values of USB PLL. Checks for PLL stabilization before enabling the same. After the configuring the dividers, it waits till the VCO lock is achieved. The sequence followed is as follows:
- Enable the USB PLL and configure VCO to be bypassed.
- Set up the HP oscillator clock input.
- Store the value of TRAPDIS register into a temporary variable before disabling all traps.
- Clear all USBPLL related traps.
- Disconnect the oscillator from USB PLL and configure the dividers PDIV and NDIV.
- Connect the oscillator to USB PLL and enable VCO.
- Wait for LOCK.
- Restore the trap configuration from stored temporary variable.
- Enable the USB PLL and configure VCO to be bypassed.
- Related APIs:
- XMC_SCU_CLOCK_StopUsbPll()
void XMC_SCU_CLOCK_StepSystemPllFrequency | ( | uint32_t | kdiv | ) |
- Parameters
-
kdiv PLL output divider K2DIV.
Range: 1 to 128. Represents (K2DIV+1).
- Returns
- None
- Description
- Ramps up or ramps down the PLL output frequency in provided step.
The PLL output frequency is divided by the kdiv value. This generates a step of ramp for the PLL output frequency. The API waits for the clock to stabilize before the completing its execution.
- Related APIs:
- XMC_SCU_CLOCK_StartSystemPll()
void XMC_SCU_CLOCK_StopSystemPll | ( | void | ) |
- Returns
- None
- Description
- Disables the system PLL. PLL is placed in power saving mode. It disables the PLL by setting the PLLPWD bit of PLLCON0 register. If the PLL is put to power saving mode, it can no longer be used. It is recommended to ensure following steps before using XMC_SCU_CLOCK_StopSystemPll API:
- Store the value of TRAPDIS register into a temporary variable before disabling all traps.
- Clear all PLL related traps.
- Ramp down frequency until fPLL reaches backup clock frequency (fOFI).
- Disable PLL.
- Restore the trap configuration from stored temporary variable.
- Store the value of TRAPDIS register into a temporary variable before disabling all traps.
void XMC_SCU_CLOCK_StopUsbPll | ( | void | ) |
- Returns
- None
- Description
- Disables USB PLL operation.
USB PLL is disabled by placing the USB PLL in power saving mode. The VCO and USB PLL are put in power saving mode by setting the PLLPWD bit and VCOPWD bit of USBLLCON register to 1. VCO bypass mode is enabled by setting the VCOBYP bit of USBLLCON register to 1. It is recommended to ensure following steps before using XMC_SCU_CLOCK_StopUsbPll API:
- Store the value of TRAPDIS register into a temporary variable before disabling all traps.
- Clear all USBPLL related traps.
- Ramp down frequency.
- Disable PLL.
- Restore the trap configuration from stored temporary variable.
- Store the value of TRAPDIS register into a temporary variable before disabling all traps.
- Related APIs:
- XMC_SCU_CLOCK_StartUsbPll()
void XMC_SCU_CLOCK_UngatePeripheralClock | ( | const XMC_SCU_PERIPHERAL_CLOCK_t | peripheral | ) |
- Parameters
-
peripheral The peripheral for which the clock has to be ungated. Range: Use type XMC_SCU_PERIPHERAL_CLOCK_t to identify the peripheral.
- Returns
- None
- Description
- Enables the supply of clock to the selected peripheral.
By default when the device powers on, the peripheral clock will be gated for the peripherals that support clock gating. The peripheral clock should be enabled before using it for any functionality. fPERI is the source of clock to various peripherals. Some peripherals support clock gate. Software can request for individual ungating of such peripheral clocks by setting the respective bits in one of SCU_CGATCLR0, SCU_CGATCLR1 or SCU_CGATCLR2 registers.
void XMC_SCU_DisableOutOfRangeComparator | ( | const uint32_t | group, |
const uint32_t | channel | ||
) |
- Parameters
-
group ADC Group to which the channel being monitored belongs to.
Range: 0 or 1.channel The channel whose voltage range has to be monitored.
Range: 6 or 7. Value identifies the channel in the selected ADC group.
- Returns
- None
- Description
- Disables the out of range comparator for the selected ADC group and the channel.
Out of range comparator is disabled by clearing the enable bit in the GORCEN register.
- Related APIs:
- XMC_SCU_EnableOutOfRangeComparator()
void XMC_SCU_DisableTemperatureSensor | ( | void | ) |
- Returns
- None
- Description
- Disables die temperature measurement by powering the DTS module off.
Die temperature sensor is disabled by clearing the PWD bit of DTSCON register.
void XMC_SCU_EnableOutOfRangeComparator | ( | const uint32_t | group, |
const uint32_t | channel | ||
) |
- Parameters
-
group ADC Group to which the channel being monitored belongs to.
Range: 0 or 1.channel The channel whose voltage range has to be monitored.
Range: 6 or 7. Value identifies the channel in the selected ADC group.
- Returns
- None
- Description
- Enables out of range comparator for the selected ADC group and channel.
The ADC channel input is compared by Out of Range Comparator (ORC) for overvoltage monitoring or for detection of out of range analog inputs. ORC must be turned on explicitly to leverage the auditing feature. ORC is enabled by setting the enable bit in the GORCEN register.
- Related APIs:
- XMC_SCU_DisableOutOfRangeComparator()
void XMC_SCU_EnableTemperatureSensor | ( | void | ) |
- Returns
- None
- Description
- Enables die temperature measurement by powering the DTS module.
Die temperature sensor is enabled by setting the PWD bit of DTSCON register.
uint32_t XMC_SCU_GetBootMode | ( | void | ) |
- Returns
- uint32_t Configured boot mode for the device.
Range: Use type XMC_SCU_BOOTMODE_t for enumeration of different boot modes.
- Description
- Provides the boot mode configured for the device.
The boot mode is read from the STCON register bit field SWCON.
- Related APIs:
- XMC_SCU_SetBootMode()
uint32_t XMC_SCU_GetMirrorStatus | ( | void | ) |
- Returns
- uint32_t Status of the register mirror update.
Range: Use the bit mask of the SCU_GENERAL_MIRRSTS register for the mirror update event of interest. e.g.: SCU_GENERAL_MIRRSTS_RTC_CTR_Msk. Multiple update events can be combined using OR operation.
- Description
- Provides the status of hibernate domain register update, when the respective mirror registers are changed.
The hibernate domain is connected to the core domain via SPI serial communication. MIRRSTS is a status register representing the communication of changed value of a mirror register to its corresponding register in the hibernate domain. The bit fields of the register indicate that a corresponding register of the hibernate domain is ready to accept a write or that the communication interface is busy with executing the previous operation.
Note: There is no hibernate domain in XMC1x devices. This register is retained for legacy purpose.
uint32_t XMC_SCU_GetTemperatureMeasurement | ( | void | ) |
- Returns
- uint32_t Measured temperature value.
Range: Valid temperature range is 0 to 1023.
If sensor is not enabled, 0x7FFFFFFFH is returned.
- Description
- Reads the measured value of die temperature.
Temperature measurement result is read from RESULT bit field of DTSSTAT register. The temperature measured in �C is given by (RESULT - 605) / 2.05 [�C]
- Related APIs:
- XMC_SCU_IsTemperatureSensorBusy()
void XMC_SCU_HIB_ClearEventStatus | ( | int32_t | event | ) |
- Parameters
-
event Hibernate wakeup event XMC_SCU_HIB_EVENT_t
- Returns
- None
- Description
- Clear hibernate wakeup event status
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
void XMC_SCU_HIB_ClearWakeupEventDetectionStatus | ( | void | ) |
- Returns
- None
- Description
- Clear detection status of wakeup from hibernate mode
void XMC_SCU_HIB_DisableEvent | ( | int32_t | event | ) |
- Parameters
-
event Hibernate wakeup event XMC_SCU_HIB_EVENT_t
- Returns
- None
- Description
- Disable hibernate wakeup event source
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
void XMC_SCU_HIB_DisableHibernateDomain | ( | void | ) |
- Returns
- None
- Description
- Powers down the hibernation domain.
After disabling the hibernate domain, none of the peripherals from the hibernte domain can be used. Hibernate domain is disabled by setting the HIB bit of PWRCLR register and \ HIBRS bit of RSTSET register.
It is recommended to use following steps to verify whether a hibernation domain is enabled/disabled:
- Call XMC_SCU_HIB_DisableHibernateDomain .
- Call XMC_SCU_HIB_IsHibernateDomainEnabled and check return value. If return value is true, it indicates that the hibernation domain is enabled otherwise disabled.
void XMC_SCU_HIB_DisableInternalSlowClock | ( | void | ) |
- Returns
- None
- Description
- Disables slow internal oscillator(fOSI).
By default on device power up, the slow internall oscillator is enabled. It can be disabled only if the external oscillator(fULP) is enabled and toggling. It is recommended to enable fOSI to prevent deadlock if fULP fails. fOSI is disabled by setting the PWD bit of OSCSICTRL register. The API waits for the mirror register update of the configured register. The slow internal oscillator registers are in hibernate domain. Ensure that the hibernate domain is enabled before changing the configuration.
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
void XMC_SCU_HIB_EnableEvent | ( | int32_t | event | ) |
- Parameters
-
event Hibernate wakeup event XMC_SCU_HIB_EVENT_t
- Returns
- None
- Description
- Enable hibernate wakeup event source
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
void XMC_SCU_HIB_EnableHibernateDomain | ( | void | ) |
- Returns
- None
- Description
- Powers up the hibernation domain.
Hibernate domain should be enabled before using any peripheral from the hibernate domain. It enables the power to the hibernate domain and moves it out of reset state. Power to hibernate domain is enabled by setting the HIB bit of PWRSET register only if it is currently powered down. The API will wait until HIB domain is enabled. If hibernate domain is in a state of reset, HIBRS bit of RSTCLR register is set to move it out of reset state.
It is recommended to use following steps to verify whether a hibernation domain is enabled/disabled:
- Call XMC_SCU_HIB_EnableHibernateDomain .
- Call XMC_SCU_HIB_IsHibernateDomainEnabled and check the return value. If return value is true, it indicates that the hibernation domain is enabled otherwise disabled.
void XMC_SCU_HIB_EnableInternalSlowClock | ( | void | ) |
- Returns
- None
- Description
- Enables slow internal oscillator(fOSI).
By default on device power up, the slow internall oscillator is enabled. It can be disabled only if the external oscillator(fULP) is enabled and toggling. It is recommended to enable fOSI to prevent deadlock if fULP fails. fOSI is enabled by clearing the PWD bit of OSCSICTRL register. The API waits for the mirror register update of the configured register. The slow internal oscillator registers are in hibernate domain. Ensure that the hibernate domain is enabled before changing the configuration.
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
void XMC_SCU_HIB_EnterHibernateState | ( | void | ) |
- Returns
- None
- Description
- Request enter external hibernate state
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Related APIs:
- XMC_SCU_GetMirrorStatus()
void XMC_SCU_HIB_EnterHibernateStateEx | ( | XMC_SCU_HIB_HIBERNATE_MODE_t | mode | ) |
- Parameters
-
mode hibernate mode XMC_SCU_HIB_HIBERNATE_MODE_t
- Returns
- None
- Description
- Request enter external hibernate state
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Related APIs:
- XMC_SCU_GetMirrorStatus()
int32_t XMC_SCU_HIB_GetEventStatus | ( | void | ) |
- Returns
- XMC_SCU_HIB_EVENT_t
- Description
- Returns status of hibernate wakeup events.
int32_t XMC_SCU_HIB_GetHibernateControlStatus | ( | void | ) |
- Returns
- XMC_SCU_HIB_CTRL_STATUS_t
- Description
- Returns status of the external hibernate control.
XMC_SCU_HIB_RTCCLKSRC_t XMC_SCU_HIB_GetRtcClockSource | ( | void | ) |
- Returns
- XMC_SCU_HIB_RTCCLKSRC_t Source of RTC clock.
Range: Use type XMC_SCU_HIB_RTCCLKSRC_t to identify the clock source.
XMC_SCU_HIB_RTCCLKSRC_OSI - internal slow oscillator(fOSI).
XMC_SCU_HIB_RTCCLKSRC_ULP - ultra low power oscillator(fULP).
- Description
- Provides the source of RTC clock (fRTC). The value is obtained by reading RCS bit of HDCR register. The frequency of the clock will be 32.768 kHz.
- Related APIs:
- XMC_SCU_HIB_SetRtcClockSource()
XMC_SCU_HIB_RTCCLKSRC_t XMC_SCU_HIB_GetStdbyClockSource | ( | void | ) |
- Returns
- XMC_SCU_HIB_RTCCLKSRC_t Source clock of standby clock(fSTDBY).
Range: Use type XMC_SCU_HIB_STDBYCLKSRC_t to identify the clock source.
XMC_SCU_HIB_STDBYCLKSRC_OSI - internal slow oscillator (fOSI)
XMC_SCU_HIB_STDBYCLKSRC_OSCULP - ultra low power osciallator (fULP)
- Description
- Provides the source of standby clock (fSTDBY).
The value is obtained by reading STDBYSEL bits of HDCR register.
bool XMC_SCU_HIB_IsHibernateDomainEnabled | ( | void | ) |
- Returns
- bool Power status of hibernate domain.
Range: Boolean state value.
true if hibernate domain is enabled.
false if hibernate domain is disabled.
- Description
- Checks whether hibernation domain is enabled/disabled.
The API can be used before using the peripherals from hibernation domain to ensure that the power is supplied to the peripherals and also that the hibernation domain is not in reset state. The status is obtained using the HIBEN bit of PWRSTAT register and HIBRS bit of RSTSET register.
bool XMC_SCU_HIB_IsWakeupEventDetected | ( | void | ) |
- Returns
- Detection of a wakeup from hibernate mode
- Description
- Detection of a wakeup from hibernate mode
void XMC_SCU_HIB_LPAC_ClearStatus | ( | int32_t | status | ) |
- Parameters
-
status HIB LPAC status. Values from XMC_SCU_HIB_LPAC_STATUS_t can be ORed.
- Returns
- None
- Description
- Clear status of HIB LPAC.
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Only available in XMC44, XMC42 and XMC41 series
int32_t XMC_SCU_HIB_LPAC_GetStatus | ( | void | ) |
- Returns
- HIB LPAC status XMC_SCU_HIB_LPAC_STATUS_t
- Description
- Return status of HIB LPAC.
- Note
- Only available in XMC44, XMC42 and XMC41 series and in certain packages
void XMC_SCU_HIB_LPAC_SetHIBIO0Thresholds | ( | uint8_t | lower, |
uint8_t | upper | ||
) |
- Parameters
-
low HIB_IO_0 low threshold high HIB_IO_0 high threshold
- Returns
- None
- Description
- Select compare thresholds for HIB_IO_0. After the reset of HCU the upper threshold is applied to LPAC for all consecutive measurements until it has been crossed upwards. Once upper threshold crossed upwards the lower threshold gets applied and remains applied for all consecutive measuremements until it has been crossed downwards and the threshold values gets swapped again.
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Only available in XMC44, XMC42 and XMC41 series
void XMC_SCU_HIB_LPAC_SetHIBIO1Thresholds | ( | uint8_t | lower, |
uint8_t | upper | ||
) |
- Parameters
-
low HIB_IO_1 low threshold high HIB_IO_1 high threshold
- Returns
- None
- Description
- Select compare thresholds for HIB_IO_1. After the reset of HCU the upper threshold is applied to LPAC for all consecutive measurements until it has been crossed upwards. Once upper threshold crossed upwards the lower threshold gets applied and remains applied for all consecutive measuremements until it has been crossed downwards and the threshold values gets swapped again.
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Only available in XMC44 series and LQFP100 package
void XMC_SCU_HIB_LPAC_SetInput | ( | XMC_SCU_HIB_LPAC_INPUT_t | input | ) |
- Parameters
-
input LPAC compare input. Values from XMC_SCU_HIB_LPAC_INPUT_t can be ORed.
- Returns
- None
- Description
- Selects inputs to the LPAC comparator. Several inputs can be selected (time multiplexing).
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Only available in XMC44, XMC42 and XMC41 series
void XMC_SCU_HIB_LPAC_SetTiming | ( | bool | enable_delay, |
uint16_t | interval_count, | ||
uint8_t | settle_count | ||
) |
- Parameters
-
enable_delay Enable conversion delay interval_count compare interval (interval_count + 16) * 1/32768 (s) settle_count settleing time of LPAC after powered up (triggered) before measurement start (settle_count + 1) * 1/32768 (s)
- Returns
- None
- Description
- Configures timing behavior of comparator.
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Only available in XMC44, XMC42 and XMC41 series
void XMC_SCU_HIB_LPAC_SetTrigger | ( | XMC_SCU_HIB_LPAC_TRIGGER_t | trigger | ) |
- Parameters
-
trigger LPAC compare trigger
- Returns
- None
- Description
- Selects trigger mechanism to start a comparison.
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Only available in XMC44, XMC42 and XMC41 series
void XMC_SCU_HIB_LPAC_SetVBATThresholds | ( | uint8_t | lower, |
uint8_t | upper | ||
) |
- Parameters
-
low VBAT low threshold high VBAT high threshold
- Returns
- None
- Description
- Select compare thresholds for VBAT. After the reset of HCU the upper threshold is applied to LPAC for all consecutive measurements until it has been crossed upwards. Once upper threshold crossed upwards the lower threshold gets applied and remains applied for all consecutive measuremements until it has been crossed downwards and the threshold values gets swapped again.
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Only available in XMC44, XMC42 and XMC41 series
void XMC_SCU_HIB_LPAC_TriggerCompare | ( | XMC_SCU_HIB_LPAC_INPUT_t | input | ) |
- Parameters
-
input LPAC compare input. Values from XMC_SCU_HIB_LPAC_INPUT_t can be ORed.
- Returns
- None
- Description
- Trigger comparasion on the selected inputs.
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Only available in XMC44, XMC42 and XMC41 series
void XMC_SCU_HIB_SetInput0 | ( | XMC_SCU_HIB_IO_t | pin | ) |
- Parameters
-
pin Hibernate domain dedicated pin XMC_SCU_HIB_IO_t
- Returns
- None
- Description
- Selects input to ERU0 module (HIB_SR0) that optionally can be used with software as a general purpose input.
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Related APIs:
- XMC_SCU_HIB_SetSR0Input(), XMC_SCU_GetMirrorStatus()
void XMC_SCU_HIB_SetPinMode | ( | XMC_SCU_HIB_IO_t | pin, |
XMC_SCU_HIB_PIN_MODE_t | mode | ||
) |
- Parameters
-
pin Hibernate domain dedicated pin XMC_SCU_HIB_IO_t mode Hibernate domain dedicated pin mode XMC_SCU_HIB_PIN_MODE_t
- Returns
- None
- Description
- Selects mode of hibernate domain dedicated pins HIB_IOx
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Related APIs:
- XMC_SCU_GetMirrorStatus()
void XMC_SCU_HIB_SetPinOutputLevel | ( | XMC_SCU_HIB_IO_t | pin, |
XMC_SCU_HIB_IO_OUTPUT_LEVEL_t | level | ||
) |
- Parameters
-
pin Hibernate domain dedicated pin XMC_SCU_HIB_IO_t level Output polarity of the hibernate domain dedicated pins HIB_IOx XMC_SCU_HIB_IO_OUTPUT_LEVEL_t
- Returns
- None
- Description
- Selects the output polarity of the hibernate domain dedicated pins HIB_IOx
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Related APIs:
- XMC_SCU_GetMirrorStatus()
void XMC_SCU_HIB_SetRtcClockSource | ( | const XMC_SCU_HIB_RTCCLKSRC_t | source | ) |
- Parameters
-
source Source of RTC clock.
Range: Use type XMC_SCU_HIB_RTCCLKSRC_t to identify the clock source.
XMC_SCU_HIB_RTCCLKSRC_OSI - internal slow oscillator(fOSI).
XMC_SCU_HIB_RTCCLKSRC_ULP - ultra low power oscillator(fULP).
- Returns
- None
- Description
- Selects the source of RTC clock (fRTC).
The value is configured to RCS bit of HDCR register. fULP needs external input powered by VBAT or VDDP. fOSI is internal clock. The frequency of the clock will be 32.768 kHz.
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Related APIs:
- XMC_SCU_HIB_GetRtcClockSource()
void XMC_SCU_HIB_SetSR0Input | ( | XMC_SCU_HIB_SR0_INPUT_t | input | ) |
- Parameters
-
input input signal HIB_SR0 of ERU0
- Returns
- None
- Description
- Selects input to ERU0 module (HIB_SR0).
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Related APIs:
- XMC_SCU_HIB_SetInput0(),XMC_SCU_GetMirrorStatus()
void XMC_SCU_HIB_SetStandbyClockSource | ( | const XMC_SCU_HIB_STDBYCLKSRC_t | source | ) |
- Parameters
-
source Source for standby clock.
Range: Use type XMC_SCU_HIB_STDBYCLKSRC_t to identify the clock source.
XMC_SCU_HIB_STDBYCLKSRC_OSI - internal slow oscillator (fOSI)
XMC_SCU_HIB_STDBYCLKSRC_OSCULP - ultra low power osciallator (fULP)
- Returns
- None
- Description
- Selects the source of Standby clock (fSTDBY).
Clock source is configured by setting the STDBYSEL bits of HDCR register. Hibernate domain should be enabled explicitly before using the API.
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
void XMC_SCU_HIB_SetWakeupTriggerInput | ( | XMC_SCU_HIB_IO_t | pin | ) |
- Parameters
-
pin Hibernate domain dedicated pin XMC_SCU_HIB_IO_t
- Returns
- None
- Description
- Selects input for Wake-Up from Hibernate
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
- Related APIs:
- XMC_SCU_GetMirrorStatus()
void XMC_SCU_HIB_TriggerEvent | ( | int32_t | event | ) |
- Parameters
-
event Hibernate wakeup event XMC_SCU_HIB_EVENT_t
- Returns
- None
- Description
- Trigger hibernate wakeup event
- Note
- The register update in HIB domain is indicated by the MIRRST register which can be polled using XMC_SCU_GetMirrorStatus()
bool XMC_SCU_HighTemperature | ( | void | ) |
- Returns
- bool Indicates if the measured die temperature value has exceeded the configured upper limit.
Range: true if the temperature value has exceeded the configured upper limit. false if the temperature value is less than the configured upper limit.
- Description
- Checks if the measured temperature has exceeded the configured upper limit of temperature.
The API checks OVERFL bit (Upper Limit Overflow Status bit) of DTEMPALARM register. The OVERFL bit will be set if the measured temperature has exceeded the limit configured in the bitfield UPPER in the DTEMPLIM register.
- Related APIs:
- XMC_SCU_SetRawTempLimits(),XMC_SCU_LowTemperature()
void XMC_SCU_INTERRUPT_ClearEventStatus | ( | const XMC_SCU_INTERRUPT_EVENT_t | event | ) |
- Parameters
-
event Bit mask of the events to clear. Range: Use type XMC_SCU_INTERRUPT_EVENT_t for providing the input value. Multiple events can be combined using the OR operation.
- Returns
- None
- Description
- Clears the event status bit in SRRAW register.
The events are cleared by writing value 1 to their bit positions in the SRCLR register. The API can be used when polling method is used. After detecting the event, the event status should be cleared using software to detect the event again.
void XMC_SCU_INTERRUPT_DisableEvent | ( | const XMC_SCU_INTERRUPT_EVENT_t | event | ) |
- Parameters
-
event Bit mask of the event to disable. Range: Use type XMC_SCU_INTERRUPT_EVENT_t for providing the input value. Multiple events can be combined using the OR operation.
- Returns
- None
- Description
- Disables generation of interrupt on occurrence of the input event.
The events are disabled by resetting the respective bit fields in the SRMSK register.
- Related APIs:
- NVIC_DisableIRQ(), XMC_SCU_INTERRUPT_EnableEvent()
void XMC_SCU_INTERRUPT_DisableNmiRequest | ( | const uint32_t | request | ) |
- Parameters
-
request Non-maskable interrupt (NMI) request source to be disabled.
Range: Use type XMC_SCU_NMIREQ_t for selecting the source of NMI. Multiple sources can be combined using OR operation.
- Returns
- None
- Description
- Selectively disables interrupt sources from generating non maskable interrupt(NMI).
NMI assertion can be individually disabled by clearing corresponding bits in the NMIREQEN register.
- Related APIs:
- XMC_SCU_INTERRUPT_EnableNmiRequest()
void XMC_SCU_INTERRUPT_EnableEvent | ( | const XMC_SCU_INTERRUPT_EVENT_t | event | ) |
- Parameters
-
event Bit mask of the event to enable. Range: Use type XMC_SCU_INTERRUPT_EVENT_t for providing the input value. Multiple events can be combined using the OR operation.
- Returns
- None
- Description
- Enables the generation of interrupt for the input events.
The events are enabled by setting the respective bit fields in the SRMSK register.
Note: User should separately enable the NVIC node responsible for handling the SCU interrupt. The interrupt will be generated when the respective event occurs.
- Related APIs:
- NVIC_EnableIRQ(), XMC_SCU_INTERRUPT_DisableEvent()
void XMC_SCU_INTERRUPT_EnableNmiRequest | ( | const uint32_t | request | ) |
- Parameters
-
request Non-maskable interrupt (NMI) request source to be enabled.
Range: Use type XMC_SCU_NMIREQ_t for selecting the source of NMI. Multiple sources can be combined using OR operation.
- Returns
- None
- Description
- Selectively enables interrupt sources to generate non maskable interrupt(NMI).
NMI assertion can be individually enabled by setting corresponding bit of an interrupt in the NMIREQEN register.
- Related APIs:
- XMC_SCU_INTERRUPT_DisableNmiRequest()
XMC_SCU_STATUS_t XMC_SCU_INTERRUPT_SetEventHandler | ( | const XMC_SCU_INTERRUPT_EVENT_t | event, |
const XMC_SCU_INTERRUPT_EVENT_HANDLER_t | handler | ||
) |
- Parameters
-
event The event for which the interrupt handler is to be configured.
Range: Use type XMC_SCU_INTERRUPT_EVENT_t for identifying the event.handler Name of the function to be executed when the event if detected.
Range: The function accepts no arguments and returns no value.
- Returns
- XMC_SCU_STATUS_t Status of configuring the event handler function for the selected event.
Range: XMC_SCU_STATUS_OK if the event handler is successfully configured.
XMC_SCU_STATUS_ERROR if the input event is invalid.
- Description
- Assigns the event handler function to be executed on occurrence of the selected event.
If the input event is valid, the handler function will be assigned to a table to be executed when the interrupt is generated and the event status is set in the event status register. By using this API, polling for a particular event can be avoided. This way the CPU utilization will be optimized. Multiple SCU events can generate a common interrupt. When the interrupt is generated, a common interrupt service routine is executed. It checks for status flags of events which can generate the interrupt. The handler function will be executed if the event flag is set.
void XMC_SCU_INTERRUPT_TriggerEvent | ( | const XMC_SCU_INTERRUPT_EVENT_t | event | ) |
- Parameters
-
event Bit mask of the event to be triggered. Range: Use type XMC_SCU_INTERRUPT_EVENT_t for providing the input value. Multiple events can be combined using the OR operation.
- Returns
- None
- Description
- Triggers the event as if the hardware raised it.
Event will be triggered by setting the respective bitfield in the SRSET register.
Note: User should enable the NVIC node that handles the respective event for interrupt generation.
- Related APIs:
- NVIC_EnableIRQ(), XMC_SCU_INTERUPT_GetEventStatus(), XMC_SCU_INTERRUPT_ClearEventStatus()
XMC_SCU_INTERRUPT_EVENT_t XMC_SCU_INTERUPT_GetEventStatus | ( | void | ) |
- Returns
- uint32_t Status of the SCU events.
- Description
- Provides the status of all SCU events.
The status is read from the SRRAW register. To check the status of a particular event, the returned value should be masked with the bit mask of the event. The bitmask of events can be obtained using the type XMC_SCU_INTERRUPT_EVENT_t. Multiple events' status can be checked by combining the bit masks using OR operation. After detecting the event, the event status should be cleared using software to detect the event again.
void XMC_SCU_IRQHandler | ( | uint32_t | sr_num | ) |
- Parameters
-
sr_num Service request number identifying the SCU interrupt generated.
Range: 0 to 2. XMC4x devices have one common SCU interrupt, so the value should be 0.
But XMC1x devices support 3 interrupt nodes.
- Returns
- None
- Description
- A common function to execute callback functions for multiple events.
It checks for the status of events which can generate the interrupt with the selected service request. If the event is set, the corresponding callback function will be executed. It also clears the event status bit.
Note: This is an internal function. It should not be called by the user application.
- Related APIs:
- XMC_SCU_INTERRUPT_SetEventHandler()
bool XMC_SCU_IsTemperatureSensorBusy | ( | void | ) |
- Returns
- bool Indicates if the die temperature sensor is busy.
Range: true if sensor is busy in temperature measurement. false if sensor is free and can accept a new request for measurement.
- Description
- Checks whether Die Temperature Sensor (DTS) is busy in temperature measurement.
The status is read from the BUSY bit field of the DTSSTAT register.
- Related APIs:
- XMC_SCU_GetTemperatureMeasurement()
bool XMC_SCU_IsTemperatureSensorEnabled | ( | void | ) |
- Returns
- Status of die temperature sensor.
Range: true - if temperature sensor is enabled.
false - if temperature sensor is disabled.
- Description
- Provides the die temperature sensor power status.
The status is obtained by reading the PWD bit of DTSCON register.
bool XMC_SCU_IsTemperatureSensorReady | ( | void | ) |
- Returns
- bool Status of die temperature sensor whether it is ready to start measurement.
Range:
true if temperature sensor is ready to start measurement.
false if temperature sensor is not ready to start measurement.
- Description
- Checks if the die temperature sensor is ready to start a measurement
The status is obtained by reading RDY bit of DTSSTAT register. It is recommended to check the ready status of die temperature sensor before starting it.
bool XMC_SCU_LowTemperature | ( | void | ) |
- Returns
- bool Indicates if the measured die temperature value has dropped below the configured lower limit.
Range: true if the temperature value has dropped below the configured lower limit. false if the temperature value is higher than the configured lower limit.
- Description
- Checks if the measured temperature has dropped below the configured lower limit of temperature.
The API checks UNDERFL bit (Lower LimitUnderflow Status bit) of DTEMPALARM register. The UNDERFL bit will be set if the measured temperature has dropped below the limit configured in the bitfield LOWER in the DTEMPLIM register.
- Related APIs:
- XMC_SCU_SetRawTempLimits(),XMC_SCU_HighTemperature()
void XMC_SCU_PARITY_ClearStatus | ( | const uint32_t | memory | ) |
- Parameters
-
memory The on-chip RAM type, for which the parity error status has to be cleared.
Range: Use type XMC_SCU_PARITY_t to identify the on-chip RAM type. Multiple memory status bits can be cleared by using the OR operation.
- Returns
- None
- Description
- Clears the parity error status bit.
When a memory parity error is detected using the status bits in PEFLAG register. It has to be cleared by software to detect the parity error from the same memory next time. The API clears the parity error status bit of the selected peripheral by setting the respective bit in the PEFLAG register. Status of multiple memory parity errors can be cleared by combining the enum values using OR operation.
void XMC_SCU_PARITY_Disable | ( | const uint32_t | memory | ) |
- Parameters
-
memory The on-chip RAM type, for which the parity error checking has to be disabled.
Range: Use type XMC_SCU_PARITY_t to identify the on-chip RAM type. Multiple memory types can be combined using the OR operation.
- Returns
- None
- Description
- Disables parity error checking for the selected on-chip RAM type.
Parity error detection can be disabled by clearing the respective bit in the PEEN register.
void XMC_SCU_PARITY_DisableTrapGeneration | ( | const uint32_t | memory | ) |
- Parameters
-
memory The on-chip RAM type, for which the parity error trap generation has to be disabled.
Range: Use type XMC_SCU_PARITY_t to identify the on-chip RAM type. Multiple memory types can be combined using the OR operation.
- Returns
- None
- Description
- Disables the assertion of trap for the parity error source.
Trap assertion can be disabled by clearing the respective bit of the RAM type in the PETE register.
- Related APIs:
- XMC_SCU_PARITY_EnableTrapGeneration()
void XMC_SCU_PARITY_Enable | ( | const uint32_t | memory | ) |
- Parameters
-
memory The on-chip RAM type, for which the parity error checking has to be enabled.
Range: Use type XMC_SCU_PARITY_t to identify the on-chip RAM type. Multiple memory types can be combined using the OR operation.
- Returns
- None
- Description
- Enables parity error checking for the selected on-chip RAM type.
Parity error checking can be enabled by setting respective bits in the PEEN register. Additionally parity error can be configured to generate trap when the error is detected, using the API XMC_SCU_PARITY_EnableTrapGeneration(). Such a trap can be further configured to generate non maskable interrupt(NMI) using the API XMC_SCU_INTERRUPT_EnableNmiRequest().
void XMC_SCU_PARITY_EnableTrapGeneration | ( | const uint32_t | memory | ) |
- Parameters
-
memory The on-chip RAM type, for which the parity error trap generation has to be enabled.
Range: Use type XMC_SCU_PARITY_t to identify the on-chip RAM type. Multiple memory types can be combined using the OR operation.
- Returns
- None
- Description
- Enables trap assertion for the parity error source.
Parity error detection for different types of on-chip RAM can generate trap. Trap assertion for parity error can be individually enabled by setting the respective bits in the PETE register. The generated trap can be additionally configured to generate non maskable interrupt(NMI) using the API XMC_SCU_INTERRUPT_EnableNmiRequest().
uint32_t XMC_SCU_PARITY_GetStatus | ( | void | ) |
- Returns
- uint32_t Status of parity error detection for the on-chip RAM modules.
Range: Use type XMC_SCU_PARITY_t to get the bit mask of each RAM module type.
- Description
- Provides the status of parity error detection for the on-chip RAM modules.
Parity error status information is obtained from the PEFLAG register. If a particular RAM module has parity error, its respective bit field will be set to 1 in the returned value. A check for the status of a particular RAM module can be done by masking the returned value with the RAM module identifier from the type XMC_SCU_PARITY_t.
- Related APIs:
- XMC_SCU_PARITY_ClearStatus()
void XMC_SCU_POWER_DisableMonitor | ( | void | ) |
- Returns
- None
Disable power monitoring control register for brown-out detection.
void XMC_SCU_POWER_DisableUsb | ( | void | ) |
- Returns
- None
- Description
- Disables the USB PHY and also OTG comparator if available.
Configures the USBPHYPDQ bit of PWRSET register to move the USB PHY to power down state. If USB OTG is available in the device, the USBOTGEN bit of PWRSET register is set to 0. This disables the USB on the go comparators.
- Related APIs:
- XMC_SCU_POWER_EnableUsb(), XMC_SCU_CLOCK_SetUsbClockSource()
void XMC_SCU_POWER_EnableMonitor | ( | uint8_t | threshold, |
uint8_t | interval | ||
) |
- Parameters
-
threshold Threshold value for comparison to VDDP for brownout detection. LSB33V is 22.5mV interval Interval value for comparison to VDDP expressed in cycles of system clock
- Returns
- None
Enable power monitoring control register for brown-out detection. Brown Out Trap need to be enabled using XMC_SCU_TRAP_Enable() and event handling done in NMI_Handler.
- Related APIs:
- XMC_SCU_TRAP_Enable()
void XMC_SCU_POWER_EnableUsb | ( | void | ) |
- Returns
- None
- Description
- Enables the USB PHY and also OTG comparator if available.
Configures the USBPHYPDQ bit of PWRSET register to move the USB PHY from power down state. If USB OTG is available in the device, the USBOTGEN bit of PWRSET register is set to 1. This enables the USB on the go comparators.
- Related APIs:
- XMC_SCU_POWER_DisableUsb(), XMC_SCU_CLOCK_SetUsbClockSource()
float XMC_SCU_POWER_GetEVR13Voltage | ( | void | ) |
- Returns
- EVR13 voltage in volts
- Description
- Returns EVR13 voltage in volts.
float XMC_SCU_POWER_GetEVR33Voltage | ( | void | ) |
- Returns
- EVR33 voltage in volts
- Description
- Returns EVR33 voltage in volts
int32_t XMC_SCU_POWER_GetEVRStatus | ( | void | ) |
- Returns
- XMC_SCU_POWER_EVR_STATUS_t
- Description
- Returns status of the EVR13.
void XMC_SCU_POWER_WaitForEvent | ( | XMC_SCU_POWER_MODE_t | mode | ) |
- Parameters
-
mode Low power mode
- Returns
- None
- Description
- Enter selected low power mode and wait for event
void XMC_SCU_POWER_WaitForInterrupt | ( | XMC_SCU_POWER_MODE_t | mode, |
bool | sleep_on_exit | ||
) |
- Parameters
-
mode Low power mode
sleep_on_exit Enter sleep, or deep sleep, on return from an ISR
- Returns
- None
- Description
- Enter selected low power mode and wait for interrupt
uint32_t XMC_SCU_ReadFromRetentionMemory | ( | uint32_t | address | ) |
- Parameters
-
address Location in the retention memory to be read.
Range: 4 bit address space is provided for selecting 16 words of 32 bits. equivalent to 64 bytes of data. address value should be from 0 to 15.
- Returns
- uint32_t 32 bit data read from retention memory. The API reads one word(4 bytes) of data from the address specified.
Range: 32 bit data.
- Description
- Reads data from selected address of retention memory in hibernate domain.
The retention memory is located in hibernate domain. It is used for the purpose of store/restore of context information. Access to the retention memory space is served over shared serial interface. Retention memory content is retained even in hibernate mode.
- Related APIs:
- XMC_SCU_WriteToRetentionMemory()
uint32_t XMC_SCU_ReadGPR | ( | const uint32_t | index | ) |
- Parameters
-
index The SCU general purpose register to be read.
Range: 0 and 1 corresponding to GPR0 and GPR1.
- Returns
- uint32_t Data read from the selected general purpose register.
- Description
- Provides stored data from general purpose SCU register.
SCU consists of 2 general purpose registers. These registers can be used for storing data. The API reads from either GPR0 or GPR1 based on the index value.
- Related APIs:
- XMC_SCU_WriteGPR()
void XMC_SCU_RESET_AssertPeripheralReset | ( | const XMC_SCU_PERIPHERAL_RESET_t | peripheral | ) |
- Parameters
-
peripheral The peripheral to be reset.
Range: Type XMC_SCU_PERIPHERAL_RESET_t enumerates all the peripherals that can be reset.
- Returns
- None
- Description
- Puts the specified peripheral in to reset state.
The API achieves reset of peripherals by setting the respective bit in the PRSET0, PRSET1 or PRSET2 register. Status of reset assertion automatically stored in the PRSTATn register and can be checked by user software to determine the state of the system and for debug purpose.
It is recommended to use following steps to assert a peripheral reset:
- Call XMC_SCU_RESET_AssertPeripheralReset() with desired peripheral identifier.
- Call XMC_SCU_RESET_IsPeripheralResetAsserted with same peripheral identifier to verify whether peripheral is in reset state.
- Call XMC_SCU_RESET_AssertPeripheralReset() with desired peripheral identifier.
- Related APIs:
- XMC_SCU_RESET_IsPeripheralResetAsserted()
void XMC_SCU_RESET_ClearDeviceResetReason | ( | void | ) |
- Returns
- None
- Description
- Clears the reset reason bits in the reset status register.
Clearing of the reset status information in the SCU_RSTSTAT register via register bit RSTCLR.RSCLR is strongly recommended to ensure a clear indication of the cause of next reset.
- Related APIs:
- XMC_SCU_RESET_GetDeviceResetReason()
void XMC_SCU_RESET_DeassertPeripheralReset | ( | const XMC_SCU_PERIPHERAL_RESET_t | peripheral | ) |
- Parameters
-
peripheral The peripheral to be moved out of reset state.
Range: Type XMC_SCU_PERIPHERAL_RESET_t enumerates all the peripherals that can be reset.
- Returns
- None
- Description
- Enables the specified peripheral by moving it out of reset state.
Any peripheral should be moved out of reset state for executing its functionality. The API enables the peripheral by setting its respective bit in the PRCLR0, PRCLR1 or PRCLR2 register. Status of reset deassertion is automatically stored in the PRSTATn register and can be checked by the user software to determine the state of the system and for debug purpose.
It is recommended to use following steps to deassert a peripheral reset:
- Call XMC_SCU_RESET_DeassertPeripheralReset() with desired peripheral identifier.
- Call XMC_SCU_RESET_IsPeripheralResetAsserted() with desired peripheral identifier to verify whether peripheral has been enabled.
- Call XMC_SCU_RESET_DeassertPeripheralReset() with desired peripheral identifier.
- Related APIs:
- XMC_SCU_RESET_AssertPeripheralReset()
uint32_t XMC_SCU_RESET_GetDeviceResetReason | ( | void | ) |
- Returns
- uint32_t Status representing the reason for device reset.
- Description
- Provides the value representing the reason for device reset.
The return value is an encoded word, which can indicate multiple reasons for the last reset. Each bit position of the returned word is representative of a last reset cause. The returned value should be appropriately masked to check the cause of reset. The cause of the last reset gets automatically stored in the SCU_RSTSTAT register. The reset status shall be reset after each startup in order to ensure consistent source indication after the next reset. Range: The type XMC_SCU_RESET_REASON_t can be used to get the bit masks of the reset cause.
- Related APIs:
- XMC_SCU_RESET_ClearDeviceResetReason()
bool XMC_SCU_RESET_IsPeripheralResetAsserted | ( | const XMC_SCU_PERIPHERAL_RESET_t | peripheral | ) |
- Parameters
-
peripheral The peripheral, whose reset status has to be checked.
Range: Type XMC_SCU_PERIPHERAL_RESET_t enumerates all the peripherals.
- Returns
- bool Status of peripheral reset.
Range: true if peripheral is in reset state. false if peripheral is enabled and out of reset state.
- Description
- Checks the reset status of the selected peripheral.
The API reads the reset status from PRSTATn register. Returns true if the peripheral is in reset state. On power up of the device, all the peripherals will be in reset state. If the peripheral is enabled, false will be returned as the status.
void XMC_SCU_SetBootMode | ( | const XMC_SCU_BOOTMODE_t | mode | ) |
- Parameters
-
mode Boot mode to be configured for the device.
Range: Use type XMC_SCU_BOOTMODE_t for selecting the boot mode.
- Returns
- None
- Description
- Configures the desired boot mode for the device.
The XMC4 series devices support multiple boot modes. A running application can set a desired bootmode and launch it by means of software reset. Switching of boot modes should be handled carefully. User should ensure that the initial boot sequence is executed. A stable execution environment should be maintained when program control is eventually handed over to the application program.
It is recommended to use following steps to launch requested bootmode:
- Call XMC_SCU_SetBootMode() with desired boot mode value.
- Trigger a software reset using system reset request by enabling a bit SYSRESETREQ of AIRCR register (PPB->AIRCR |= PPB_AIRCR_SYSRESETREQ_Msk).
- Call XMC_SCU_SetBootMode() with desired boot mode value.
- Related APIs:
- XMC_SCU_GetBootMode()
void XMC_SCU_SetCcuTriggerHigh | ( | const uint32_t | trigger | ) |
- Parameters
-
trigger CCU slices to be triggered synchronously via software. The value is a bitmask of CCU slice bits in the register CCUCON.
Range: Use type XMC_SCU_CCU_TRIGGER_t for bitmask of individual CCU slices. Multiple slices can be combined using OR operation.
- Returns
- None
- Description
- Generates active edge(low to high) trigger for multiple CCU units at the same time.
Before executing this API, all the required CCU timers should configure external start. The edge of the start signal should be selected as active edge. The input signal for the CCU slice should be selected as SCU input. The above mentioned configurations can be made using the CCU LLD API XMC_CCU4_SLICE_StartConfig(). CCU timer slice should be started using XMC_CCU4_SLICE_StartTimer() before triggering the timer using this API.
void XMC_SCU_SetCcuTriggerLow | ( | const uint32_t | trigger | ) |
- Parameters
-
trigger CCU slices to be triggered synchronously via software. The value is a bitmask of CCU slice bits in the register CCUCON.
Range: Use type XMC_SCU_CCU_TRIGGER_t for bitmask of individual CCU slices. Multiple slices can be combined using OR operation.
- Returns
- None
- Description
- Generates passive edge(high to low) trigger for multiple CCU units at the same time.
Before executing this API, all the required CCU timers should configure external start. The edge of the start signal should be selected as passive edge. The input signal for the CCU slice should be selected as SCU input. The above mentioned configurations can be made using the CCU LLD API XMC_CCU4_SLICE_StartConfig(). CCU timer slice should be started using XMC_CCU4_SLICE_StartTimer() before triggering the timer using this API.
void XMC_SCU_SetRawTempLimits | ( | const uint32_t | lower_temp, |
const uint32_t | upper_temp | ||
) |
- Parameters
-
lower_temp Lower threshold of die temperature. If measured temperature falls below this value, alarm bit will be set in UNDERFL bit field of DTEMPALARM register. upper_temp Upper threshold of die temperature. If measured temperature exceeds this value, alarm bit will be set in OVERFL bit field of DTEMPALARM register.
- Returns
- None
- Description
- Configures the lower and upper threshold of die temperature.
API configures DTEMPLIM register for upper and lower die temperature threshold limits. When the measured temperature is outside the range defined by the limits, alarm bits UNDERFL or OVERFL will be set in the register DTEMPALARM.
It is recommended to use following steps:
- Call XMC_SCU_StopTempMeasurement to stop temperature measurement if it was started previously.
- Call XMC_SCU_SetRawTempLimits with desired lower and upper temperature threshold limit values.
- Call XMC_SCU_StartTempMeasurement to start temperature measurement.
- Use XMC_SCU_HighTemperature() and XMC_SCU_LowTemperature() to monitor the temperature.
- Call XMC_SCU_StopTempMeasurement to stop temperature measurement if it was started previously.
- Related APIs:
- XMC_SCU_HighTemperature(), XMC_SCU_LowTemperature()
XMC_SCU_STATUS_t XMC_SCU_StartTemperatureMeasurement | ( | void | ) |
- Returns
- XMC_SCU_STATUS_t Result of starting the temperature measurement.
Range:
XMC_SCU_STATUS_OK if the measurement is started successfully.
XMC_SCU_STATUS_ERROR if temperature sensor is not enabled.
XMC_SCU_STATUS_BUSY if temperature sensor is busy measuring the temperature.
- Description
- Starts die temperature measurement using internal temperature sensor.
The API checks if the temperature sensor is enabled and is not busy in measurement.
It is recommended to use following steps:
- Call XMC_SCU_StopTempMeasurement to stop temperature measurement if it was started previously.
- Call XMC_SCU_SetRawTempLimits with desired lower and upper temperature threshold limit values if it is needed.
- Call XMC_SCU_StartTempMeasurement to start temperature measurement.
- Check whether Die Temperature Sensor (DTS) is busy in conversion by calling XMC_SCU_IsTemperatureSensorBusy() and wait till conversion complete.
- Read the die temperature value using XMC_SCU_GetTemperatureMeasurement API.
- Call XMC_SCU_StopTempMeasurement to stop temperature measurement if it was started previously.
void XMC_SCU_TRAP_ClearStatus | ( | const uint32_t | trap | ) |
- Parameters
-
trap The event for which, trap status bit has to be cleared.
Range: Use type XMC_SCU_TRAP_t to identify the event.
- Returns
- None
- Description
- Clears the trap status of input event.
Once a trap event is detected, it will have to be acknowledged and later serviced. The trap status bit should be cleared to detect the occurence of trap next time. This is useful while polling for TRAPSTAT without enabling the NMI for trap. Trap status can be cleared by setting the event bit in the TRAPCLR register.
- Related APIs:
- XMC_SCU_INTERRUPT_EnableNmiRequest(), XMC_SCU_TRAP_GetStatus()
void XMC_SCU_TRAP_Disable | ( | const uint32_t | trap | ) |
- Parameters
-
trap The event for which, trap generation has to be disabled.
Range: Use type XMC_SCU_TRAP_t to identify the event.
- Returns
- None
- Description
- Disables assertion of trap for the selected trap event.
Trap assertion can be individually disabled by setting the respective event bit in the TRAPDIS register in order to suppress trap generation.
void XMC_SCU_TRAP_Enable | ( | const uint32_t | trap | ) |
- Parameters
-
trap The event for which, trap generation has to be enabled.
Range: Use type XMC_SCU_TRAP_t to identify the event.
- Returns
- None
- Description
- Enables assertion of trap for the selected trap event.
Trap assertion can be individually enabled by clearing respective bit of the event in TRAPDIS register in order to get an exception.
uint32_t XMC_SCU_TRAP_GetStatus | ( | void | ) |
- Returns
- uint32_t Status of trap generating events.
Range: Use type XMC_SCU_TRAP_t to identify the event. The returned value indicates the status of multiple events at their respective bit positions. User should mask the bits of the events of interest using the type specified.
- Description
- Provides the status of trap generating events.
The status is read from TRAPRAW register. Status of the specific events can be checked using their respective bits in the TRAPRAW register. The bit masks can be obtained from the enumeration type XMC_SCU_TRAP_t. Multiple events can be combined using OR operation. A trap event is considered to be asserted if the respective bit of the event is set to 1.
void XMC_SCU_TRAP_Trigger | ( | const uint32_t | trap | ) |
- Parameters
-
trap The event for which, trap has to be triggered.
Range: Use type XMC_SCU_TRAP_t to identify the event.
- Returns
- None
- Description
- Triggers trap generation for the event specified.
The trap source has to be enabled before invocation of this API. Trap event can be triggered by setting its respective bit in the TRAPSET register. Trap event can be configured to generate a non maskable interrupt by using the API XMC_SCU_INTERRUPT_EnableNmiRequest().
It is recommended to use following steps to manually assert a trap event:
- Call XMC_SCU_TRAP_EnableEvent with desired trap request source ID.
- Call XMC_SCU_TRAP_SetEvent with same trap request source ID to manually assert a trap event.
- Call XMC_SCU_TRAP_EnableEvent with desired trap request source ID.
- Related APIs:
- XMC_SCU_INTERRUPT_EnableNmiRequest(), XMC_SCU_TRAP_GetStatus()
void XMC_SCU_WriteGPR | ( | const uint32_t | index, |
const uint32_t | data | ||
) |
- Parameters
-
index The SCU general purpose register to be written.
Range: 0 and 1 corresponding to GPR0 and GPR1.data Data to be written to the selected general purpose register.
- Returns
- None
- Description
- Stores data in the selected general purpose SCU register.
SCU consists of 2 general purpose registers. These registers can be used for storing data. The API writes data to either GPR0 or GPR1 based on the index value.
- Related APIs:
- XMC_SCU_ReadGPR()
void XMC_SCU_WriteToRetentionMemory | ( | uint32_t | address, |
uint32_t | data | ||
) |
- Parameters
-
address Location in the retention memory to be written.
Range: 4 bit address space is provided for selecting 16 words of 32 bits. equivalent to 64 bytes of data. address value should be from 0 to 15.data 32 bit data to be written into retention memory. The API writes one word(4 bytes) of data to the address specified.
Range: 32 bit data.
- Returns
- None
- Description
- Writes input data to the selected address of Retention memory in hibernate domain.
The retention memory is located in hibernate domain. It is used for the purpose of store/restore of context information. Access to the retention memory space is served over shared serial interface. Retention memory content is retained even in hibernate mode.
- Related APIs:
- XMC_SCU_ReadFromRetentionMemory()
Generated on Mon Aug 7 2017 11:33:57 for XMC Peripheral Library for XMC4000 Family by 1.8.11