你好,我使用的是28075芯片,希望通过使用CMPSS来实现采样到过流时,封PWM脉冲。然而我配置后,发现采样未达到我设的COMPL比较器的DAC的下限值,便就已经使得COMPL的输出为高了。我的配置如下
//Cmpss 1
//Enable CMPSS
Cmpss1Regs.COMPCTL.bit.COMPDACE = 1;
//NEG signal comes from DAC
Cmpss1Regs.COMPCTL.bit.COMPHSOURCE = NEGIN_DAC;
Cmpss1Regs.COMPCTL.bit.COMPLSOURCE = NEGIN_DAC;
//Use VDDA as the reference for DAC
Cmpss1Regs.COMPDACCTL.bit.SELREF = REFERENCE_VDDA;
Cmpss1Regs.COMPDACCTL.bit.DACSOURCE = 0;
Cmpss1Regs.COMPDACCTL.bit.SWLOADSEL = 0;
//Set DAC to midpoint for arbitrary reference
Cmpss1Regs.DACHVALS.bit.DACVAL = 2867;
Cmpss1Regs.DACLVALS.bit.DACVAL = 2253;
Cmpss1Regs.COMPCTL.bit.COMPHINV = 0; //高比较器不取反
Cmpss1Regs.COMPCTL.bit.COMPLINV = 1; //低比较器取反
// Configure CTRIPOUT path
//Asynch output feeds CTRIPH and CTRIPOUTH
Cmpss1Regs.COMPCTL.bit.CTRIPHSEL = CTRIP_ASYNCH;
Cmpss1Regs.COMPCTL.bit.CTRIPLSEL = CTRIP_ASYNCH;
//Configure TRIP4 to be CTRIP1H or CTRIP1L
EPwmXbarRegs.TRIP4MUX0TO15CFG.bit.MUX0 = 1;
//Enable TRIP4 Mux for Output
EPwmXbarRegs.TRIP4MUXENABLE.bit.MUX0 = 1;
这样配置原本是希望采样值采到的结果小于COMPL比较器的DAC值,也就是2253时让COMPL输出高电平,然而实验发现ADC采样结果寄存器的值等于2400附近时,COMPL就已经输出高电平了。想问下这是为什么?是不是我哪里配置有问题。(PS:当ADC采样结果寄存器的值等于2500附近时,则COMPL输出为低,是正常现象,所以我COMPL的输出取反了,应该是对的)。
user4373386:
回复 Howard Zou:
对,找到问题所在了,以前用的芯片,ADC的参考就是VDDA,没想到28075的ADC参考和VDDA不是同一个,所以造成这个问题。我这边ADC参考是3V,VDDA是3.3V