Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Exported_Functions
[AD5940_Library]
TypeDefinitions. More...
Functions | |
| void | AD5940_WriteReg (uint16_t RegAddr, uint32_t RegData) |
| SPI_Block. | |
| uint32_t | AD5940_ReadReg (uint16_t RegAddr) |
| Read register. | |
| void | AD5940_FIFORd (uint32_t *pBuffer, uint32_t uiReadCount) |
| Read specific number of data from FIFO with optimized SPI access. | |
| void | AD5940_Initialize (void) |
| Initialize AD5940. | |
| void | AD5940_AFECtrlS (uint32_t AfeCtrlSet, BoolFlag State) |
| Control most AFE digital and analog block within one register access. | |
| AD5940Err | AD5940_LPModeCtrlS (uint32_t EnSet) |
| When LP mode is enabled, some functions are under control of LPMODECON, rather than original registers. | |
| void | AD5940_AFEPwrBW (uint32_t AfePwr, uint32_t AfeBw) |
| Set AFE power mode and system bandwidth include HSDAC, Excitation-buffer, HSTIA and ADC etc. | |
| void | AD5940_REFCfgS (AFERefCfg_Type *pBufCfg) |
| Configure reference buffer include 1.8V/1.1V high/low power buffers. | |
| void | AD5940_HSLoopCfgS (HSLoopCfg_Type *pHsLoopCfg) |
| Configure High speed loop(high bandwidth loop or called excitation loop). | |
| void | AD5940_SWMatrixCfgS (SWMatrixCfg_Type *pSwMatrix) |
| Initialize switch matrix. | |
| void | AD5940_HSDacCfgS (HSDACCfg_Type *pHsDacCfg) |
| Initialize HSDAC. | |
| AD5940Err | AD5940_HSTIACfgS (HSTIACfg_Type *pHsTiaCfg) |
| Initialize High speed TIA amplifier. | |
| void | AD5940_HSRTIACfgS (uint32_t HSTIARtia) |
| Configure HSTIA RTIA resistor and keep other parameters unchanged. | |
| void | AD5940_LPLoopCfgS (LPLoopCfg_Type *pLpLoopCfg) |
| Configure low power loop include LPDAC LPAmp(PA and TIA) | |
| void | AD5940_LPDACCfgS (LPDACCfg_Type *pLpDacCfg) |
| Initialize LPDAC. | |
| void | AD5940_LPDAC0WriteS (uint16_t Data12Bit, uint8_t Data6Bit) |
| Write LPDAC0 data. | |
| void | AD5940_LPDAC1WriteS (uint16_t Data12Bit, uint8_t Data6Bit) |
| Write LPDAC1 data. | |
| void | AD5940_LPAMPCfgS (LPAmpCfg_Type *pLpAmpCfg) |
| Initialize LP TIA and PA. | |
| void | AD5940_DSPCfgS (DSPCfg_Type *pDSPCfg) |
| Configure low power loop include LPDAC LPAmp(PA and TIA) | |
| uint32_t | AD5940_ReadAfeResult (uint32_t AfeResultSel) |
| Read AD5940 generated data like ADC and DFT etc. | |
| void | AD5940_ADCBaseCfgS (ADCBaseCfg_Type *pADCInit) |
| Initializes ADC peripheral according to the specified parameters in the pADCInit. | |
| void | AD5940_ADCFilterCfgS (ADCFilterCfg_Type *pFiltCfg) |
| Initializes ADC filter according to the specified parameters in the pFiltCfg. | |
| void | AD5940_ADCPowerCtrlS (BoolFlag State) |
| Power up or power down ADC block(including ADC PGA and FRONTBUF). | |
| void | AD5940_ADCConvtCtrlS (BoolFlag State) |
| Start or stop ADC convert. | |
| void | AD5940_ADCMuxCfgS (uint32_t ADCMuxP, uint32_t ADCMuxN) |
| Configure ADC input MUX. | |
| void | AD5940_ADCDigCompCfgS (ADCDigComp_Type *pCompCfg) |
| Set ADC digital comparator function. | |
| void | AD5940_StatisticCfgS (StatCfg_Type *pStatCfg) |
| Configure statistic functions. | |
| void | AD5940_ADCRepeatCfgS (uint32_t Number) |
| Set ADC Repeat convert function number. | |
| void | AD5940_DFTCfgS (DFTCfg_Type *pDftCfg) |
| Configure DFT number and source and hanning window. | |
| void | AD5940_WGCfgS (WGCfg_Type *pWGInit) |
| Initialize waveform generator. | |
| AD5940Err | AD5940_WGDACCodeS (uint32_t code) |
| Write HSDAC code directly when WG configured to MMR type. | |
| void | AD5940_WGFreqCtrlS (float SinFreqHz, float WGClock) |
| Update WG SIN wave frequency in Hz. | |
| uint32_t | AD5940_WGFreqWordCal (float SinFreqHz, float WGClock) |
| Calculate sine wave generator frequency word. | |
| void | AD5940_FIFOCfg (FIFOCfg_Type *pFifoCfg) |
| Configure AD5940 FIFO. | |
| AD5940Err | AD5940_FIFOGetCfg (FIFOCfg_Type *pFifoCfg) |
| Read current FIFO configuration. | |
| void | AD5940_FIFOCtrlS (uint32_t FifoSrc, BoolFlag FifoEn) |
| Configure AD5940 FIFO Source and enable or disable FIFO. | |
| void | AD5940_FIFOThrshSet (uint32_t FIFOThresh) |
| Configure AD5940 Data FIFO threshold value. | |
| uint32_t | AD5940_FIFOGetCnt (void) |
| Get Data count in FIFO. | |
| void | AD5940_SEQCfg (SEQCfg_Type *pSeqCfg) |
| Initialize Sequencer. | |
| AD5940Err | AD5940_SEQGetCfg (SEQCfg_Type *pSeqCfg) |
| Read back current sequencer configuration and store it to pSeqCfg. | |
| void | AD5940_SEQCtrlS (BoolFlag SeqEn) |
| Enable or Disable sequencer. | |
| void | AD5940_SEQHaltS (void) |
| Halt sequencer immediately. | |
| void | AD5940_SEQMmrTrig (uint32_t SeqId) |
| Trigger sequencer by register write. | |
| void | AD5940_SEQCmdWrite (uint32_t StartAddr, const uint32_t *pCommand, uint32_t CmdCnt) |
| Write sequencer commands to AD5940 SRAM. | |
| void | AD5940_SEQInfoCfg (SEQInfo_Type *pSeq) |
| Initialize Sequence INFO. | |
| AD5940Err | AD5940_SEQInfoGet (uint32_t SeqId, SEQInfo_Type *pSeqInfo) |
| Get sequence info: start address and sequence length. | |
| void | AD5940_SEQGpioCtrlS (uint32_t GpioSet) |
| Control GPIO with register SYNCEXTDEVICE. | |
| uint32_t | AD5940_SEQTimeOutRd (void) |
| Read back current count down timer value for Sequencer Timer Out command. | |
| AD5940Err | AD5940_SEQGpioTrigCfg (SeqGpioTrig_Cfg *pSeqGpioTrigCfg) |
| Configure GPIO to allow it to trigger corresponding sequence(SEQ0/1/2/3). | |
| void | AD5940_WUPTCfg (WUPTCfg_Type *pWuptCfg) |
| Configure Wakeup Timer. | |
| void | AD5940_WUPTCtrl (BoolFlag Enable) |
| Enable or disable wakeup timer. | |
| AD5940Err | AD5940_WUPTTime (uint32_t SeqId, uint32_t SleepTime, uint32_t WakeupTime) |
| Configure WakeupTimer. | |
| void | AD5940_CLKCfg (CLKCfg_Type *pClkCfg) |
| Configure AD5940 clock. | |
| void | AD5940_HFOSC32MHzCtrl (BoolFlag Mode32MHz) |
| Configure Internal HFOSC to output 32MHz or 16MHz. | |
| void | AD5940_HPModeEn (BoolFlag Enable) |
| Enable high power mode for high frequency EIS. | |
| void | AD5940_INTCCfg (uint32_t AfeIntcSel, uint32_t AFEIntSrc, BoolFlag State) |
| Enable or Disable selected interrupt source(s) | |
| uint32_t | AD5940_INTCGetCfg (uint32_t AfeIntcSel) |
| Check if current interrupt configuration. | |
| void | AD5940_INTCClrFlag (uint32_t AfeIntSrcSel) |
| Clear selected interrupt(s) flag(INTC0Flag and INTC1Flag are both cleared). | |
| BoolFlag | AD5940_INTCTestFlag (uint32_t AfeIntcSel, uint32_t AfeIntSrcSel) |
| Test if selected interrupt source(s) is(are) bTRUE. | |
| uint32_t | AD5940_INTCGetFlag (uint32_t AfeIntcSel) |
| return register value of REG_INTC_INTCFLAGx | |
| void | AD5940_AGPIOCfg (AGPIOCfg_Type *pAgpioCfg) |
| Initialize AFE GPIO. | |
| void | AD5940_AGPIOFuncCfg (uint32_t uiCfgSet) |
| Configure the function of GP0 to GP7. | |
| void | AD5940_AGPIOOen (uint32_t uiPinSet) |
| Enable GPIO output mode on selected pins. | |
| void | AD5940_AGPIOIen (uint32_t uiPinSet) |
| Enable input on selected pins while disable others. | |
| uint32_t | AD5940_AGPIOIn (void) |
| Read the GPIO status. | |
| void | AD5940_AGPIOPen (uint32_t uiPinSet) |
| Enable pull-up or down on selected pins while disable other pins. | |
| void | AD5940_AGPIOSet (uint32_t uiPinSet) |
| Put selected GPIOs to high level. | |
| void | AD5940_AGPIOClr (uint32_t uiPinSet) |
| Put selected GPIOs to low level. | |
| void | AD5940_AGPIOToggle (uint32_t uiPinSet) |
| Toggle selected GPIOs. | |
| AD5940Err | AD5940_LPModeEnS (BoolFlag LPModeEn) |
| Enter or leave LPMODE. | |
| void | AD5940_LPModeClkS (uint32_t LPModeClk) |
| Select system clock source for LPMODE. | |
| void | AD5940_SleepKeyCtrlS (uint32_t SlpKey) |
| LPMode_Block_Functions. | |
| void | AD5940_EnterSleepS (void) |
| Put AFE to hibernate. | |
| void | AD5940_ShutDownS (void) |
| Turn off LP-Loop and put AFE to hibernate mode;. | |
| uint32_t | AD5940_WakeUp (int32_t TryCount) |
| Try to wakeup AD5940 by read register. | |
| uint32_t | AD5940_GetADIID (void) |
| Read ADIID register, the value for current version is AD5940_ADIID. | |
| uint32_t | AD5940_GetChipID (void) |
| Read CHIPID register, the value for current version is 0x5501. | |
| AD5940Err | AD5940_SoftRst (void) |
| Reset AD5940 by register. | |
| void | AD5940_HWReset (void) |
| Reset AD5940 with RESET pin. | |
| AD5940Err | AD5940_ADCPGACal (ADCPGACal_Type *ADCPGACal) |
| Calibrate ADC PGA. | |
| AD5940Err | AD5940_LPDACCal (LPDACCal_Type *pCalCfg, LPDACPara_Type *pResult) |
| Use ADC to measure LPDAC offset and gain factor. | |
| AD5940Err | AD5940_LPTIAOffsetCal (LPTIAOffsetCal_Type *pLPTIAOffsetCal) |
| Calibrate LPTIA offset. | |
| AD5940Err | AD5940_HSRtiaCal (HSRTIACal_Type *pCalCfg, void *pResult) |
| Measure HSTIA internal RTIA impedance. | |
| AD5940Err | AD5940_HSDACCal (HSDACCal_Type *pCalCfg) |
| calibrate HSDAC output voltage using ADC. | |
| AD5940Err | AD5940_LPRtiaCal (LPRTIACal_Type *pCalCfg, void *pResult) |
| Measure LPTIA internal RTIA impedance with HSTIA. | |
| AD5940Err | AD5940_LFOSCMeasure (LFOSCMeasure_Type *pCfg, float *pFreq) |
| Use system clock to measure LFOSC frequency. | |
| void | AD5940_SEQGenInit (uint32_t *pBuffer, uint32_t BufferSize) |
| Initialize sequencer generator with specified buffer. | |
| void | AD5940_SEQGenCtrl (BoolFlag bFlag) |
| Start or stop the sequencer generator. | |
| void | AD5940_SEQGenInsert (uint32_t CmdWord) |
| Manually input a command to sequencer generator. | |
| AD5940Err | AD5940_SEQGenFetchSeq (const uint32_t **ppSeqCmd, uint32_t *pSeqCount) |
| Get sequencer command generated. | |
| void | AD5940_ClksCalculate (ClksCalInfo_Type *pFilterInfo, uint32_t *pClocks) |
| Calculate how many clocks are needed in sequencer wait command to generate required number of data from filter output. | |
| uint32_t | AD5940_SEQCycleTime (void) |
| Calculate the number of cycles in the sequence. | |
| void | AD5940_SweepNext (SoftSweepCfg_Type *pSweepCfg, float *pNextFreq) |
| void AD5940_SweepNext(SoftSweepCfg_Type *pSweepCfg, float *pNextFreq) For sweep function, calculate next frequency point according to pSweepCfg info. | |
| void | AD5940_StructInit (void *pStruct, uint32_t StructSize) |
| Initialize Structure members to zero. | |
| float | AD5940_ADCCode2Volt (uint32_t code, uint32_t ADCPga, float VRef1p82) |
| Convert ADC Code to voltage. | |
| BoolFlag | AD5940_Notch50HzAvailable (ADCFilterCfg_Type *pFilterInfo, uint8_t *dl) |
| return if the SINC3/SINC2 combination is available for notch 50Hz filter. | |
| BoolFlag | AD5940_Notch60HzAvailable (ADCFilterCfg_Type *pFilterInfo, uint8_t *dl) |
| return if the SINC3/SINC2 combination is available for notch 60Hz filter. | |
| fImpCar_Type | AD5940_ComplexDivFloat (fImpCar_Type *a, fImpCar_Type *b) |
| Do complex number division. | |
| fImpCar_Type | AD5940_ComplexMulFloat (fImpCar_Type *a, fImpCar_Type *b) |
| Do complex number multiplication. | |
| fImpCar_Type | AD5940_ComplexAddFloat (fImpCar_Type *a, fImpCar_Type *b) |
| Do complex number addition. | |
| fImpCar_Type | AD5940_ComplexSubFloat (fImpCar_Type *a, fImpCar_Type *b) |
| Do complex number subtraction. | |
| fImpCar_Type | AD5940_ComplexDivInt (iImpCar_Type *a, iImpCar_Type *b) |
| Do complex number division. | |
| fImpCar_Type | AD5940_ComplexMulInt (iImpCar_Type *a, iImpCar_Type *b) |
| Do complex number multiplication. | |
| float | AD5940_ComplexMag (fImpCar_Type *a) |
| Calculate the complex number magnitude. | |
| float | AD5940_ComplexPhase (fImpCar_Type *a) |
| Calculate the complex number phase. | |
| FreqParams_Type | AD5940_GetFreqParameters (float freq) |
| Calculate the optimum filter settings based on signal frequency. | |
Detailed Description
TypeDefinitions.
Function Documentation
| void AD5940_ADCBaseCfgS | ( | ADCBaseCfg_Type * | pADCInit ) |
| float AD5940_ADCCode2Volt | ( | uint32_t | code, |
| uint32_t | ADCPga, | ||
| float | VRef1p82 | ||
| ) |
| void AD5940_ADCConvtCtrlS | ( | BoolFlag | State ) |
| void AD5940_ADCDigCompCfgS | ( | ADCDigComp_Type * | pCompCfg ) |
| void AD5940_ADCFilterCfgS | ( | ADCFilterCfg_Type * | pFiltCfg ) |
Initializes ADC filter according to the specified parameters in the pFiltCfg.
- Parameters:
-
pFiltCfg,: Pointer to filter initialize structure.
- Returns:
- return none.
Average filter is enabled when DFT source is DFTSRC_AVG in function AD5940_DFTCfgS. Once average function is enabled, it's automatically set as DFT source, register DFTCON.DFTINSEL is ignored.
| void AD5940_ADCMuxCfgS | ( | uint32_t | ADCMuxP, |
| uint32_t | ADCMuxN | ||
| ) |
Configure ADC input MUX.
- Parameters:
-
ADCMuxP : {ADCMUXP_FLOAT, ADCMUXP_HSTIA_P, ,,, ,ADCMUXP_P_NODE} - ADCMUXP_FLOAT: float ADC MUX positive input
- ADCMUXP_HSTIA_P: High speed TIA output sense terminal
- ADCMUXP_P_NODE: Excitation loop P node
ADCMuxN : {ADCMUXP_FLOAT, ADCMUXP_HSTIA_P, ,,, ,ADCMUXP_P_NODE} - ADCMUXP_FLOAT: float ADC MUX positive input
- ADCMUXP_HSTIA_P: High speed TIA output sense terminal
- ADCMUXP_P_NODE: Excitation loop P node
- Returns:
- return none.
| AD5940Err AD5940_ADCPGACal | ( | ADCPGACal_Type * | pADCPGACal ) |
Calibrate ADC PGA.
- Parameters:
-
pADCPGACal,: PGA calibration parameters include filter setup and PGA gain.
- Returns:
- AD5940ERR_OK.
Determine Gain calibration method according to different gain value... and calibration register
AD5940 use formular Output = gain*(input + offset) for calibration. So, the measured results should be divided by gain to get value for offset register.
| void AD5940_ADCPowerCtrlS | ( | BoolFlag | State ) |
| void AD5940_ADCRepeatCfgS | ( | uint32_t | Number ) |
| void AD5940_AFECtrlS | ( | uint32_t | AfeCtrlSet, |
| BoolFlag | State | ||
| ) |
Control most AFE digital and analog block within one register access.
- Parameters:
-
AfeCtrlSet,: A set of blocks that will be controlled select it from AFECTRL_Const Below is two examples to use it. - AFECTRL_HPREFPWR: Control high power reference(bandgap).
- AFECTRL_WG|AFECTRL_ADCPWR: The OR'ed control set. Control Waveform generator and ADC power.
State,: Enable or disable selected control set signal. Select from - bFALSE: Disable or power down selected block(s).
- bTRUE: Enable all selected block(s).
- Returns:
- return none.
| void AD5940_AFEPwrBW | ( | uint32_t | AfePwr, |
| uint32_t | AfeBw | ||
| ) |
Set AFE power mode and system bandwidth include HSDAC, Excitation-buffer, HSTIA and ADC etc.
- Parameters:
-
AfePwr : {AFEPWR_LP, AFEPWR_HP} Select parameters from AFEPWR_Const - AFEPWR_LP: Set AFE to low power mode
- AFEPWR_HP: Set AFE to High speed mode to support 200kHz.
AfeBw : {AFEBW_AUTOSET, AFEBW_50KHZ, AFEBW_100KHZ, AFEBW_250KHZ} - AFEBW_AUTOSET: Set the bandwidth automatically based on WGFCW frequency word.
- AFEBW_50KHZ: Set system bandwidth to 50kHz.
- AFEBW_100KHZ: Set system bandwidth to 100kHz.
- AFEBW_250KHZ: Set system bandwidth to 250kHz.
- Returns:
- return none.
| void AD5940_AGPIOCfg | ( | AGPIOCfg_Type * | pAgpioCfg ) |
| void AD5940_AGPIOClr | ( | uint32_t | uiPinSet ) |
| void AD5940_AGPIOFuncCfg | ( | uint32_t | uiCfgSet ) |
Configure the function of GP0 to GP7.
- Parameters:
-
uiCfgSet :{GP0_INT,GP0_TRIG,GP0_SYNC,GP0_GPIO| GP1_GPIO,GP1_TRIG,GP1_SYNC,GP1_SLEEP| GP2_PORB,GP2_TRIG,GP2_SYNC,GP2_EXTCLK| GP3_GPIO,GP3_TRIG,GP3_SYNC,GP3_INT0|\ GP4_GPIO,GP4_TRIG,GP4_SYNC,GP4_INT1| GP5_GPIO,GP5_TRIG,GP5_SYNC,GP5_EXTCLK| GP6_GPIO,GP6_TRIG,GP6_SYNC,GP6_INT0| GP7_GPIO,GP7_TRIG,GP7_SYNC,GP7_INT}
- Returns:
- return none.
| void AD5940_AGPIOIen | ( | uint32_t | uiPinSet ) |
| uint32_t AD5940_AGPIOIn | ( | void | ) |
| void AD5940_AGPIOOen | ( | uint32_t | uiPinSet ) |
| void AD5940_AGPIOPen | ( | uint32_t | uiPinSet ) |
| void AD5940_AGPIOSet | ( | uint32_t | uiPinSet ) |
| void AD5940_AGPIOToggle | ( | uint32_t | uiPinSet ) |
| void AD5940_CLKCfg | ( | CLKCfg_Type * | pClkCfg ) |
| void AD5940_ClksCalculate | ( | ClksCalInfo_Type * | pFilterInfo, |
| uint32_t * | pClocks | ||
| ) |
Calculate how many clocks are needed in sequencer wait command to generate required number of data from filter output.
- Note:
- When measurement is done, it's recommend to disable blocks like ADCPWR, ADCCNV, SINC2, DFT etc. If blocks remain powered up, they may need less clocks to generate required number of output. Use function AD5940_AFECtrlS to control these blocks.
- Parameters:
-
pFilterInfo,: Pointer to configuration structure. pClocks,: pointer used to store results.
- Returns:
- return none.
| fImpCar_Type AD5940_ComplexAddFloat | ( | fImpCar_Type * | a, |
| fImpCar_Type * | b | ||
| ) |
| fImpCar_Type AD5940_ComplexDivFloat | ( | fImpCar_Type * | a, |
| fImpCar_Type * | b | ||
| ) |
| fImpCar_Type AD5940_ComplexDivInt | ( | iImpCar_Type * | a, |
| iImpCar_Type * | b | ||
| ) |
| float AD5940_ComplexMag | ( | fImpCar_Type * | a ) |
| fImpCar_Type AD5940_ComplexMulFloat | ( | fImpCar_Type * | a, |
| fImpCar_Type * | b | ||
| ) |
| fImpCar_Type AD5940_ComplexMulInt | ( | iImpCar_Type * | a, |
| iImpCar_Type * | b | ||
| ) |
| float AD5940_ComplexPhase | ( | fImpCar_Type * | a ) |
| fImpCar_Type AD5940_ComplexSubFloat | ( | fImpCar_Type * | a, |
| fImpCar_Type * | b | ||
| ) |
| void AD5940_DFTCfgS | ( | DFTCfg_Type * | pDftCfg ) |
| void AD5940_DSPCfgS | ( | DSPCfg_Type * | pDSPCfg ) |
| void AD5940_EnterSleepS | ( | void | ) |
Put AFE to hibernate.
This will only take effect when SLP_KEY has been unlocked. Use function AD5940_SleepKeyCtrlS to enter correct key.
- Returns:
- return none.
| void AD5940_FIFOCfg | ( | FIFOCfg_Type * | pFifoCfg ) |
| void AD5940_FIFOCtrlS | ( | uint32_t | FifoSrc, |
| BoolFlag | FifoEn | ||
| ) |
Configure AD5940 FIFO Source and enable or disable FIFO.
- Parameters:
-
FifoSrc : available choices are FIFOSRC_Const - FIFOSRC_SINC3 SINC3 data
- FIFOSRC_DFT DFT real and imaginary part
- FIFOSRC_SINC2NOTCH SINC2+NOTCH block. Notch can be bypassed, so SINC2 data can be feed to FIFO
- FIFOSRC_VAR Statistic variance output
- FIFOSRC_MEAN Statistic mean output
FifoEn,: enable or disable the FIFO.
- Returns:
- return none.
| AD5940Err AD5940_FIFOGetCfg | ( | FIFOCfg_Type * | pFifoCfg ) |
| uint32_t AD5940_FIFOGetCnt | ( | void | ) |
| void AD5940_FIFORd | ( | uint32_t * | pBuffer, |
| uint32_t | uiReadCount | ||
| ) |
| void AD5940_FIFOThrshSet | ( | uint32_t | FIFOThresh ) |
| uint32_t AD5940_GetADIID | ( | void | ) |
| uint32_t AD5940_GetChipID | ( | void | ) |
| FreqParams_Type AD5940_GetFreqParameters | ( | float | freq ) |
| void AD5940_HFOSC32MHzCtrl | ( | BoolFlag | Mode32MHz ) |
| void AD5940_HPModeEn | ( | BoolFlag | Enable ) |
| AD5940Err AD5940_HSDACCal | ( | HSDACCal_Type * | pCalCfg ) |
| void AD5940_HSDacCfgS | ( | HSDACCfg_Type * | pHsDacCfg ) |
| void AD5940_HSLoopCfgS | ( | HSLoopCfg_Type * | pHsLoopCfg ) |
| AD5940Err AD5940_HSRtiaCal | ( | HSRTIACal_Type * | pCalCfg, |
| void * | pResult | ||
| ) |
Measure HSTIA internal RTIA impedance.
- Parameters:
-
pCalCfg,: pointer to calibration structure. pResult,: Pointer to a variable that used to store result. If bPolarResult in structure is set, then use type fImpPol_Type otherwise use fImpCar_Type.
- Returns:
- AD5940ERR_OK if succeed.
| void AD5940_HSRTIACfgS | ( | uint32_t | HSTIARtia ) |
Configure HSTIA RTIA resistor and keep other parameters unchanged.
- Parameters:
-
HSTIARtia,: The RTIA setting, select it from HSTIARTIA_Const
- Returns:
- return none.
| AD5940Err AD5940_HSTIACfgS | ( | HSTIACfg_Type * | pHsTiaCfg ) |
| void AD5940_HWReset | ( | void | ) |
| void AD5940_Initialize | ( | void | ) |
| void AD5940_INTCCfg | ( | uint32_t | AfeIntcSel, |
| uint32_t | AFEIntSrc, | ||
| BoolFlag | State | ||
| ) |
Enable or Disable selected interrupt source(s)
- Parameters:
-
AfeIntcSel : {AFEINTC_0, AFEINTC_1} - AFEINTC_0: Configure Interrupt Controller 0
- AFEINTC_1: Configure Interrupt Controller 1
AFEIntSrc,: select from AFEINTC_SRC_Const - AFEINTSRC_ADCRDY : Bit0 ADC Result Ready Status
- AFEINTSRC_DFTRDY : Bit1 DFT Result Ready Status
- AFEINTSRC_SUPPLYFILTRDY : Bit2 Low Pass Filter Result Status
- AFEINTSRC_TEMPRDY : Bit3, Temp Sensor Result Ready
- AFEINTSRC_ADCMINERR : Bit4, ADC Minimum Value
- AFEINTSRC_ADCMAXERR : Bit5, ADC Maximum Value
- AFEINTSRC_ADCDIFFERR : Bit6, ADC Delta Ready
- AFEINTSRC_MEANRDY : Bit7, Mean Result Ready
- AFEINTSRC_VARRDY : Bit8, Variance Result Ready
- AFEINTSRC_DLYCMDDONE : Bit9, User controlled interrupt by writing AFEGENINTSTA. Provides an Early Indication for the End of the Test _Block.
- AFEINTSRC_HWSETUPDONE : Bit10, User controlled interrupt by writing AFEGENINTSTA. Indicates the MMR Setup for the Measurement Step Finished
- AFEINTSRC_BRKSEQ : Bit11, User controlled interrupt by writing AFEGENINTSTA.
- AFEINTSRC_CUSTOMINS : Bit12, User controlled interrupt by writing AFEGENINTSTA. General Purpose Custom Interrupt.
- AFEINTSRC_BOOTLDDONE : Bit13, OTP Boot Loading Done
- AFEINTSRC_WAKEUP : Bit14, AFE Woken up
- AFEINTSRC_ENDSEQ : Bit15, End of Sequence Interrupt.
- AFEINTSRC_SEQTIMEOUT : Bit16, Sequencer Timeout Command Finished.
- AFEINTSRC_SEQTIMEOUTERR : Bit17, Sequencer Timeout Command Error.
- AFEINTSRC_CMDFIFOFULL : Bit18, Command FIFO Full Interrupt.
- AFEINTSRC_CMDFIFOEMPTY : Bit19, Command FIFO Empty
- AFEINTSRC_CMDFIFOTHRESH: Bit20, Command FIFO Threshold Interrupt.
- AFEINTSRC_CMDFIFOOF : Bit21, Command FIFO Overflow Interrupt.
- AFEINTSRC_CMDFIFOUF : Bit22, Command FIFO Underflow Interrupt.
- AFEINTSRC_DATAFIFOFULL : Bit23, Data FIFO Full Interrupt.
- AFEINTSRC_DATAFIFOEMPTY: Bit24, Data FIFO Empty
- AFEINTSRC_DATAFIFOTHRESH: Bit25, Data FIFO Threshold Interrupt.
- AFEINTSRC_DATAFIFOOF : Bit26, Data FIFO Overflow Interrupt.
- AFEINTSRC_DATAFIFOUF : Bit27, Data FIFO Underflow Interrupt.
- AFEINTSRC_WDTIRQ : Bit28, WDT Timeout Interrupt.
- AFEINTSRC_CRC_OUTLIER : Bit29, CRC interrupt for M355, Outliers Int for AD5940
- AFEINTSRC_GPT0INT_SLPWUT: Bit30, General Purpose Timer0 IRQ for M355. Sleep or Wakeup Timer timeout for AD5940
- AFEINTSRC_GPT1INT_TRYBRK: Bit31, General Purpose Timer1 IRQ for M355. Tried to Break IRQ for AD5940
- AFE_INTC_ALLINT : All interrupts
State : {bTRUE, bFALSE} - bTRUE: Enable these interrupt source(s)
- bFALSE: Disable interrupt source(s)
- Returns:
- return none.
| void AD5940_INTCClrFlag | ( | uint32_t | AfeIntSrcSel ) |
Clear selected interrupt(s) flag(INTC0Flag and INTC1Flag are both cleared).
- Parameters:
-
AfeIntSrcSel,: Select from AFEINTC_SRC_Const
- Returns:
- return none.
| uint32_t AD5940_INTCGetCfg | ( | uint32_t | AfeIntcSel ) |
| uint32_t AD5940_INTCGetFlag | ( | uint32_t | AfeIntcSel ) |
| BoolFlag AD5940_INTCTestFlag | ( | uint32_t | AfeIntcSel, |
| uint32_t | AfeIntSrcSel | ||
| ) |
Test if selected interrupt source(s) is(are) bTRUE.
- Parameters:
-
AfeIntcSel : {AFEINTC_0, AFEINTC_1} - AFEINTC_0: Read Interrupt Controller 0 flag
- AFEINTC_1: Read Interrupt Controller 1 flag
AfeIntSrcSel,: Select from AFEINTC_SRC_Const
- Returns:
- If selected interrupt source(s) are all cleared, return bFALSE. Otherwise return bTRUE.
| AD5940Err AD5940_LFOSCMeasure | ( | LFOSCMeasure_Type * | pCfg, |
| float * | pFreq | ||
| ) |
Use system clock to measure LFOSC frequency.
- Note:
- Set system clock to external crystal to get a better measurement accuracy. This function use 3 sequences and the start address is specified by parameter.
- Parameters:
-
pCfg,: pointer to structure. pFreq,: Pointer to a variable that used to store frequency in Hz.
- Returns:
- AD5940ERR_OK if succeed.
Sleep wakeup timer running... -SLP----WKP----SLP----WKP----SLP----WKP --|-----|-------------|-------------|------------Trigger sequencer when Wakeup Timer over. --------|SEQA---------|SEQB----------------------Execute SeqA then SeqB ---------|InitT--------|StopT--------------------SeqA start timer and SeqB trigger interrupt so MCU read back current count ------------------------|INT--------------------- -----------------------------------------|Read---We read SEQTIMEOUT register here ---------|-----TimerCount----------------|------- ---------|--------------|---TimerCount2--|-------We change SeqB to reset timer so we measure how much time needed for MCU to read back SEQTIMEOUT register(TimerCount2)
Interrupt flag AFEINTSRC_ENDSEQ will be set after this command. So We can inform MCU to read back current timer value. MCU will need some additional time to read back time count. So we use SeqB to measure how much time needed for MCU to read back
| void AD5940_LPAMPCfgS | ( | LPAmpCfg_Type * | pLpAmpCfg ) |
| void AD5940_LPDAC0WriteS | ( | uint16_t | Data12Bit, |
| uint8_t | Data6Bit | ||
| ) |
| void AD5940_LPDAC1WriteS | ( | uint16_t | Data12Bit, |
| uint8_t | Data6Bit | ||
| ) |
| AD5940Err AD5940_LPDACCal | ( | LPDACCal_Type * | pCalCfg, |
| LPDACPara_Type * | pResult | ||
| ) |
| void AD5940_LPDACCfgS | ( | LPDACCfg_Type * | pLpDacCfg ) |
| void AD5940_LPLoopCfgS | ( | LPLoopCfg_Type * | pLpLoopCfg ) |
| void AD5940_LPModeClkS | ( | uint32_t | LPModeClk ) |
Select system clock source for LPMODE.
- Note:
- Only in LP Mode, this operation takes effect. Enter LPMODE by function AD5940_LPModeEnS.
- Parameters:
-
LPModeClk,: Select from LPMODECLK_Const - LPMODECLK_LFOSC: Select LFOSC 32kHz for system clock
- LPMODECLK_HFOSC: Select HFOSC 16MHz/32MHz for system clock
- Returns:
- none.
| AD5940Err AD5940_LPModeCtrlS | ( | uint32_t | EnSet ) |
When LP mode is enabled, some functions are under control of LPMODECON, rather than original registers.
- Warning:
- LPMODE is key protected, this function only takes effect after AD5940_LPModeEnS(bTRUE) For LP mode, use one register to control most AFE digital and analog block.
The parameter means the blocks. The selected block will be enabled. All others will be disabled. The method to enable/disable blocks are defined by register LPMODECON, either by clearing or setting bits.
- Parameters:
-
EnSet,: A set of blocks that will be enabled. Select it from LPMODECTRL_Const. All others not selected in EnSet will be disabled. - LPMODECTRL_ALDOPWR|LPMODECTRL_HFOSCEN: Turn on ALDO and HFOSC, disable all others.
- LPMODECTRL_ALL: Enable all blocks.
- Returns:
- return none.
| AD5940Err AD5940_LPRtiaCal | ( | LPRTIACal_Type * | pCalCfg, |
| void * | pResult | ||
| ) |
Measure LPTIA internal RTIA impedance with HSTIA.
This is the recommended method for LPTIA RTIA calibration.
- Parameters:
-
pCalCfg,: pointer to calibration structure. pResult,: Pointer to a variable that used to store result. If bPolarResult in structure is set, then use type fImpPol_Type otherwise use fImpCar_Type.
- Returns:
- AD5940ERR_OK if succeed.
Determine the best ADC PGA gain for both RCAL and RTIA voltage measurement.
| AD5940Err AD5940_LPTIAOffsetCal | ( | LPTIAOffsetCal_Type * | pLPTIAOffsetCal ) |
| BoolFlag AD5940_Notch50HzAvailable | ( | ADCFilterCfg_Type * | pFilterInfo, |
| uint8_t * | dl | ||
| ) |
return if the SINC3/SINC2 combination is available for notch 50Hz filter.
If it's not availabe, hardware automatically bypass Notch even if it's enabled.
- Parameters:
-
pFilterInfo the filter configuration, only need sinc2/sinc3 osr and adc data rate information.
- Returns:
- return bTRUE if notch 50Hz filter is available.
| BoolFlag AD5940_Notch60HzAvailable | ( | ADCFilterCfg_Type * | pFilterInfo, |
| uint8_t * | dl | ||
| ) |
return if the SINC3/SINC2 combination is available for notch 60Hz filter.
If it's not availabe, hardware automatically bypass Notch even if it's enabled.
- Parameters:
-
pFilterInfo the filter configuration, need sinc2/sinc3 osr and adc data rate information.
- Returns:
- return bTRUE if notch 60Hz filter is available.
| uint32_t AD5940_ReadAfeResult | ( | uint32_t | AfeResultSel ) |
Read AD5940 generated data like ADC and DFT etc.
- Parameters:
-
AfeResultSel,: available parameters are AFERESULT_Const - AFERESULT_SINC3: Read SINC3 filter data result
- AFERESULT_SINC2: Read SINC2+NOTCH filter result, when Notch filter is bypassed, the result is SINC2
- AFERESULT_STATSVAR: Statistic variance result
- Returns:
- return data read back.
| uint32_t AD5940_ReadReg | ( | uint16_t | RegAddr ) |
| void AD5940_REFCfgS | ( | AFERefCfg_Type * | pBufCfg ) |
| void AD5940_SEQCfg | ( | SEQCfg_Type * | pSeqCfg ) |
| void AD5940_SEQCmdWrite | ( | uint32_t | StartAddr, |
| const uint32_t * | pCommand, | ||
| uint32_t | CmdCnt | ||
| ) |
| void AD5940_SEQCtrlS | ( | BoolFlag | SeqEn ) |
| uint32_t AD5940_SEQCycleTime | ( | void | ) |
| void AD5940_SEQGenCtrl | ( | BoolFlag | bFlag ) |
Start or stop the sequencer generator.
Once started, the register write will be recorded to sequencer generator. Once it's disabled, the register write is written to AD5940 directly by SPI bus.
- Parameters:
-
bFlag,: Enable or disable sequencer generator.
- Returns:
- Return None.
| AD5940Err AD5940_SEQGenFetchSeq | ( | const uint32_t ** | ppSeqCmd, |
| uint32_t * | pSeqLen | ||
| ) |
| void AD5940_SEQGenInit | ( | uint32_t * | pBuffer, |
| uint32_t | BufferSize | ||
| ) |
Initialize sequencer generator with specified buffer.
The buffer is used to store sequencer generated and record register value changes. The command is stored from start address of buffer while register value is stored from end of buffer. Buffer[0] : First sequencer command; Buffer[1] : Second Sequencer command; ... Buffer[Last-1]: The second register value record. Buffer[Last]: The first register value record.
- Parameters:
-
pBuffer,: Pointer to the buffer. BufferSize,: The buffer length.
- Returns:
- Return None.
| void AD5940_SEQGenInsert | ( | uint32_t | CmdWord ) |
Manually input a command to sequencer generator.
- Parameters:
-
CmdWord,: The 32-bit width sequencer command word. Sequencer_Helper can be used to generate commands.
- Returns:
- None;
| AD5940Err AD5940_SEQGetCfg | ( | SEQCfg_Type * | pSeqCfg ) |
| void AD5940_SEQGpioCtrlS | ( | uint32_t | Gpio ) |
Control GPIO with register SYNCEXTDEVICE.
Because sequencer have no ability to access register GPIOOUT, so we use this register for sequencer.
- Parameters:
-
Gpio : Select from {AGPIO_Pin0|AGPIO_Pin1|AGPIO_Pin2|AGPIO_Pin3|AGPIO_Pin4|AGPIO_Pin5|AGPIO_Pin6|AGPIO_Pin7} - The combination of GPIO pins. The selected pins will be set to High. Others will be pulled low.
- Returns:
- return None.
| AD5940Err AD5940_SEQGpioTrigCfg | ( | SeqGpioTrig_Cfg * | pSeqGpioTrigCfg ) |
Configure GPIO to allow it to trigger corresponding sequence(SEQ0/1/2/3).
There are four sequences. We can use GPIO to trigger each sequence. For example, GP0 or GP4 can be used to trigger sequence0 and GP3 or GP7 to trigger sequence3. There are five mode available to detect pin action: Rising edge, falling edge, both rising and falling edge, low level or high level. Be careful to use level detection. The trigger signal is always available if the pin level is matched. Once the sequence is done, it will immediately run again if the pin level is still matched.
- Returns:
- return AD5940ERR_OK if succeed.
| void AD5940_SEQHaltS | ( | void | ) |
| void AD5940_SEQInfoCfg | ( | SEQInfo_Type * | pSeq ) |
Initialize Sequence INFO.
There are four set of registers that record sequence information. The info contains command start address in SRAM and sequence length. Hardware can automatically manage these four sequences. If the application requires more than 4 sequences, user should manually record the sequence Info(address and length) in MCU.
- Parameters:
-
pSeq,: Pointer to configuration structure. Specify sequence start address in SRAM and sequence length.
- Returns:
- return none.
| AD5940Err AD5940_SEQInfoGet | ( | uint32_t | SeqId, |
| SEQInfo_Type * | pSeqInfo | ||
| ) |
Get sequence info: start address and sequence length.
- Parameters:
-
SeqId,: Select from {SEQID_0, SEQID_1, SEQID_2, SEQID_3} - Select which sequence we want to get the information.
pSeqInfo,: Pointer to sequence info structure.
- Returns:
- return AD5940ERR_OK when succeed.
| void AD5940_SEQMmrTrig | ( | uint32_t | SeqId ) |
| uint32_t AD5940_SEQTimeOutRd | ( | void | ) |
| void AD5940_ShutDownS | ( | void | ) |
Turn off LP-Loop and put AFE to hibernate mode;.
By function AD5940_EnterSleepS, we can put most blocks to hibernate mode except LP block. This function will shut down LP block and then enter sleep mode.
- Returns:
- return none.
| void AD5940_SleepKeyCtrlS | ( | uint32_t | SlpKey ) |
LPMode_Block_Functions.
Enter sleep mode key to unlock it or enter incorrect key to lock it. \ Once key is unlocked, it will always be effect until manually lock it
- Parameters:
-
SlpKey : {SLPKEY_UNLOCK, SLPKEY_LOCK} - SLPKEY_UNLOCK Unlock Key so we can enter sleep(or called hibernate) mode.
- SLPKEY_LOCK Lock key so AD5940 is prohibited to enter sleep mode.
- Returns:
- return none.
| AD5940Err AD5940_SoftRst | ( | void | ) |
| void AD5940_StatisticCfgS | ( | StatCfg_Type * | pStatCfg ) |
| void AD5940_StructInit | ( | void * | pStruct, |
| uint32_t | StructSize | ||
| ) |
| void AD5940_SweepNext | ( | SoftSweepCfg_Type * | pSweepCfg, |
| float * | pNextFreq | ||
| ) |
void AD5940_SweepNext(SoftSweepCfg_Type *pSweepCfg, float *pNextFreq) For sweep function, calculate next frequency point according to pSweepCfg info.
- Returns:
- Return next frequency point in Hz.
| void AD5940_SWMatrixCfgS | ( | SWMatrixCfg_Type * | pSwMatrix ) |
| uint32_t AD5940_WakeUp | ( | int32_t | TryCount ) |
Try to wakeup AD5940 by read register.
Any SPI operation can wakeup AD5940. AD5940_Initialize must be called to enable this function.
- Parameters:
-
TryCount Specify how many times we will read register. Zero or negative number means always waiting here.
- Returns:
- How many times register is read. If returned value is bigger than TryCount, it means wakeup failed.
| void AD5940_WGCfgS | ( | WGCfg_Type * | pWGInit ) |
| AD5940Err AD5940_WGDACCodeS | ( | uint32_t | code ) |
| void AD5940_WGFreqCtrlS | ( | float | SinFreqHz, |
| float | WGClock | ||
| ) |
| uint32_t AD5940_WGFreqWordCal | ( | float | SinFreqHz, |
| float | WGClock | ||
| ) |
Calculate sine wave generator frequency word.
The maxim frequency is 250kHz-1LSB
- Parameters:
-
SinFreqHz : Target frequency in Hz unit. WGClock,: Waveform generator clock frequency in Hz unit. The clock is sourced from system clock, default value is 16MHz HFOSC.
- Returns:
- return none.
| void AD5940_WriteReg | ( | uint16_t | RegAddr, |
| uint32_t | RegData | ||
| ) |
| void AD5940_WUPTCfg | ( | WUPTCfg_Type * | pWuptCfg ) |
| void AD5940_WUPTCtrl | ( | BoolFlag | Enable ) |
| AD5940Err AD5940_WUPTTime | ( | uint32_t | SeqId, |
| uint32_t | SleepTime, | ||
| uint32_t | WakeupTime | ||
| ) |
Configure WakeupTimer.
- Parameters:
-
SeqId,: Select from SEQID_0/1/2/3. The wakeup timer will load corresponding value from four sets of registers. SleepTime,: After how much time, AFE will try to enter hibernate. We disabled this feature in AD59840_Initialize. After this timer expired, nothing will happen. WakeupTime,: After how much time, AFE will wakeup and trigger corresponding sequencer.
- Note:
- By SleepTime and WakeupTime, the sequencer is triggered periodically and period is (SleepTime+WakeupTime)
- Returns:
- return none.
Generated on Tue Jul 12 2022 21:32:08 by
1.7.2