XMC Peripheral Library for XMC4000 Family
2.1.16
|
Data Structures | |
struct | XMC_CCU4_SLICE_CAPTURE_CONFIG_t |
struct | XMC_CCU4_SLICE_COMPARE_CONFIG_t |
struct | XMC_CCU4_SLICE_EVENT_CONFIG_t |
Typedefs | |
typedef CCU4_GLOBAL_TypeDef | XMC_CCU4_MODULE_t |
typedef uint8_t | XMC_CCU4_SLICE_INPUT_t |
typedef CCU4_CC4_TypeDef | XMC_CCU4_SLICE_t |
Enumerations |
Detailed Description
The CCU4 peripheral is a major component for systems that need general purpose timers for signal monitoring/conditioning and Pulse Width Modulation (PWM) signal generation. Power electronic control systems like switched mode power supplies or interruptible power supplies, can easily be implemented with the functions inside the CCU4 peripheral.
Each CCU4 module is comprised of four identical 16 bit Capture/Compare Timer slices, CC4y (where y = [0..4]). Each timer slice can work in compare mode or in capture mode.
APIs provided in this file cover the following functional blocks of CCU4:
– Timer configuration, Capture configuration, Function/Event configuration, Interrupt configuration
- Note:
- SLICE (APIs prefixed with e.g. XMC_CCU4_SLICE_)
- Module (APIs are not having any prefix e.g. XMC_CCU4_)
- Timer(Compare mode) configuration:
- This section of the LLD provides the configuration structure XMC_CCU4_SLICE_COMPARE_CONFIG_t and the initialization function XMC_CCU4_SLICE_CompareInit().
It can be used to:
- Start and Stop the timer. (XMC_CCU4_SLICE_StartTimer(), XMC_CCU4_SLICE_StopTimer())
- Update the period, compare, Dither, Prescaler and Passive values. (XMC_CCU4_SLICE_SetTimerPeriodMatch(), XMC_CCU4_SLICE_SetTimerCompareMatch(), XMC_CCU4_SLICE_SetPrescaler(), XMC_CCU4_SLICE_SetDitherCompareValue(), XMC_CCU4_SLICE_SetPassiveLevel())
- Enable the slices to support multichannel mode. (XMC_CCU4_SLICE_EnableMultiChannelMode())
- Capture configuration:
- This section of the LLD provides the configuration structure XMC_CCU4_SLICE_CAPTURE_CONFIG_t and the initialization function XMC_CCU4_SLICE_CaptureInit().
It can be used to:
- Configure the capture functionality. (XMC_CCU4_SLICE_Capture0Config(), XMC_CCU4_SLICE_Capture1Config())
- Read the captured values along with the status, which indicate the value is latest or not. (XMC_CCU4_SLICE_GetCaptureRegisterValue())
- Function/Event configuration:
- This section of the LLD provides the configuration structure XMC_CCU4_SLICE_EVENT_CONFIG_t.
It can be used to:- Enable and Disable the events. (XMC_CCU4_SLICE_EnableEvent(), XMC_CCU4_SLICE_DisableEvent())
- Configure to start and stop the timer on external events.(XMC_CCU4_SLICE_StartConfig(), XMC_CCU4_SLICE_StopConfig())
- Modulation, external load and Gating of the timer output.(XMC_CCU4_SLICE_ModulationConfig(), XMC_CCU4_SLICE_LoadConfig(), XMC_CCU4_SLICE_GateConfig())
- Control the count direction of the timer based on the external event. (XMC_CCU4_SLICE_DirectionConfig())
- Count the external events.(XMC_CCU4_SLICE_CountConfig())
- External Trap. Which can be used as protective feature.(XMC_CCU4_SLICE_EnableTrap(), XMC_CCU4_SLICE_DisableTrap(), XMC_CCU4_SLICE_TrapConfig())
- Interrupt configuration:
- This section of the LLD provides the function to configure the interrupt node to each event (XMC_CCU4_SLICE_SetInterruptNode())
Typedef Documentation
typedef CCU4_GLOBAL_TypeDef XMC_CCU4_MODULE_t |
Typedef for CCU4 Global data structure
typedef uint8_t XMC_CCU4_SLICE_INPUT_t |
External Event Input list. This list depicts the possible input connections to the CCU4 slice. Interconnects are specific to each device.
typedef CCU4_CC4_TypeDef XMC_CCU4_SLICE_t |
Typedef for CCU4 Slice data structure
Enumeration Type Documentation
enum XMC_CCU4_CLOCK_t |
CCU4 set the shadow transfer type for multichannel mode
Slice shadow transfer options.
Automatic Shadow Transfer request when writing into shadow register
- Note
- Only available for XMC1400 series
Actions that can be performed upon detection of an external Timer STOP event
External Event trigger criteria - Edge sensitivity
Low pass filter Configuration. The External Event input should be stable for a selected number of clock cycles.
External Event trigger criteria - Level sensitivity
External Function list
Available Interrupt Event Ids
Multi Channel Shadow transfer request configuration options
Available Interrupt Event Ids, which is added to support multi event APIs
Timer clock Divider
Slice shadow transfer mode options.
- Note
- Only available for XMC1400 series
Service Request Lines for CCU4. Event are mapped to these SR lines and these are used to generate the interrupt.
Timer clear on capture
Immediate write into configuration register
- Note
- Only available for XMC1400 series
enum XMC_CCU4_STATUS_t |
Function Documentation
void XMC_CCU4_DisableClock | ( | XMC_CCU4_MODULE_t *const | module, |
const uint8_t | slice_number | ||
) |
- Parameters
-
module Constant pointer to CCU4 module slice_number Slice for which the clock should be disabled. Range: [0x0 to 0x3]
- Returns
None
- Description:
- Disables the slice timer clock, by configuring GIDLS.SS0I, GIDLS.SSS1I, GIDLS.SSS2I, GIDLS.SSS3I bits according to the selected slice_number .
It is possible to disable clock at slice level using the module pointer. slice_number is used to disable the clock to a given slice of the module. Directly accessed Register is GIDLS.
void XMC_CCU4_DisableModule | ( | XMC_CCU4_MODULE_t *const | module | ) |
- Parameters
-
module Constant pointer to CCU4 module
- Returns
None
- Description:
- Brings the CCU4 module to reset state and enables gating of the clock signal(if applicable depending on the device being selected).
Invoke this API when a CCU4 module needs to be disabled completely. Any operation on the CCU4 module will have no effect after this API is called.
- Related APIs:
- XMC_CCU4_EnableModule()
XMC_CCU4_DisableModule().
void XMC_CCU4_EnableClock | ( | XMC_CCU4_MODULE_t *const | module, |
const uint8_t | slice_number | ||
) |
- Parameters
-
module Constant pointer to CCU4 module slice_number Slice for which the clock should be Enabled. Range: [0x0 to 0x3]
- Returns
None
- Description:
- Enables the slice timer clock, by configuring GIDLC.CS0I, GIDLC.CS1I, GIDLC.CS2I, GIDLC.CS3I bits according to the selected slice_number.
It is possible to enable/disable clock at slice level. This uses the slice_number to indicate the slice whose clock needs to be enabled.
void XMC_CCU4_EnableModule | ( | XMC_CCU4_MODULE_t *const | module | ) |
- Parameters
-
module Constant pointer to CCU4 module
- Returns
None
- Description:
- Enables the CCU4 module and brings it to active state.
Also disables the gating of the clock signal (if applicable depending on the device being selected). Invoke this API before any operations are done on the CCU4 module. Invoked from XMC_CCU4_Init().
void XMC_CCU4_EnableMultipleClocks | ( | XMC_CCU4_MODULE_t *const | module, |
const uint8_t | clock_mask | ||
) |
- Parameters
-
module Constant pointer to CCU4 module clock_mask Slices whose clocks are to be enabled simultaneously. Bit location 0/1/2/3 represents slice-0/1/2/3 respectively. Range: [0x1 to 0xF]
- Returns
None
- Description:
- Enables clocks of multiple slices at a time, by configuring GIDLC.CS0I, GIDLC.CS1I, GIDLC.CS2I, GIDLC.CS3I bits.
Takes an input clock_mask, which determines the slices that would receive the clock. Bring them out of the idle state simultaneously.
- Related APIs:
- XMC_CCU4_EnableClock()
XMC_CCU4_DisableClock().
void XMC_CCU4_EnableShadowTransfer | ( | XMC_CCU4_MODULE_t *const | module, |
const uint32_t | shadow_transfer_msk | ||
) |
- Parameters
-
module Constant pointer to CCU4 module shadow_transfer_msk Shadow transfer request mask for various transfers. Use XMC_CCU4_SHADOW_TRANSFER_t enum items to create a mask of choice, using a bit wise OR operation.
- Returns
None
- Description:
- Requests of shadow transfer for Period, Compare, Passive level, dither and prescaler, by configuring the GCSS register.
The transfer from the shadow registers to the actual registers is done in the immediate next occurrence of the shadow transfer trigger after the API is called.
Any call to XMC_CCU4_SLICE_SetTimerPeriodMatch()
XMC_CCU4_SLICE_SetTimerCompareMatch()
XMC_CCU4_SLICE_SetPrescaler()
XMC_CCU4_SLICE_CompareInit()
XMC_CCU4_SLICE_CaptureInit(). must be succeeded by this API. Directly accessed Register is GCSS.
- Related APIs:
- None.
void XMC_CCU4_Init | ( | XMC_CCU4_MODULE_t *const | module, |
const XMC_CCU4_SLICE_MCMS_ACTION_t | mcs_action | ||
) |
- Parameters
-
module Constant pointer to CCU4 module mcs_action multi-channel shadow transfer request configuration
- Returns
None
- Description:
- Initialization of global register GCTRL.
As part of module initialization, behaviour of the module upon detection Multi-Channel Mode trigger is configured. Will also invoke the XMC_CCU4_EnableModule(). The API call would bring up the required CCU4 module and also initialize the module for the required multi-channel shadow transfer.
- Related APIs:
- XMC_CCU4_SLICE_CompareInit()
XMC_CCU4_SLICE_CaptureInit().
bool XMC_CCU4_IsPrescalerRunning | ( | XMC_CCU4_MODULE_t *const | module | ) |
- Parameters
-
module Constant pointer to CCU4 module
- Returns
None
- Description:
- Returns the state of the prescaler, by reading GSTAT.PRB bit.
This will return true if the prescaler is running. If clock is being supplied to the slices of the module then returns as true.
void XMC_CCU4_SetModuleClock | ( | XMC_CCU4_MODULE_t *const | module, |
const XMC_CCU4_CLOCK_t | clock | ||
) |
- Parameters
-
module Constant pointer to CCU4 module clock Choice of input clock to the module
- Returns
None
- Description:
- Selects the Module Clock by configuring GCTRL.PCIS bits.
There are 3 potential clock sources. This API helps to select the required clock source. Call to this API is valid after the XMC_CCU4_Init().
- Related APIs:
- None.
void XMC_CCU4_SetMultiChannelShadowTransferMode | ( | XMC_CCU4_MODULE_t *const | module, |
const uint32_t | slice_mode_msk | ||
) |
- Parameters
-
module Constant pointer to CCU4 module slice_mode_msk Slices for which the configuration has to be applied. Use XMC_CCU4_MULTI_CHANNEL_SHADOW_TRANSFER_t enum items to create a mask of choice, using a bit wise OR operation.
- Returns
None
- Description:
- Enables the Multi-channel shadow transfer request trigger signal either by software or hardware by configuring GCTRL.MSE0, GCTRL.MSE1, GCTRL.MSE2, and GCTRL.MSE3 based on the mask.
The shadow transfer would take place either if it was requested by software or by the CCU4x.MCSS input.
- Related APIs:
- None.
void XMC_CCU4_SLICE_Capture0Config | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_EVENT_t | event | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Map an External event to the Capture-0 Function
- Returns
None
- Description:
- Configures the Capture-0 Function of the slice, by configuring CC4yCMC.CAP0S bit.
Capture function is mapped with one of the 3 events. A CCU4 slice can be configured into capture-0 mode with the selected event. In this mode the CCU4 will capture the timer value into CC4yC0V and CC4yC1V.
- Related APIs:
- XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput().
void XMC_CCU4_SLICE_Capture1Config | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_EVENT_t | event | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Map an External event to the Capture-1 Function
- Returns
None
- Description:
- Configures the Capture-1 Function of the slice, by configuring CC4yCMC.CAP1S bit.
Capture function is mapped with one of the 3 events. A CCU4 slice can be configured into capture-1 mode with the selected event. In this mode the CCU4 will capture the timer value into CC4yC2V and CC4yC3V.
- Related APIs:
- XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput().
void XMC_CCU4_SLICE_CaptureInit | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_CAPTURE_CONFIG_t *const | capture_init | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice capture_init Pointer to slice configuration structure
- Returns
None
- Description:
- Initialization of a CC4 slice to capture mode, by configuring CC4yTC, CC4yCMC, CC4yPSC,CC4yFPCS registers.
CC4 slice is configured with Capture configurations in this routine.After initialization user has to explicitly enable the shadow transfer for the required values by calling XMC_CCU4_EnableShadowTransfer() with appropriate mask.
void XMC_CCU4_SLICE_ClearEvent | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_IRQ_ID_t | event | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Asserted event which must be acknowledged.
- Returns
None
- Description:
- Acknowledges an asserted event, by setting CC4ySWR with respective event flag.
void XMC_CCU4_SLICE_ClearTimer | ( | XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
None
- Description:
- Resets the timer count to zero, by setting CC4yTCCLR.TCC bit.
A timer which has been stopped can still retain the last counted value. After invoking this API the timer value will be cleared.
- Related APIs:
- XMC_CCU4_SLICE_StartTimer().
void XMC_CCU4_SLICE_CompareInit | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_COMPARE_CONFIG_t *const | compare_init | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice compare_init Pointer to slice configuration structure
- Returns
None
- Description:
- Initialization of a CC4 slice to compare mode, by configuring CC4yTC, CC4yCMC, CC4yPSC, CC4yDITH, CC4yPSL, CC4yFPCS, CC4yCHC registers.
CC4 slice is configured with Timer configurations in this routine. After initialization user has to explicitly enable the shadow transfer for the required values by calling XMC_CCU4_EnableShadowTransfer() with appropriate mask.
- Related APIs:
- None.
void XMC_CCU4_SLICE_ConfigureEvent | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_EVENT_t | event, | ||
const XMC_CCU4_SLICE_EVENT_CONFIG_t *const | config | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event The External Event which needs to be configured. config Pointer to event configuration data.
- Returns
None
- Description:
- Configures an External Event of the slice, by updating CC4yINS register .
Details such as the input mapped to the event, event detection criteria and low pass filter options are programmed by this routine. The Event config will configure the input selection, the edge selection, the level selection and the Low pass filter for the event.
- Related APIs:
- XMC_CCU4_SLICE_StartConfig()
XMC_CCU4_SLICE_StopConfig()
XMC_CCU4_SLICE_LoadConfig()
XMC_CCU4_SLICE_ModulationConfig()
XMC_CCU4_SLICE_CountConfig()
XMC_CCU4_SLICE_GateConfig()
XMC_CCU4_SLICE_Capture0Config()
XMC_CCU4_SLICE_Capture1Config()
XMC_CCU4_SLICE_DirectionConfig()
XMC_CCU4_SLICE_StatusBitOverrideConfig()
XMC_CCU4_SLICE_TrapConfig().
void XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_EVENT_CONFIG_t *const | ev1_config, | ||
const XMC_CCU4_SLICE_EVENT_CONFIG_t *const | ev2_config | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice ev1_config Pointer to event 1 configuration data ev2_config Pointer to event 2 configuration data
- Returns
None
- Description:
- Map Status bit override function with an Event1 & Event 2 of the slice and configure CC4yINS register.
Details such as the input mapped to the event, event detection criteria and Low Pass filter options are programmed by this routine for the events 1 & 2. Event-1 input would be the trigger to override the value. Event-2 input would be the override value.
- Related APIs:
- XMC_CCU4_SLICE_StatusBitOverrideConfig().
void XMC_CCU4_SLICE_CountConfig | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_EVENT_t | event | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Map an External event to the External Count Function
- Returns
None
- Description:
- Configures the Count Function of the slice, by configuring CC4yCMC.CNTS bit.
Count function is mapped with one of the 3 events. CCU4 slice can take an external signal to act as the counting event. The CCU4 slice would count the edges present on the event selected.
- Related APIs:
- XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput().
void XMC_CCU4_SLICE_DirectionConfig | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_EVENT_t | event | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Map an External event to the External Count Direction Function
- Returns
None
- Description:
- Configures the Count Direction of the slice, by configuring CC4yCMC.UDS bit.
Count direction function is mapped with one of the 3 events. A slice can be configured to change the CC4yTIMER count direction depending on an external signal.
- Related APIs:
- XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput().
void XMC_CCU4_SLICE_DisableAutomaticShadowTransferRequest | ( | XMC_CCU4_SLICE_t *const | slice, |
const uint32_t | automatic_shadow_transfer | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice automatic_shadow_transfer specify upon which register update, automatic shadow transfer request should not be generated Use :: XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_t enum items to create a mask of choice, using a bit wise OR operation.
- Returns
None
- Description:
- Configure on which shadow register update, automatic shadow transfer request generation has to be disabled. By clearing ASPC, ASCC1, ASCC2, ASLC, ASDC, ASFC bits in STC register.
This disables the generation of automatic shadow transfer request for the specified register update.
- Note:
- Related APIs:
- XMC_CCU4_SLICE_EnableAutomaticShadowTransferRequest().
- Note
- Only available for XMC1400 series
void XMC_CCU4_SLICE_DisableCascadedShadowTransfer | ( | XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
None
- Description:
- Disables the cascaded the shadow transfer operation, by clearing CSE bit in STC register.
If in any slice the cascaded mode disabled, other slices from there onwards does not update the values in cascaded mode.
- Related APIs:
- XMC_CCU4_SLICE_EnableCascadedShadowTransfer()
.
- Note
- Only available for XMC1400 series
void XMC_CCU4_SLICE_DisableDithering | ( | XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
None
- Description:
- Disables dithering of PWM frequency and duty cycle, by clearing CC4yTC.DITHE bits.
This disables the Dither mode that was set in XMC_CCU4_SLICE_EnableDithering(). This API will not clear the dither compare value.
- Related APIs:
- XMC_CCU4_SLICE_EnableDithering().
void XMC_CCU4_SLICE_DisableEvent | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_IRQ_ID_t | event | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Event whose assertion can potentially lead to an interrupt
- Returns
None
- Description:
- Disables the generation of an interrupt pulse for the event, by clearing CC4yINTE register.
Prevents the event from being asserted
void XMC_CCU4_SLICE_DisableFloatingPrescaler | ( | XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
None
- Description:
- Disables the floating prescaler, by clearing CC4yTC.FPE bit.
This would return the prescaler to the normal mode. The prescaler that would be applied is the value present in CC4yPSC.
- Related APIs:
- XMC_CCU4_SLICE_EnableFloatingPrescaler().
void XMC_CCU4_SLICE_DisableMultiChannelMode | ( | XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
None
- Description:
- Disables the multichannel mode, by clearing CC4yTC.MCME bit.
This would return the slices to the normal operation mode.
- Related APIs:
- XMC_CCU4_SLICE_EnableMultiChannelMode().
void XMC_CCU4_SLICE_DisableMultipleEvents | ( | XMC_CCU4_SLICE_t *const | slice, |
const uint16_t | mask | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice mask Event mask such that multiple events can be enabled. Use XMC_CCU4_SLICE_MULTI_IRQ_ID_t enum items to create a mask of choice, using a bit wise OR operation.
- Returns
None
- Description:
- Disables the generation of an interrupt pulse for the required events, by clearing CC4yINTE register.
Prevents selected events of the slice from being asserted.
void XMC_CCU4_SLICE_DisableTrap | ( | XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
None
- Description:
- Disables the trap feature, by clearing CC4yTC.TRAPE0, CC4yTC.TRAPE1, CC4yTC.TRAPE2 and CC4yTC.TRAPE3 bit based on the out_mask.
.
This API will revert the changes done by XMC_CCU4_SLICE_EnableTrap(). This Ensures that the TRAP function has no effect on the output of the CCU4 slice.
- Related APIs:
- XMC_CCU4_SLICE_EnableTrap().
void XMC_CCU4_SLICE_EnableAutomaticShadowTransferRequest | ( | XMC_CCU4_SLICE_t *const | slice, |
const uint32_t | automatic_shadow_transfer | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice automatic_shadow_transfer specify upon which register update, automatic shadow transfer request is generated Use :: XMC_CCU4_SLICE_AUTOMAIC_SHADOW_TRANSFER_WRITE_INTO_t enum items to create a mask of choice, using a bit wise OR operation.
- Returns
None
- Description:
- Configure on which shadow register update, automatic shadow transfer request generation has to be enabled. By setting ASPC, ASCC1, ASCC2, ASLC, ASDC, ASFC bits in STC register.
By updating the configured shadow register, the shadow transfer request is generated to update all the shadow registers.
- Note:
- Related APIs:
- XMC_CCU4_SLICE_DisableAutomaticShadowTransferRequest().
- Note
- Only available for XMC1400 series
void XMC_CCU4_SLICE_EnableCascadedShadowTransfer | ( | XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
None
- Description:
- Cascades the shadow transfer operation throughout the CCU4 timer slices, by setting CSE bit in STC register.
The shadow transfer enable bits needs to be set in all timer slices, that are being used in the cascaded architecture, at the same time. The shadow transfer enable bits, also need to be set for all slices even if the shadow values of some slices were not updated. It is possible to to cascade with the adjacent slices only. CC40 slice is a master to start the operation.
- Note:
- XMC_CCU4_EnableShadowTransfer() must be called to enable the shadow transfer of the all the slices, which needs to be cascaded.
- Note
- Only available for XMC1400 series
void XMC_CCU4_SLICE_EnableDithering | ( | XMC_CCU4_SLICE_t *const | slice, |
const bool | period_dither, | ||
const bool | duty_dither, | ||
const uint8_t | spread | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice period_dither Boolean instruction on dithering of period match duty_dither Boolean instruction on dithering of compare match spread Dither compare value
- Returns
None
- Description:
- Enables dithering of PWM frequency and duty cycle, by configuring CC4yTC.DITHE and CC4yDITS bits.
Some control loops are slow in updating PWM frequency and duty cycle. In such a case, a Bresenham style dithering can help reduce long term errors. Dithering can be applied to period and duty individually, this can be selected using the parameter period_dither and duty_dither. The spread would provide the dither compare value. If the dither counter value is less than this spread then the period/compare values would be dithered according to the dither mode selected. This API would invoke XMC_CCU4_SLICE_SetDitherCompareValue().
- Note:
- After this API call, XMC_CCU4_EnableShadowTransfer() has to be called with appropriate mask to transfer the dither value.
- Related APIs:
- XMC_CCU4_SLICE_DisableDithering().
void XMC_CCU4_SLICE_EnableEvent | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_IRQ_ID_t | event | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Event whose assertion can potentially lead to an interrupt
- Returns
None
- Description:
- Enables the generation of an interrupt pulse for the event, by configuring CC4yINTE register.
For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding NVIC node must be enabled as well. This API merely enables the event. Binding with SR is performed by another API.
void XMC_CCU4_SLICE_EnableFloatingPrescaler | ( | XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
None
- Description:
- Enables the floating prescaler, by setting CC4yTC.FPE bit.
The prescaler divider starts with an initial value and increments upon every period match. It keeps incrementing until a ceiling (prescaler compare value) is hit and thereafter rolls back to the original prescaler divider value.
It is necessary to have programmed an initial divider value and a compare value before the feature is enabled.
void XMC_CCU4_SLICE_EnableMultiChannelMode | ( | XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
None
- Description:
- Enables the multichannel mode, by setting CC4yTC.MCME bit.
The output state of the Timer slices can be controlled in parallel by a single input signal. A particularly useful feature in motor control applications where the PWM output of multiple slices of a module can be gated and ungated by multi-channel gating inputs connected to the slices. A peripheral like POSIF connected to the motor knows exactly which of the power drive switches are to be turned on and off at any instant. It can thus through a gating bus (known as multi-channel inputs) control which of the slices output stays gated/ungated.
void XMC_CCU4_SLICE_EnableMultipleEvents | ( | XMC_CCU4_SLICE_t *const | slice, |
const uint16_t | intr_mask | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice intr_mask Event mask such that multiple events can be enabled. Use XMC_CCU4_SLICE_MULTI_IRQ_ID_t enum items to create a mask of choice, using a bit wise OR operation.
- Returns
None
- Description:
- Enables the generation of an interrupt pulse for the required events, by configuring CC4yINTE register.
For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding NVIC node must be enabled as well. This API merely enables the events. Binding with SR is performed by another API.
void XMC_CCU4_SLICE_EnableTrap | ( | XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
None
- Description:
- Enables the trap feature, by setting CC4yTC.TRAPE0, CC4yTC.TRAPE1, CC4yTC.TRAPE2 and CC4yTC.TRAPE3 bit based on the out_mask.
A particularly useful feature where the PWM output can be forced inactive upon detection of a trap. The trap signal can be the output of a sensing element which has just detected an abnormal electrical condition.
void XMC_CCU4_SLICE_GateConfig | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_EVENT_t | event | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Map an External event to the External Gating Function
- Returns
None
- Description:
- Configures the Gating Function of the slice, by configuring CC4yCMC.GATES bit.
Gating function is mapped with one of the 3 events. A CCU4 slice can use an input signal that would operate as counter gating. If the configured Active level is detected the counter will gate all the pulses.
- Related APIs:
- XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput().
uint32_t XMC_CCU4_SLICE_GetCapturedValueFromFifo | ( | const XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_CAP_REG_SET_t | set | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice set The capture register set from which the captured value is to be retrieved
- Returns
uint32_t Returns the value captured in the slice_number Range: [0x0 to 0xFFFF]
- Description:
- Read captured value from FIFO(CC4yECRD0 and CC4yECRD1).
This is applicable only in the Capture mode of operation. The signal whose timing characteristics are to be measured must be mapped to an event which in turn must be mapped to the capture function. Based on the capture criteria, the instant timer values are captured into capture registers. Timing characteristics of the input signal may then be derived/inferred from the captured values.
- Related APIs:
- XMC_CCU4_SLICE_IsExtendedCapReadEnabled().
- Note
- Defined for XMC4800, XMC4700, XMC4500, XMC4400, XMC4200, XMC4100 devices only. For other devices use XMC_CCU4_GetCapturedValueFromFifo() API
uint32_t XMC_CCU4_SLICE_GetCaptureRegisterValue | ( | const XMC_CCU4_SLICE_t *const | slice, |
const uint8_t | reg_num | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice reg_num The capture register from which the captured value is to be retrieved Range: [0,3]
- Returns
uint32_t Returns the Capture register value. Range: [0 to 0x1FFFFF]
- Description:
- Retrieves timer value which has been captured in the Capture registers, by reading CC4yCV[reg_num] register.
The signal whose timing characteristics are to be measured must be mapped to an event which in turn must be mapped to the capture function. Based on the capture criteria, the timer values are captured into capture registers. Timing characteristics of the input signal may then be derived/inferred from the captured values. The full flag will help to find out if there is a new captured value present.
- Related APIs:
- XMC_CCU4_SLICE_GetLastCapturedTimerValue().
XMC_CCU4_SLICE_TIMER_COUNT_DIR_t XMC_CCU4_SLICE_GetCountingDir | ( | const XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
XMC_CCU4_SLICE_TIMER_COUNT_DIR_t returns the direction in which the timer is counting.
- Description:
- Returns the timer counting direction, by reading CC4yTCST.CDIR bit.
This API will return the direction in which the timer is currently incrementing(XMC_CCU4_SLICE_TIMER_COUNT_DIR_UP) or decrementing (XMC_CCU4_SLICE_TIMER_COUNT_DIR_DOWN).
- Related APIs:
- None.
bool XMC_CCU4_SLICE_GetEvent | ( | const XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_IRQ_ID_t | event | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Event to be evaluated for assertion
- Returns
bool Returns true if event is set else false is returned.
- Description:
- Evaluates if a given event is asserted or not, by reading CC4yINTS register.
Return true if the event is asserted. For a event to be asserted it has to be first enabled. Only if that event is enabled the call to this API is valid. If the Event is enabled and has not yet occurred then a false is returned.
- Related APIs:
- XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_SetEvent().
XMC_CCU4_STATUS_t XMC_CCU4_SLICE_GetLastCapturedTimerValue | ( | const XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_CAP_REG_SET_t | set, | ||
uint32_t * | val_ptr | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice set The capture register set, which must be evaluated val_ptr Out Parameter of the API.Stores the captured timer value into this out parameter.
- Returns
XMC_CCU4_STATUS_t Returns XMC_CCU4_STATUS_OK if there was new value present in the capture registers. returns XMC_CCU4_STATUS_ERROR if there was no new value present in the capture registers.
- Description:
- Retrieves the latest captured timer value, by reading CC4yCV registers.
Retrieve the timer value last stored by the slice. When separate capture events are used, users must specify the capture set to evaluate. If single capture event mode is used, all 4 capture registers are evaluated.
The lowest register is evaluated first followed by the next higher ordered register and this continues until all capture registers have been evaluated.
- Related APIs:
- XMC_CCU4_SLICE_GetCaptureRegisterValue().
XMC_CCU4_SLICE_MODE_t XMC_CCU4_SLICE_GetSliceMode | ( | const XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
XMC_CCU4_SLICE_MODE_t returns XMC_CCU4_SLICE_MODE_COMPARE if the slice is operating in compare mode returns XMC_CCU4_SLICE_MODE_CAPTURE if the slice is operating in capture mode
- Description:
- Retrieves the current mode of operation in the slice (either Capture mode or Compare mode), by reading CC4yTC.CMOD bit.
Ensure that before invoking this API the CCU4 slice should be configured otherwise the output of this API is invalid.
- Related APIs:
- None.
uint16_t XMC_CCU4_SLICE_GetTimerCompareMatch | ( | const XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
uint16_t returns the current timer compare value Range: [0x0 to 0xFFFF]
- Description:
- Retrieves the timer compare value currently effective, by reading CC4yCRS register.
If the timer is active then the value being returned is currently being for the PWM duty cycle( timer compare value).
- Note:
- The XMC_CCU4_SLICE_SetTimerCompareMatch() would set the new compare value to a shadow register. This would only transfer the new values into the actual compare register if the shadow transfer request is enabled and if a period match occurs. Hence a consecutive call to XMC_CCU4_SLICE_GetTimerCompareMatch() would not reflect the new values until the shadow transfer completes. Directly accessed Register is CC4yCR.
- Related APIs:
- XMC_CCU4_SLICE_SetTimerCompareMatch().
XMC_CCU4_SLICE_TIMER_COUNT_MODE_t XMC_CCU4_SLICE_GetTimerCountingMode | ( | const XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
XMC_CCU4_SLICE_TIMER_COUNT_MODE_t returns XMC_CCU4_SLICE_TIMER_COUNT_MODE_EA if edge aligned mode is selected returns XMC_CCU4_SLICE_TIMER_COUNT_MODE_CA if center aligned mode is selected
- Description:
- Retrieves timer counting mode either Edge aligned or Center Aligned, by reading CC4yTC.TCM bit.
- Related APIs:
- XMC_CCU4_SLICE_SetTimerCountingMode().
uint16_t XMC_CCU4_SLICE_GetTimerPeriodMatch | ( | const XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
uint16_t returns the current timer period value Range: [0x0 to 0xFFFF]
- Description:
- Retrieves the timer period value currently effective, by reading CC4yPR register.
If the timer is active then the value being returned is currently being used for the PWM period.
- Note:
- The XMC_CCU4_SLICE_SetTimerPeriodMatch() would set the new period value to a shadow register. This would only transfer the new values into the actual period register if the shadow transfer request is enabled and if a period match occurs. Hence a consecutive call to XMC_CCU4_SLICE_GetTimerPeriodMatch() would not reflect the new values until the shadow transfer completes.
- Related APIs:
- XMC_CCU4_SLICE_SetTimerPeriodMatch().
XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t XMC_CCU4_SLICE_GetTimerRepeatMode | ( | const XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t returns XMC_CCU4_SLICE_TIMER_REPEAT_MODE_REPEAT if continuous mode is selected returns XMC_CCU4_SLICE_TIMER_REPEAT_MODE_SINGLE if single shot mode is selected
- Description:
- Retrieves the Timer repeat mode, either Single shot mode or continuous mode, by reading CC4yTC.TSSM bit.
The timer will count up to the terminal count as specified in the period register and stops immediately if the repeat mode has been set to single shot mode. In the continuous mode of operation, the timer starts counting all over again after reaching the terminal count.
- Related APIs:
- XMC_CCU4_SLICE_SetTimerRepeatMode().
uint16_t XMC_CCU4_SLICE_GetTimerValue | ( | const XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
uint16_t returns the current timer value Range: [0x0 to 0xFFFF]
- Description:
- Retrieves the latest timer value, from CC4yTIMER register.
- Related APIs:
- XMC_CCU4_SLICE_SetTimerValue().
bool XMC_CCU4_SLICE_IsExtendedCapReadEnabled | ( | const XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
bool would return true if the extended capture read back mode is enabled
- Description:
- Checks if Extended capture mode read is enabled for particular slice or not, by reading CC4yTC.ECM bit.
In this mode the there is only one associated read address for all the capture registers. Individual capture registers can still be accessed in this mode.
- Related APIs:
- XMC_CCU4_GetCapturedValueFromFifo().
bool XMC_CCU4_SLICE_IsTimerRunning | ( | const XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
bool returns true if the Timer is running else it returns false.
- Description:
- Returns the state of the timer (Either Running or stopped(idle)), by reading CC4yTCST.TRB bit.
- Related APIs:
- XMC_CCU4_SLICE_StartTimer()
XMC_CCU4_SLICE_StopTimer().
void XMC_CCU4_SLICE_LoadConfig | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_EVENT_t | event | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Map an External event to the External load Function
- Returns
None
- Description:
- Configures the Load Function for the slice, by configuring CC4yCMC.LDS bit.
Load function is mapped with one of the 3 events. Up on occurrence of the event,
if CC4yTCST.CDIR set to 0,CC4yTIMER register is reloaded with the value from compare register
if CC4yTCST.CDIR set to 1,CC4yTIMER register is reloaded with the value from period register
- Related APIs:
- XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput().
void XMC_CCU4_SLICE_ModulationConfig | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_EVENT_t | event, | ||
const XMC_CCU4_SLICE_MODULATION_MODE_t | mod_mode, | ||
const bool | synch_with_pwm | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Map an External event to the External Modulation Function mod_mode Desired Modulation mode synch_with_pwm Option to synchronize modulation with PWM start Pass true if the modulation needs to be synchronized with PWM signal.
- Returns
None
- Description:
- Configures the Output Modulation Function of the slice, by configuring CCeyCMC.MOS, CC4yTC.EMT and CC4yTC.EMS bits.
Modulation function is mapped with one of the 3 events. The output signal of the CCU can be modulated according to a external input. Additionally, the behaviour of the slice upon activation of the modulation function is configured as well.
- Related APIs:
- XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput().
void XMC_CCU4_SLICE_SetDitherCompareValue | ( | XMC_CCU4_SLICE_t *const | slice, |
const uint8_t | comp_val | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice comp_val Dither compare value Range: [0x0 to 0xF]
- Returns
None
- Description:
- Sets the dither spread/compare value, by setting CC4yDITS.DCVS bits.
This value is the cornerstone of PWM dithering feature. Dithering is applied/done when the value in the dithering counter is less than this compare/spread value. For all dithering counter values greater than the spread value, there is no dithering. After setting the value XMC_CCU4_EnableShadowTransfer() has to be called with appropriate mask.
- Related APIs:
- XMC_CCU4_SLICE_EnableDithering().
void XMC_CCU4_SLICE_SetEvent | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_IRQ_ID_t | event | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Event whose assertion can potentially lead to an interrupt
- Returns
None
- Description:
- Manually asserts the requested event, by setting CC4ySWS register.
For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding NVIC node must be enabled as well. This API manually asserts the requested event.
void XMC_CCU4_SLICE_SetFloatingPrescalerCompareValue | ( | XMC_CCU4_SLICE_t *const | slice, |
const uint8_t | cmp_val | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice cmp_val Prescaler divider compare value Range: [0x0 to 0xF]
- Returns
None
- Description:
- Programs the slice specific prescaler divider compare value, by configuring CC4yFPCS register.
The compare value is applicable only in floating mode of operation. The prescaler divider starts with an initial value and increments to the compare value steadily upon every period match. Once prescaler divider equals the prescaler divider compare value, the value in the former resets back to the PVAL (from FPC). After setting the value, XMC_CCU4_EnableShadowTransfer() has to be called with appropriate mask.
- Related APIs:
- XMC_CCU4_SLICE_SetPrescaler().
void XMC_CCU4_SLICE_SetInput | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_EVENT_t | event, | ||
const XMC_CCU4_SLICE_INPUT_t | input | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event The External Event which needs to be configured. input One of the 16 inputs meant to be mapped to the desired event
- Returns
None
- Description:
- Selects an input for an external event, by configuring CC4yINS register.
It is possible to select one of the possible 16 input signals for a given Event. This configures the CC4yINS.EVxIS for the selected event.
- Related APIs:
- XMC_CCU4_SLICE_StartConfig()
XMC_CCU4_SLICE_StopConfig()
XMC_CCU4_SLICE_LoadConfig()
XMC_CCU4_SLICE_ModulationConfig()
XMC_CCU4_SLICE_CountConfig()
XMC_CCU4_SLICE_GateConfig()
XMC_CCU4_SLICE_Capture0Config()
XMC_CCU4_SLICE_Capture1Config()
XMC_CCU4_SLICE_DirectionConfig()
XMC_CCU4_SLICE_StatusBitOverrideConfig()
XMC_CCU4_SLICE_TrapConfig().
void XMC_CCU4_SLICE_SetInterruptNode | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_IRQ_ID_t | event, | ||
const XMC_CCU4_SLICE_SR_ID_t | sr | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Event which must be bound to a service request line sr The Service request line which is bound to the event
- Returns
None
- Description:
- Binds requested event to a service request line, by configuring CC4ySRS register with respective event.
For an event to lead to an interrupt, it must first be enabled and bound to a service request line. The corresponding NVIC node must be enabled as well. This API binds the requested event with the requested service request line(sr).
- Related APIs:
- XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_SetEvent().
void XMC_CCU4_SLICE_SetPassiveLevel | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_OUTPUT_PASSIVE_LEVEL_t | level | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice level Slice output passive level
- Returns
None
- Description:
- Configures the passive level for the slice output, by setting CC4yPSL register.
Defines the passive level for the timer slice output pin. Selects either level high is passive or level low is passive. This is the level of the output before the compare match is value changes it.
- Related APIs:
- XMC_CCU4_SLICE_EnableEvent()
XMC_CCU4_SLICE_SetEvent().
void XMC_CCU4_SLICE_SetPrescaler | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_PRESCALER_t | div_val | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice div_val Prescaler divider value. Accepts enum :: XMC_CCU4_SLICE_PRESCALER_t Range: [0x0 to 0xF]
- Returns
None
- Description:
- Programs the slice specific prescaler divider, by configuring the CC4yPSC and CC4yFPC registers.
The prescaler divider may only be programmed after the prescaler run bit has been cleared by calling XMC_CCU4_StopPrescaler().
- Related APIs:
- XMC_CCU4_SLICE_SetFloatingPrescalerCompareValue().
void XMC_CCU4_SLICE_SetShadowTransferMode | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_t | shadow_transfer_mode | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice shadow_transfer_mode mode to be configured Use :: XMC_CCU4_SLICE_SHADOW_TRANSFER_MODE_t enum items for mode
- Returns
None
- Description:
- Configures when the shadow transfer has to occur, by setting STM bit in STC register.
After requesting for shadow transfer mode using XMC_CCU4_EnableShadowTransfer(), actual transfer occurs based on the selection done using this API (i.e. on period and One match, on Period match only, on One match only).
- Note:
- This is effective when the timer is configured in centre aligned mode.
- Related APIs:
- XMC_CCU4_EnableShadowTransfer()
- Note
- Only available for XMC1400 series
void XMC_CCU4_SLICE_SetTimerCompareMatch | ( | XMC_CCU4_SLICE_t *const | slice, |
const uint16_t | compare_val | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice compare_val Timer compare value
- Returns
None
- Description:
- Programs the timer compare value, by writing CC4yCRS register.
The PWM duty cycle is determined by this value. The compare value is written to a shadow register. Explicitly enable the shadow transfer for the the period/compare value by calling XMC_CCU4_EnableShadowTransfer() with appropriate mask.If shadow transfer is enabled and the timer is running, a period match transfers the value from the shadow register to the actual compare register.
- Related APIs:
- XMC_CCU4_SLICE_GetTimerPeriodMatch().
void XMC_CCU4_SLICE_SetTimerCountingMode | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_TIMER_COUNT_MODE_t | mode | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice mode Desired counting mode (Either Edge Aligned or Center Aligned)
- Returns
None
- Description:
- Configures the timer counting mode either Edge Aligned or Center Aligned, by configuring CC4yTC.TCM bit.
In the edge aligned mode, the timer counts from 0 to the terminal count. Once the timer count has reached a preset compare value, the timer status output asserts itself. It will now deassert only after the timer count reaches the terminal count.
In the center aligned mode, the timer first counts from 0 to the terminal count and then back to 0. During this upward and downward counting, the timer status output stays asserted as long as the timer value is greater than the compare value.
- Related APIs:
- XMC_CCU4_SLICE_GetTimerCountingMode().
void XMC_CCU4_SLICE_SetTimerPeriodMatch | ( | XMC_CCU4_SLICE_t *const | slice, |
const uint16_t | period_val | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice period_val Timer period value Range: [0x0 to 0xFFFF]
- Returns
None
- Description:
- Programs the timer period, by writing CC4yPRS register.
The frequency of counting/ PWM frequency is determined by this value. The period value is written to a shadow register. Explicitly enable the shadow transfer for the the period value by calling XMC_CCU4_EnableShadowTransfer() with appropriate mask. If shadow transfer is enabled and the timer is running, a period match transfers the value from the shadow register to the actual period register.
- Related APIs:
- XMC_CCU4_SLICE_GetTimerPeriodMatch().
void XMC_CCU4_SLICE_SetTimerRepeatMode | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_TIMER_REPEAT_MODE_t | mode | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice mode Desired repetition mode (Either single shot or Continuous)
- Returns
None
- Description:
- Configures the Timer to either Single shot mode or continuous mode, by configuring CC4yTC.TSSM bit.
The timer will count up to the terminal count as specified in the period register and stops immediately if the repeat mode has been set to single shot. In the continuous mode of operation, the timer starts counting all over again after reaching the terminal count.
- Related APIs:
- XMC_CCU4_SLICE_GetTimerRepeatMode().
void XMC_CCU4_SLICE_SetTimerValue | ( | XMC_CCU4_SLICE_t *const | slice, |
const uint16_t | timer_val | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice timer_val The new timer value that has to be loaded into the TIMER register. Range: [0x0 to 0xFFFF]
- Returns
None
- Description:
- Loads a new timer value, by setting CC4yTIMER register.
- Note:
- Request to load is ignored if the timer is running.
- Related APIs:
- XMC_CCU4_SLICE_GetTimerValue().
void XMC_CCU4_SLICE_StartConfig | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_EVENT_t | event, | ||
const XMC_CCU4_SLICE_START_MODE_t | start_mode | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Map an External event to the External Start Function start_mode Behavior of slice when the start function is activated
- Returns
None
- Description:
- Configures the Start Function of the slice, by configuring CC4yCMC.ENDS and CC4yTC.ENDM bits.
Start function is mapped with one of the 3 events. An external signal can control when a CC4 timer should start. Additionally, the behaviour of the slice upon activation of the start function is configured as well.
void XMC_CCU4_SLICE_StartTimer | ( | XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
None
- Description:
- Starts the timer counting operation, by setting CC4yTCSET.TRBS bit.
It is necessary to have configured the CC4 slice before starting its timer. Before the Timer is started ensure that the clock is provided to the slice.
- Related APIs:
- XMC_CCU4_SLICE_StopTimer().
void XMC_CCU4_SLICE_StatusBitOverrideConfig | ( | XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
None
- Description:
- Configures the status bit override Function of the slice, by configuring CC4yCMC.OFS bit.
Status bit override function is mapped with one of the 3 events. A slice can be configured to change the output of the timer's CC4yST signal depending on an external signal.
- Related APIs:
- XMC_CCU4_SLICE_ConfigureStatusBitOverrideEvent().
void XMC_CCU4_SLICE_StopClearTimer | ( | XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
None
- Description:
- Stops and resets the timer count to zero, by setting CC4yTCCLR.TCC and CC4yTCCLR.TRBC bit.
- Related APIs:
- XMC_CCU4_SLICE_StartTimer().
void XMC_CCU4_SLICE_StopConfig | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_EVENT_t | event, | ||
const XMC_CCU4_SLICE_END_MODE_t | end_mode | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice event Map an External event to the External Stop Function end_mode Behavior of slice when the stop function is activated
- Returns
None
- Description:
- Configures the Stop function for the slice, by configuring CC4yCMC.STRTS and CC4yTC.STRM bits.
Stop function is mapped with one of the 3 events. An external signal can control when a CCU4 timer should stop. Additionally, the behaviour of the slice upon activation of the stop function is configured as well.
void XMC_CCU4_SLICE_StopTimer | ( | XMC_CCU4_SLICE_t *const | slice | ) |
- Parameters
-
slice Constant pointer to CC4 Slice
- Returns
None
- Description:
- Stops the Timer.
Timer counting operation can be stopped by invoking this API, by setting CC4yTCCLR.TRBC bit.
- Related APIs:
- XMC_CCU4_SLICE_StartTimer().
void XMC_CCU4_SLICE_TrapConfig | ( | XMC_CCU4_SLICE_t *const | slice, |
const XMC_CCU4_SLICE_TRAP_EXIT_MODE_t | exit_mode, | ||
bool | synch_with_pwm | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice exit_mode How should a previously logged trap state be exited? synch_with_pwm Should exit of trap state be synchronized with PWM cycle start?
- Returns
None
- Description:
- Configures the Trap Function of the slice, by configuring CC4yCMC.TS, CC4yTC.TRPSE, and CC4yTC.TRPSW bits.
Trap function is mapped with Event-2. Criteria for exiting the trap state is configured. This trap function allows PWM outputs to react on the state of an input pin. Thus PWM output can be forced to inactive state upon detection of a trap. It is also possible to synchronize the trap function with the PWM signal using the synch_with_pwm.
- Related APIs:
- XMC_CCU4_SLICE_ConfigureEvent()
XMC_CCU4_SLICE_SetInput().
void XMC_CCU4_SLICE_WriteCoherentlyWithPWMCycle | ( | XMC_CCU4_SLICE_t *const | slice, |
const uint32_t | coherent_write | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice coherent_write specifies for what fields this mode has to be applied Use :: XMC_CCU4_SLICE_WRITE_INTO_t enum items to create a mask of choice, using a bit wise OR operation.
- Returns
None
- Description:
- Configures the specified fields shadow value to be updated in synchronous with PWM after shadow transfer request, by clearing IRPC, IRCC1, IRCC2, IRLC, IRDC, IRFC bits in STC register.
When coherent shadow is enabled, after calling XMC_CCU4_EnableShadowTransfer(), the value which are written in the respective shadow registers get updated according the configuration done using XMC_CCU4_SLICE_SetShadowTransferMode() API.
- Note:
- Note
- Only available for XMC1400 series
void XMC_CCU4_SLICE_WriteImmediateAfterShadowTransfer | ( | XMC_CCU4_SLICE_t *const | slice, |
const uint32_t | immediate_write | ||
) |
- Parameters
-
slice Constant pointer to CC4 Slice immediate_write specifies for what fields this mode has to be applied Use :: XMC_CCU4_SLICE_WRITE_INTO_t enum items to create a mask of choice, using a bit wise OR operation.
- Returns
None
- Description:
- Configures the specified fields shadow value to be updated immediately after shadow transfer request, by setting IRPC, IRCC1, IRCC2, IRLC, IRDC, IRFC bits in STC register.
When immediate shadow is enabled, by calling XMC_CCU4_EnableShadowTransfer() the value which are written in the shadow registers get updated to the actual registers immediately.
- Note:
- Related APIs:
- XMC_CCU4_EnableShadowTransfer()
- Note
- Only available for XMC1400 series
void XMC_CCU4_StartPrescaler | ( | XMC_CCU4_MODULE_t *const | module | ) |
- Parameters
-
module Constant pointer to CCU4 module
- Returns
None
- Description:
- Starts the prescaler and restores clocks to the timer slices, by setting GIDLC.SPRB bit.
Once the input to the prescaler has been chosen and the prescaler divider of all slices programmed, the prescaler itself may be started. Invoke this API after XMC_CCU4_Init() (Mandatory to fully initialize the module).Directly accessed register is GIDLC.
void XMC_CCU4_StopPrescaler | ( | XMC_CCU4_MODULE_t *const | module | ) |
- Parameters
-
module Constant pointer to CCU4 module
- Returns
None
- Description:
- Stops the prescaler and blocks clocks to the timer slices, by setting GIDLS.CPRB bit.
Opposite of the StartPrescaler routine. Clears the run bit of the prescaler. Ensures that the module clock is not supplied to the slices of the module.Registers directly accessed is GIDLS.
Generated on Mon Aug 7 2017 11:33:56 for XMC Peripheral Library for XMC4000 Family by 1.8.11