Comparator Frequency detection mode

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Comparator Frequency detection mode

1,233 次查看
jagadeeshsurnen
Contributor II

we are having issues with frequency measurement. we saw DAC disabled in the comments but in the defination structure we noticed that DACEN bit is SET which is enabled.can you help me out in setting comparator frequency detection.
/**************************************************************************/ /*!
* @brief Comparator Frequency Detection Setting:
* - filter disabled,
* - hysteresis 5mv,
* - sample, windowing and trigger modes disabled,
* - high speed mode,
* - non-inverting polarity,
* - unfiltered signal propagated to output (disabled),
* - comparator enabled,
* - CMP filter disabled when CR1[SE]=0,
* - IRQ and DMA disabled,
* - DAC disabled.
*****************************************************************************/
#define CMP_FREQ_DETECT_MODE_CONFIG_EN_DAC(dac) \
(tCMP){ \
/* CR0 */ SET(CMP_CR0_FILTER_CNT(0)) |SET(CMP_CR0_HYSTCTR(3)), \
/* CR1 */ CLR(CMP_CR1_SE_MASK) |CLR(CMP_CR1_WE_MASK)| \
CLR(CMP_CR1_TRIGM_MASK) |SET(CMP_CR1_PMODE_MASK)| \
CLR(CMP_CR1_INV_MASK) |CLR(CMP_CR1_COS_MASK)| \
CLR(CMP_CR1_OPE_MASK) |SET(CMP_CR1_EN_MASK), \
/* FPR */ SET(CMP_FPR_FILT_PER(0x00)), \
/* SCR */ CLR(CMP_SCR_DMAEN_MASK) |CLR(CMP_SCR_IER_MASK)| \
CLR(CMP_SCR_IEF_MASK), \
/* DACCR */ SET(CMP_DACCR_DACEN_MASK) |CLR(CMP_DACCR_VRSEL_MASK)| dac \
}

Regards,

jagadeesh

0 项奖励
回复
5 回复数

957 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

Would you please tell us where can I get that example code?
So that I can help you check the problem easier.

If you need the DAC output as one of Reference Input, then you should enable this bit.

DACEN.PNG

Best Regards

Robin

0 项奖励
回复

957 次查看
jagadeeshsurnen
Contributor II

Hi robin,

i took the reference from

https://www.nxp.com/webapp/Download?colCode=KMSWDRVAPIRM_SW .

Regards,

jagadeesh

0 项奖励
回复

957 次查看
Robin_Shen
NXP TechSupport
NXP TechSupport

I didn't find CMP_FREQ_DETECT_MODE_CONFIG_EN_DAC in cmp_test example(C:\Freescale\KM128SWDRV_R4_1_6\build\iar_7_40\projects\cmp_test)

Only find Comparator Frequency Detection Setting in DRM143SW(Kinetis M One-phase power meter Design Reference Manual )
Have you refer that example?

Comparator Frequency Detection Setting.PNG

Phase Voltage Frequency Measurement.PNG

Best Regards

Robin

957 次查看
jagadeeshsurnen
Contributor II

hi robin ,

thanks for your help, got the frequency measurement. there was a problem with V2REF.

BR,

jagadeesh

0 项奖励
回复

957 次查看
jagadeeshsurnen
Contributor II

hi robin,

yes, i have referred that example.

Best Regards,

jagadeesh

0 项奖励
回复