AM62Ax MCU+ SDK
10.01.00
The eQEP driver provides API to configure eQEP module. Below are the high level features supported by the driver.
Features Supported
Configuration of position counter and control unit for position and direction measurement
Configuration of unit time base for speed and frequency measurement
Configuration of quadrature edge capture unit for low-speed measurement
Configuration of watchdog timer for detecting stalls
SysConfig Features
Note It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
SysConfig can be used to configure below parameters apart from common configuration like Clock, MPU, RAT and others.
EQEP instances and pin mux configurations.
Features NOT Supported
NA
Important Usage Guidelines
NA
Example Usage
Include the below file to access the APIs
EQEP Interrupt Registration
hwiPrms.
intNum = CONFIG_EQEP0_INTR;
hwiPrms.
isPulse = CONFIG_EQEP0_INTR_IS_PULSE;
EQEP Quadrature Mode Position Measurement Configuration
CSL_EQEP_QPOSCNT_QPOSCNT_MAX);
EQEP Quadrature Mode Frequency Measurement Configuration
CSL_EQEP_QPOSCNT_QPOSCNT_MAX);
EQEP Interrupt Service Routine
{
if (gEqepIsrCnt < EQEP_EVENT_CNT)
{
}
if (gEqepIsrCnt == (EQEP_EVENT_CNT - 1))
{
}
gEqepIsrCnt++;
}
{
if (gEqepIsrCnt < EQEP_EVENT_CNT)
{
}
if (gEqepIsrCnt == (EQEP_EVENT_CNT - 1))
{
}
gEqepIsrCnt++;
}
EQEP Interrupt De-Registration
API
APIs for EQEP
uint32_t status
Definition: tisci_lpm.h:1
void EQEP_setDecoderConfig(uint32_t baseAddr, uint16_t config)
Configures eQEP module's quadrature decoder unit.
void HwiP_destruct(HwiP_Object *obj)
Cleanup, delete, destruct a Hwi object.
Parameters passed during HwiP_construct.
Definition: HwiP.h:74
void EQEP_enableUnitTimer(uint32_t baseAddr, uint32_t period)
Enables the eQEP module unit timer.
#define EQEP_LATCH_RISING_INDEX
Index position counter latch event.
Definition: eqep/v0/eqep.h:193
#define EQEP_CONFIG_2X_RESOLUTION
Resolution Count rising and falling edge.
Definition: eqep/v0/eqep.h:83
#define EQEP_POSITION_RESET_UNIT_TIME_OUT
Reset position on a unit time event.
Definition: eqep/v0/eqep.h:249
#define EQEP_CONFIG_1X_RESOLUTION
Resolution Count rising edge only.
Definition: eqep/v0/eqep.h:85
#define EQEP_CONFIG_NO_SWAP
Do not swap QEPA and QEPB.
Definition: eqep/v0/eqep.h:87
int32_t HwiP_construct(HwiP_Object *obj, HwiP_Params *params)
Create a Hwi object.
#define EQEP_CONFIG_QUADRATURE
Values that can be passed to EQEP_setDecoderConfig() as the config parameter.
Definition: eqep/v0/eqep.h:75
void HwiP_Params_init(HwiP_Params *params)
Set default values to HwiP_Params.
#define EQEP_UNIT_POS_EVNT_DIV_8
UPEVNT = QCLK/8.
Definition: eqep/v0/eqep.h:299
void EQEP_enableModule(uint32_t baseAddr)
Enables the eQEP module.
void EQEP_disableInterrupt(uint32_t baseAddr, uint16_t intFlags)
Disables individual eQEP module interrupt sources.
void EQEP_clearInterruptStatus(uint32_t baseAddr, uint16_t intFlags)
Clears eQEP module interrupt sources.
uint32_t EQEP_getIndexPositionLatch(uint32_t baseAddr)
Gets the encoder position that was latched on an index event.
void EQEP_setCaptureConfig(uint32_t baseAddr, eqepCapClkPrescale_t capPrescale, eqeqUpEvntPrescale_t evntPrescale)
Configures eQEP module edge-capture unit.
#define SystemP_SUCCESS
Return status when the API execution was successful.
Definition: SystemP.h:56
uint16_t EQEP_getEnabledInterrupt(uint32_t baseAddr)
Get Enabled interrupts of eQEP module.
void EQEP_enableCapture(uint32_t baseAddr)
Enables the eQEP module edge-capture unit.
uint16_t EQEP_getInterruptStatus(uint32_t baseAddr)
Gets the current interrupt status.
uint8_t isPulse
Definition: HwiP.h:82
#define EQEP_POSITION_RESET_IDX
Reset position on index pulse.
Definition: eqep/v0/eqep.h:243
#define EQEP_INT_UNIT_TIME_OUT
Unit time-out.
Definition: eqep/v0/eqep.h:146
void EQEP_enableInterrupt(uint32_t baseAddr, uint16_t intFlags)
Enables individual eQEP module interrupt sources.
uint32_t EQEP_getPositionLatch(uint32_t baseAddr)
Gets the encoder position that was latched on a unit time-out event.
HwiP_FxnCallback callback
Definition: HwiP.h:77
#define EQEP_INT_INDEX_EVNT_LATCH
Index event latch.
Definition: eqep/v0/eqep.h:144
void SemaphoreP_post(SemaphoreP_Object *obj)
Post a semaphore object or unlock a mutex.
#define DebugP_assert(expression)
Function to call for assert check.
Definition: DebugP.h:175
void EQEP_setLatchMode(uint32_t baseAddr, uint32_t latchMode)
Configures the quadrature modes in which the position count can be latched.
#define EQEP_LATCH_UNIT_TIME_OUT
On position counter read.
Definition: eqep/v0/eqep.h:186
uint32_t intNum
Definition: HwiP.h:76
void EQEP_setPositionCounterConfig(uint32_t baseAddr, eqepPositionResetMode_t mode, uint32_t maxPosition)
Configures eQEP module position counter unit.
#define EQEP_CAPTURE_CLK_DIV_128
CAPCLK = SYSCLKOUT/128.
Definition: eqep/v0/eqep.h:278
#define EQEP_CONFIG_UP_COUNT
Up-count mode, QDIR = 1.
Definition: eqep/v0/eqep.h:79