|
void | XMC_POSIF_ClearEvent (XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) |
|
void | XMC_POSIF_Disable (XMC_POSIF_t *const peripheral) |
|
void | XMC_POSIF_DisableEvent (XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) |
|
void | XMC_POSIF_Enable (XMC_POSIF_t *const peripheral) |
|
void | XMC_POSIF_EnableEvent (XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) |
|
uint8_t | XMC_POSIF_GetEventStatus (XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) |
|
uint8_t | XMC_POSIF_HSC_GetCurrentPattern (XMC_POSIF_t *const peripheral) |
|
uint8_t | XMC_POSIF_HSC_GetExpectedPattern (XMC_POSIF_t *const peripheral) |
|
uint8_t | XMC_POSIF_HSC_GetLastSampledPattern (XMC_POSIF_t *const peripheral) |
|
XMC_POSIF_STATUS_t | XMC_POSIF_HSC_Init (XMC_POSIF_t *const peripheral, const XMC_POSIF_HSC_CONFIG_t *const config) |
|
void | XMC_POSIF_HSC_SetCurrentPattern (XMC_POSIF_t *const peripheral, const uint8_t pattern) |
|
void | XMC_POSIF_HSC_SetExpectedPattern (XMC_POSIF_t *const peripheral, const uint8_t pattern) |
|
void | XMC_POSIF_HSC_SetHallPatterns (XMC_POSIF_t *const peripheral, const uint8_t pattern_mask) |
|
void | XMC_POSIF_HSC_UpdateHallPattern (XMC_POSIF_t *const peripheral) |
|
void | XMC_POSIF_Init (XMC_POSIF_t *const peripheral, const XMC_POSIF_CONFIG_t *const config) |
|
bool | XMC_POSIF_IsRunning (XMC_POSIF_t *const peripheral) |
|
void | XMC_POSIF_MCM_EnableMultiChannelPatternUpdate (XMC_POSIF_t *const peripheral) |
|
uint16_t | XMC_POSIF_MCM_GetMultiChannelPattern (XMC_POSIF_t *const peripheral) |
|
uint16_t | XMC_POSIF_MCM_GetShadowMultiChannelPattern (XMC_POSIF_t *const peripheral) |
|
XMC_POSIF_STATUS_t | XMC_POSIF_MCM_Init (XMC_POSIF_t *const peripheral, const XMC_POSIF_MCM_CONFIG_t *const config) |
|
void | XMC_POSIF_MCM_SetMultiChannelPattern (XMC_POSIF_t *const peripheral, const uint16_t pattern) |
|
void | XMC_POSIF_MCM_UpdateMultiChannelPattern (XMC_POSIF_t *const peripheral) |
|
uint8_t | XMC_POSIF_QD_GetCurrentIndexValue (XMC_POSIF_t *const peripheral) |
|
uint8_t | XMC_POSIF_QD_GetCurrentState (XMC_POSIF_t *const peripheral) |
|
XMC_POSIF_QD_DIR_t | XMC_POSIF_QD_GetDirection (XMC_POSIF_t *const peripheral) |
|
uint8_t | XMC_POSIF_QD_GetPreviousState (XMC_POSIF_t *const peripheral) |
|
XMC_POSIF_STATUS_t | XMC_POSIF_QD_Init (XMC_POSIF_t *const peripheral, const XMC_POSIF_QD_CONFIG_t *const config) |
|
void | XMC_POSIF_SelectInputSource (XMC_POSIF_t *const peripheral, const XMC_POSIF_INPUT_PORT_t input0, const XMC_POSIF_INPUT_PORT_t input1, const XMC_POSIF_INPUT_PORT_t input2) |
|
void | XMC_POSIF_SetEvent (XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event) |
|
void | XMC_POSIF_SetInterruptNode (XMC_POSIF_t *const peripheral, const XMC_POSIF_IRQ_EVENT_t event, const XMC_POSIF_SR_ID_t sr) |
|
void | XMC_POSIF_SetMode (XMC_POSIF_t *const peripheral, const XMC_POSIF_MODE_t mode) |
|
void | XMC_POSIF_Start (XMC_POSIF_t *const peripheral) |
|
void | XMC_POSIF_Stop (XMC_POSIF_t *const peripheral) |
|
The POSIF unit is a flexible and powerful component for motor control systems that use rotary encoders or hall sensors as feedback loop. It provides interface for motor position and velocity measurement. POSIF unit works with CCU4 and CCU8 to enable position and velocity measurement and to control PWM outputs using multi channel pattern.
Driver is divided in three POSIF functional blocks - Hall Sensor Control (POSIF_HSC), Quadrature Decoder (POSIF_QD) and MultiChannel Mode (POSIF_MCM).
POSIF driver features:
- Configuration structure XMC_POSIF_CONFIG_t and initialization function XMC_POSIF_Init() to configure global settings
- Allows to change the operating mode using XMC_POSIF_SetMode()
- Allows the selection of one of the four inputs (A, B, C or D) using XMC_POSIF_SelectInputSource(). In hall sensor control, inputs are hall0, hall1 and hall2 signals. For quadrature decoder mode, inputs are phase A, phase B and index signals.
- Hall Sensor Control (APIs prefixed with XMC_POSIF_HSC_)
- Quadrature Decoder (APIs prefixed with XMC_POSIF_QD_)
- MultiChannel Mode (APIs prefixed with XMC_POSIF_MCM_)
- User need to call respective init functions to configure POSIF operating mode. e.g to configure POSIF in hall sensor control with multichannel mode call both XMC_POSIF_HSC_Init() and XMC_POSIF_MCM_Init().
- Allows to enable and disable interrupt sources and assign to service request node using XMC_POSIF_EnableEvent(), XMC_POSIF_DisableEvent() and XMC_POSIF_SetInterruptNode()
- Note
- POSIF is not available on XMC11 and XMC12 devices
Defines POSIF peripheral register structure.Use type XMC_POSIF_t for this data structure.
Defines POSIF input debounce filter configuration.POSIF inputs are connected to low pass filter and this enum is used to configure low pass filters cut off frequency. Use type XMC_POSIF_FILTER_t for this enum. The member defines the low pass filter configuration(LPC) bitfield of PCONF register.
Enumerator |
---|
XMC_POSIF_FILTER_DISABLED |
No filtering
|
XMC_POSIF_FILTER_1_CLOCK_CYCLE |
Filter of 1 Clock Cycle
|
XMC_POSIF_FILTER_2_CLOCK_CYCLE |
Filter of 2 Clock Cycles
|
XMC_POSIF_FILTER_4_CLOCK_CYCLE |
Filter of 4 Clock Cycles
|
XMC_POSIF_FILTER_8_CLOCK_CYCLE |
Filter of 8 Clock Cycles
|
XMC_POSIF_FILTER_16_CLOCK_CYCLE |
Filter of 16 Clock Cycles
|
XMC_POSIF_FILTER_32_CLOCK_CYCLE |
Filter of 32 Clock Cycles
|
XMC_POSIF_FILTER_64_CLOCK_CYCLE |
Filter of 64 Clock Cycles
|
Defines trigger edge in hall sensor mode.Use type XMC_POSIF_HSC_TRIGGER_EDGE_t for this enum. It can be used to configure PCONF register's SPES and MSES bit fields.
Enumerator |
---|
XMC_POSIF_HSC_TRIGGER_EDGE_RISING |
Rising edge
|
XMC_POSIF_HSC_TRIGGER_EDGE_FALLING |
Falling edge
|
Defines active level of an input signal.Use type XMC_POSIF_INPUT_ACTIVE_LEVEL_t for this enum.
Enumerator |
---|
XMC_POSIF_INPUT_ACTIVE_LEVEL_HIGH |
Input - Active High
|
XMC_POSIF_INPUT_ACTIVE_LEVEL_LOW |
Input - Active Low
|
Defines POSIF configurable input ports.Use type XMC_POSIF_INPUT_PORT_t for this enum. The member defines the respective input selector(INSELX) bitfields of PCONF register. It selects, which input is used for the phase or Hall input function (depending on the module is set for Quadrature Decoder or Hall Sensor Mode). Same enum can be used to configure pattern update signal select by configuring PCONF register's MSETS bit field.
Enumerator |
---|
XMC_POSIF_INPUT_PORT_A |
INPUT-A
|
XMC_POSIF_INPUT_PORT_B |
INPUT-B
|
XMC_POSIF_INPUT_PORT_C |
INPUT-C
|
XMC_POSIF_INPUT_PORT_D |
INPUT-D
|
XMC_POSIF_INPUT_PORT_E |
INPUT-E
|
XMC_POSIF_INPUT_PORT_F |
INPUT-F
|
XMC_POSIF_INPUT_PORT_G |
INPUT-G
|
XMC_POSIF_INPUT_PORT_H |
INPUT-H
|
Defines POSIF events.Use type XMC_POSIF_IRQ_EVENT_t for this enum. The member defines available event sources.It is used to configure which event to be used for interrupt generation using PFLGE register. [ PFLG,SPFLG,RPFLG]
Enumerator |
---|
XMC_POSIF_IRQ_EVENT_CHE |
Hall Mode : Correct Hall Event
|
XMC_POSIF_IRQ_EVENT_WHE |
Hall Mode : Wrong Hall Event
|
XMC_POSIF_IRQ_EVENT_HALL_INPUT |
Hall Mode : Hall Input update
|
XMC_POSIF_IRQ_EVENT_MCP_SHADOW_TRANSFER |
Hall Mode + MCM Mode : MC Pattern shadow transfer
|
XMC_POSIF_IRQ_EVENT_INDX |
Quadrature Mode : Index event detection
|
XMC_POSIF_IRQ_EVENT_ERR |
Quadrature Mode : Quadrature Phase Error
|
XMC_POSIF_IRQ_EVENT_CNT |
Quadrature Mode : Quadrature Clock event
|
XMC_POSIF_IRQ_EVENT_DIR |
Quadrature Mode : Quadrature Direction change event
|
XMC_POSIF_IRQ_EVENT_PCLK |
Quadrature Mode : Quadrature period clock generation event
|
Defines POSIF configurable modes.Use type XMC_POSIF_MODE_t for this enum. The members defines the function selector(FSEL) bitfields of PCONF register.
Enumerator |
---|
XMC_POSIF_MODE_HALL_SENSOR |
Hall sensor mode
|
XMC_POSIF_MODE_QD |
Quadrature Decoder mode
|
XMC_POSIF_MODE_MCM |
Standalone Multichannel mode
|
XMC_POSIF_MODE_MCM_QD |
Quadrature Decoder + Standalone Multichannel mode
|
Defines motor rotation direction.Use type XMC_POSIF_QD_DIR_t for this enum. The member defines the direction in quadrature mode.
Enumerator |
---|
XMC_POSIF_QD_DIR_COUNTERCLOCKWISE |
Counter Clockwise
|
XMC_POSIF_QD_DIR_CLOCKWISE |
Clockwise
|
Defines frequency of index signal generation.Use type XMC_POSIF_QD_INDEX_GENERATION_t for this enum. Member represents available configuration for index marker generation using ICM bit field in QDC register.
Enumerator |
---|
XMC_POSIF_QD_INDEX_GENERATION_NEVER |
Never generate the index marker signal
|
XMC_POSIF_QD_INDEX_GENERATION_ONCE |
Generate only once after the first revolution
|
XMC_POSIF_QD_INDEX_GENERATION_ALWAYS |
Index marker generated upon every revolution
|
Defines position decoder mode selection.Use type XMC_POSIF_QD_MODE_t for this enum. The member defines configuration for the operation of the quadrature decoder mode. It used to configure QDC register.
Enumerator |
---|
XMC_POSIF_QD_MODE_QUADRATURE |
Standard Quadrature Mode
|
XMC_POSIF_QD_MODE_DIRECTION_COUNT |
Direction Count Mode
|
Defines POSIF service request lines.Use type XMC_POSIF_SR_ID_t for this enum. It used to connect POSIF event to required service request line. in PFLGE register for interrupt generation.
Enumerator |
---|
XMC_POSIF_SR_ID_0 |
SR-0
|
XMC_POSIF_SR_ID_1 |
SR-1
|
Defines the return status, to verify the POSIF related API calls. Use type XMC_POSIF_STATUS_t for this enum.
Enumerator |
---|
XMC_POSIF_STATUS_OK |
API fulfills request
|
XMC_POSIF_STATUS_ERROR |
API cannot fulfill request
|
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
event | Event to be acknowledged |
- Return values
-
- Description
- Clears event by acknowledgment of peripheral.
Acknowledges an IRQ event by configuring 1 to RPFLG register's event bit field.
- Related APIs:
- XMC_POSIF_SetEvent()
void XMC_POSIF_Disable |
( |
XMC_POSIF_t *const |
peripheral | ) |
|
- Parameters
-
peripheral | Pointer to an instance of POSIF module of type XMC_POSIF_t |
- Return values
-
- Description
- Asserts the POSIF module into reset and disables the clock.
If running on other than XMC45 device then in addition it will gate the peripheral clock. Configures PRCLR0 register's POSIF0RS or POSIF1RS bitfield depends upon peripheral.
- Related APIs:
- XMC_POSIF_Enable()
Disables an IRQ generation capable event.
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
event | Event to be disabled |
- Return values
-
- Description
- Disables event generation of peripheral.
Disables an IRQ generation capable event by configuring 0 to PFLGE register's event bit field.
- Related APIs:
- XMC_POSIF_EnableEvent()
- Parameters
-
peripheral | Pointer to an instance of POSIF module of type XMC_POSIF_t |
- Return values
-
- Description
- De-asserts the POSIF module from reset and enables the clock.
Configures PRCLR0 register's POSIF0RS or POSIF1RS bit field depends upon peripheral. If running on other than XMC45 device then it will ungate the peripheral clock.
- Note
- This is the first API which application must invoke to configure POSIF. It is internally called by XMC_POSIF_Init().
- Related APIs:
- XMC_POSIF_Disable(),XMC_POSIF_Init()
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
event | Event to be enabled |
- Return values
-
- Description
- Enables event generation of peripheral.
Enables an IRQ generation capable event by configuring 1 to PFLGE register's event bit field.
- Related APIs:
- XMC_POSIF_DisableEvent()
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
event | Event ID to be checked for status |
- Return values
-
uint8_t | Returns event status |
- Description
- Returns event status of peripheral.
Determines if IRQ event is asserted by retrieving data from PFLG register's event bit field.
- Related APIs:
- XMC_POSIF_SetEvent(),XMC_POSIF_ClearEvent()
uint8_t XMC_POSIF_HSC_GetCurrentPattern |
( |
XMC_POSIF_t *const |
peripheral | ) |
|
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
uint8_t | Returns current hall sensor pattern. Range : [0-7] |
- Description
- Returns current sampled hall sensor pattern of peripheral.
Retrieves the current hall sensor pattern from HALP register's HCP bit field of peripheral. Applications can at any point in time retrieve the current hall sensor pattern by invoking this API.
- Note
- This is applicable only to the hall sensor mode of operation.
- Related APIs:
- XMC_POSIF_HSC_GetLastSampledPattern(),XMC_POSIF_HSC_GetExpectedPattern()
uint8_t XMC_POSIF_HSC_GetExpectedPattern |
( |
XMC_POSIF_t *const |
peripheral | ) |
|
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
uint8_t | Returns expected hall sensor pattern. Range : [0-7] |
- Description
- Returns expected hall sensor pattern of peripheral.
Retrieves the expected hall sensor pattern from HALP register's HEP bit field of peripheral. Applications can at any point in time retrieve the expected hall sensor pattern by invoking this API.
- Note
- This is applicable only to the hall sensor mode of operation.
- Related APIs:
- XMC_POSIF_HSC_GetLastSampledPattern(),XMC_POSIF_HSC_GetCurrentPattern()
uint8_t XMC_POSIF_HSC_GetLastSampledPattern |
( |
XMC_POSIF_t *const |
peripheral | ) |
|
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
uint8_t | Returns last sampled hall sensor pattern. Range : [0-7] |
- Description
- Returns last sampled hall sensor pattern of peripheral.
Retrieves the last sampled hall sensor pattern from PDBG register's HSP bit field of peripheral. Applications can at any point in time retrieve the last sampled hall sensor pattern by invoking this API.
- Note
- This is applicable only to the hall sensor mode of operation.
- Related APIs:
- XMC_POSIF_HSC_GetCurrentPattern(),XMC_POSIF_HSC_GetExpectedPattern()
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
config | Pointer to hall sensor control initialization data of type XMC_POSIF_HSC_CONFIG_t |
- Return values
-
- Description
- Initializes hall sensor control mode.
Configures PCONF register with which POSIF input trigger to be used for sampling hall pattern.Configures PCONF register for idle signal generation for wrong hall event.
- Note
- It is necessary to have called XMC_POSIF_Init first with Hall sensor mode before invocation of this API.
- Related APIs:
- XMC_POSIF_Init()
void XMC_POSIF_HSC_SetCurrentPattern |
( |
XMC_POSIF_t *const |
peripheral, |
|
|
const uint8_t |
pattern |
|
) |
| |
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
pattern | The hall sensor pattern to be programmed into current pattern [0-7] |
- Return values
-
- Description
- Configures current Hall sensor pattern of peripheral.
Configures the Current hall sensor pattern on HALPS shadow register's HCPS bit field of peripheral. Applications can set at any point in time program the current hall sensor pattern by invoking this API.
- Note
- This is applicable only to the hall sensor mode of operation. It may be noted that the pattern is merely written to the shadow register. Transfer from the shadow register is based on a hardware transfer trigger or software trigger through API XMC_POSIF_HSC_UpdateHallPattern().
- Related APIs:
- XMC_POSIF_HSC_GetCurrentPattern(),XMC_POSIF_HSC_SetExpectedPattern()
void XMC_POSIF_HSC_SetExpectedPattern |
( |
XMC_POSIF_t *const |
peripheral, |
|
|
const uint8_t |
pattern |
|
) |
| |
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
pattern | The hall sensor pattern to be programmed into expected pattern [0-7] |
- Return values
-
- Description
- Configures the expected hall sensor pattern of peripheral.
Applications can set at any point in time program the hall sensor expected patterns by invoking this API. Configures the expected hall sensor pattern on HALPS shadow register's HEPS bit field of peripheral.
- Note
- This is applicable only to the hall sensor mode of operation.It may be noted that the pattern is merely written to the shadow register. Transfer from the shadow register is based on a hardware transfer trigger or software trigger through API XMC_POSIF_HSC_UpdateHallPattern().
- Related APIs:
- XMC_POSIF_HSC_GetExpectedPattern()
void XMC_POSIF_HSC_SetHallPatterns |
( |
XMC_POSIF_t *const |
peripheral, |
|
|
const uint8_t |
pattern_mask |
|
) |
| |
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
pattern_mask | The hall sensor pattern mask [0-63] Format of mask: (expected_pattern << 3) | (current_pattern) |
- Return values
-
- Description
- Configures current and expected hall pattern of peripheral.
Configures HALPS register with the Current and Expected hall sensor patterns in one operation. Applications can at any point in time program the current and expected hall sensor pattern by invoking this API.
- Note
- This is applicable only to the hall sensor mode of operation. It may be noted that the pattern is merely written to the shadow register. Transfer from the shadow register is based on a hardware transfer trigger or software trigger through API XMC_POSIF_HSC_UpdateHallPattern().
- Related APIs:
- XMC_POSIF_HSC_SetExpectedPattern(),XMC_POSIF_HSC_SetCurrentPattern()
void XMC_POSIF_HSC_UpdateHallPattern |
( |
XMC_POSIF_t *const |
peripheral | ) |
|
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
- Description
- Manually performs shadow transfer of hall sensor patterns.
Configures MCMS register's STHR bit field with 1. Setting this bit to 1 leads to an immediate update of the fields HALP.HCP(Current pattern) and HALP.HEP(Expected pattern).
- Note
- The transfer of hall sensor pattern shadow registers content to the sensor pattern register happens under two conditions. A hardware trigger starts the shadow transfer. Alternatively, the shadow transfer can be initiated by application software by means of invocation of this API.
- Related APIs:
- XMC_POSIF_HSC_SetHallPatterns()
- Parameters
-
peripheral | Pointer to an instance of POSIF module of type XMC_POSIF_t |
config | Pointer to POSIF configuration data(operation mode,input selection and filter configuration) |
- Return values
-
- Description
- Initialize POSIF module with config.
Configures POSIF global registers.This is the first API which application must invoke to configure POSIF. It sets up parameters common to all the POSIF modes - hall sensor,quadrature decoder and multi-channel modes of operation. Configures PCONF register with mode of operation,input selection and filter configuration.
- Related APIs:
- XMC_POSIF_HSC_Init(),XMC_POSIF_QD_Init(),XMC_POSIF_MCM_Init()
bool XMC_POSIF_IsRunning |
( |
XMC_POSIF_t *const |
peripheral | ) |
|
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
bool | Returns false: IDLE, true:RUNNING |
- Description
- Returns the status of POSIF module - Running or IDLE.
Retrieves the status from PRUN register's SRB bit.
- Related APIs:
- XMC_POSIF_Start(),XMC_POSIF_Stop()
void XMC_POSIF_MCM_EnableMultiChannelPatternUpdate |
( |
XMC_POSIF_t *const |
peripheral | ) |
|
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
- Description
- Enables update of the Multi-Channel Pattern by software in standalone multi-channel mode.
Enabling update of multi-channel pattern happens under two conditions. A hardware trigger enables this update. Alternatively, this can be enabled by software by means of invocation of this API.
- Note
- The update is not done immediately due to the fact that the trigger that synchronizes the update with the PWM is still needed.
- Related APIs:
- XMC_POSIF_MCM_UpdateMultiChannelPattern()
uint16_t XMC_POSIF_MCM_GetMultiChannelPattern |
( |
XMC_POSIF_t *const |
peripheral | ) |
|
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
uint16_t | Returns configured multi channel pattern |
- Description
- Returns configured multi channel pattern of peripheral.
Retrieves the Multi-Channel Pattern from MCM register's MCMP bit field of peripheral Applications can at any point in time retrieve the multi-channel pattern by invoking this API.
- Related APIs:
- XMC_POSIF_MCM_SetMultiChannelPattern()
uint16_t XMC_POSIF_MCM_GetShadowMultiChannelPattern |
( |
XMC_POSIF_t *const |
peripheral | ) |
|
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
uint16_t | Returns configured multi channel pattern present in shadow transfer register |
- Description
- Returns configured multi channel pattern in shadow register of peripheral.
Retrieves the Multi-Channel Pattern from MCSM shadow register's MCMPS bit field. Applications can at any point in time retrieve the multi-channel pattern by invoking this API.
It can be used when MCM is enabled.
- Related APIs:
- XMC_POSIF_MCM_SetMultiChannelPattern()
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
config | Pointer to quadrature decoder initialization data |
- Return values
-
XMC_POSIF_STATUS_t | Returns multi channel pattern initialization status of type XMC_POSIF_STATUS_t |
- Description
- Initializes multi channel mode in Hall mode, standalone multi-channel mode and quadrature with multi-channel mode.
Configures PCONF register with multi channel mode using XMC_POSIF_MCM_CONFIG_t data structure.
- Note
- It is necessary to call XMC_POSIF_Init first before invocation of this API. For XMC_POSIF_MODE_HALL_SENSOR, it is necessary to have called XMC_POSIF_HSC_Init before invocation of this API. For XMC_POSIF_MODE_MCM_QD, it is necessary to have called XMC_POSIF_QD_Init before invocation of this API.
- Related APIs:
- XMC_POSIF_Init(),XMC_POSIF_HSC_Init(),XMC_POSIF_QD_Init()
void XMC_POSIF_MCM_SetMultiChannelPattern |
( |
XMC_POSIF_t *const |
peripheral, |
|
|
const uint16_t |
pattern |
|
) |
| |
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
pattern | The 16b multi-channel pattern [0-65535] |
- Return values
-
- Description
- Configures MCSM register with Multi-Channel Pattern.
This 16b multi-channel pattern which controls the 16 outputs of all slices of a CCU8 module. Transfer from the shadow register is based on a hardware transfer trigger or software trigger through API XMC_POSIF_MCM_UpdateMultiChannelPattern(). Every time that a Multi-Channel pattern transfer is triggered, this value is passed into the field MCM.MCMP of peripheral
- Note
- It may be noted that the pattern is merely written to the shadow register.
- Related APIs:
- XMC_POSIF_MCM_GetMultiChannelPattern()
void XMC_POSIF_MCM_UpdateMultiChannelPattern |
( |
XMC_POSIF_t *const |
peripheral | ) |
|
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
- Description
- Performs shadow transfer of the Multi-Channel Pattern register by configuring MCMS register's STMR bit field.
- Note
- Transfer multi-channel pattern shadow registers content to the actual pattern register of peripheral.
The transfer of multi-channel pattern shadow registers content to the actual pattern register happens under two conditions. A hardware trigger starts the shadow transfer. Alternatively, the shadow transfer can be initiated by application software by means of invocation of this API.
- Related APIs:
- XMC_POSIF_MCM_SetMultiChannelPattern()
uint8_t XMC_POSIF_QD_GetCurrentIndexValue |
( |
XMC_POSIF_t *const |
peripheral | ) |
|
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
uint8_t | Returns the index value.[1 - New rotation started, 0 - In-between] |
- Description
- Returns the current index value in quadrature decoder mode of peripheral.
Retrieves current index signal value of the quadrature decoder from PDBG register's IVAL bit field. Applications can at any point in time retrieve the current index signal value of the quadrature decoder by invoking this API.
- Note
- This is applicable only to the quadrature decoder mode of operation.
uint8_t XMC_POSIF_QD_GetCurrentState |
( |
XMC_POSIF_t *const |
peripheral | ) |
|
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
uint8_t | Returns current state of quadrature decoder[Phase B,Phase A] |
- Description
- Returns the current state of phase signals in quadrature decoder mode of peripheral.
Retrieves current state of the quadrature decoder from PDBG register's QCSV bit fields. Applications can at any point in time retrieve the current state of Phase A and Phase B signals by invoking this API.
- Note
- This is applicable only to the quadrature decoder mode of operation.
- Related APIs:
- XMC_POSIF_QD_GetPreviousState()
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
- Description
- Returns the direction of revolution of the motor.
Retrieves direction from QDC register's DVAL bit field in quadrature mode. Applications can at any point in time retrieve the direction of rotation by invoking this API.
- Note
- This is applicable only to the quadrature decoder mode of operation.
uint8_t XMC_POSIF_QD_GetPreviousState |
( |
XMC_POSIF_t *const |
peripheral | ) |
|
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
uint8_t | Returns previous state of quadrature decoder[Phase B,Phase A] |
- Description
- Returns the previous state of phase signals in quadrature decoder mode of peripheral.
Retrieves previous state of the quadrature decoder from PDBG register's QPSV bit fields. Applications can at any point in time retrieve the previous state of Phase A and Phase B signals by invoking this API.
- Note
- This is applicable only to the quadrature decoder mode of operation.
- Related APIs:
- XMC_POSIF_QD_GetCurrentState()
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
config | Pointer to quadrature decoder initialization data |
- Return values
-
XMC_POSIF_STATUS_t | Returns quadrature mode initialization status of type XMC_POSIF_STATUS_t |
- Description
- Initializes quadrature decoder control mode.
Configures PCONF register with quadrature mode using XMC_POSIF_QD_MODE_t data structure. Initializes QDC register with quadrature mode configuration using XMC_POSIF_QD_CONFIG_t structure.
- Note
- It is necessary to have called XMC_POSIF_Init first with Quadrature decoder mode before invocation of this API.
- Related APIs:
- XMC_POSIF_Init()
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
input0 | Choice of input for input 0 [0-3] |
input1 | Choice of input for input 1 [0-3] |
input2 | Choice of input for input 2 [0-3] |
- Return values
-
- Description
- Configures which input to be connected to POSIF module.
Configures PCONF register's INSEL0,INSEL1,INSEL2 bit fields with source for the input connection for input0 input1, input2 respectively.
- Note
- Configures which input is used for the Phase X or Hall input X function depending upon the module is set for Quadrature Decoder or Hall Sensor Mode.
- Related APIs:
- XMC_POSIF_Init()
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
event | Event to be manually asserted |
- Return values
-
- Description
- Manually generates event of peripheral.
Manually asserts an IRQ generation capable event by configuring 1 to SPFLG register's event bit field.
- Related APIs:
- XMC_POSIF_ClearEvent()
- Parameters
-
- Return values
-
- Description
- Configures event to generate sr (service request) of peripheral.
Binds an IRQ event to a service request line by configuring PFLGE register's event bit field.
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
mode | POSIF operating mode of type XMC_POSIF_MODE_t |
- Return values
-
- Description
- Configures POSIF module for mode.
Configures PCONF register's a\ FSEL bitfield with mode. Refer XMC_POSIF_MODE_t for available options.
- Note
- POSIF module should be in stopped state while changing the operating mode.
- Related APIs:
- XMC_POSIF_Stop()
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
- Description
- Starts POSIF peripheral functional state machine.
Starts POSIF state machine for peripheral.Configures PRUNS register's SRB bit field with 1.
- Note
- Global properties of POSIF along with mode specific properties should have been initialized before starting of POSIF FSM.
- Related APIs:
- XMC_POSIF_Stop(),XMC_POSIF_IsRunning()
- Parameters
-
peripheral | Pointer to an instance of POSIF module |
- Return values
-
- Description
- Stops POSIF peripheral functional state machine.
Stop POSIF functional state machine and clears current internal status of the peripheral. Configures PRUNC register's CRB bit field with 1.
- Related APIs:
- XMC_POSIF_Start(),XMC_POSIF_IsRunning()