Part Number:TMS320F28379D
Dear all,
I have trouble with analog comparator module of F29379D. I have set the required registers and applied sin wave to positive pin of comparator. After that, I have connect negative input of the comparator to DAC. However, unfortunately, I could not observe a toggled output.
Here is the settings for comparator module;
EALLOW; Cmpss1Regs.COMPLOCK.all = 0; Cmpss1Regs.COMPCTL.bit.COMPDACE = 1; //comparator/DAC enable Cmpss1Regs.COMPCTL.bit.ASYNCHEN = 1; //High comparator asynchronous path enable Cmpss1Regs.COMPCTL.bit.CTRIPOUTHSEL = 0; //Asynchronous comp output drives CTRIPOUTH signal (to the outputxbar) Cmpss1Regs.COMPCTL.bit.CTRIPHSEL = 0; //" " " " (to the epwm xbar) Cmpss1Regs.COMPCTL.bit.COMPHINV = 0; //non-inverting output of comparator Cmpss1Regs.COMPCTL.bit.COMPHSOURCE = 0; //negative input is connected to DAC register Cmpss1Regs.COMPHYSCTL.bit.COMPHYS = 0; //no hysteresis Cmpss1Regs.COMPDACCTL.bit.SWLOADSEL = 0; //load DAC value with system clock Cmpss1Regs.COMPDACCTL.bit.SELREF = 0; //DAC reference selection, select VDDA Cmpss1Regs.COMPDACCTL.bit.DACSOURCE = 0; //update the DAC from DACVAL register(or ramp generator) Cmpss1Regs.DACHVALS.bit.DACVAL = 100; //the value which is loaded to DAC Cmpss1Regs.CTRIPHFILCTL.bit.FILINIT = 0; //filter has no effect // Configure CTRIPOUTH output pin // Configure OUTPUTXBAR3 to be CTRIPOUT1H // OutputXbarRegs.OUTPUT3MUX0TO15CFG.bit.MUX0 = 0; // //Enable OUTPUTXBAR3 Mux for Output // OutputXbarRegs.OUTPUT3MUXENABLE.bit.MUX0 = 1; EDIS;
and the output pin configuration;
GpioCtrlRegs.GPAMUX1.bit.GPIO14 = 6; //set GPIO14 pin as OUTPUTXBAR3
I could not understand what is the problem.
I will be waiting for your offer.
Regards;
Fahri