Hi! I am working on a Piccolo ControlStick (F28069). Currently I am trying to set up the comparator for using it in current-mode control of a power converter -- in principle a buck, but it could be used for other topologies.
On a first approach, I tried to trip the PWM based on the analog comparator connected to an external source (max. 3V); in spite of starting the program with 0 V, the PWM outputs were forced by the trip zone. After re-reading the PWM reference manual, some other posts on this forum, and re-writing my code, I have realized that the comparator input pin is being set to high after I enable it.
In fact, my program currently reads:
void main (void)
{
InitSysCtrl (); /* initializes peripheral clocks and PLL */
EALLOW;
GpioCtrlRegs.AIOMUX1.bit.AIO2 = 0x3; /* disable AIO to use COMP -- this line does not change anything! */
Comp1Regs.COMPCTL.bit.COMPDACEN = 1;
EDIS;
EINT; /* enable master interrupt */
for (;;)
{
}
}
I have also checked the comparator pin of the stick with a working program (whose source code is not provided) and its associated board, and it did work. But if this program is run without board, the pin is set again to high. If I set the voltage at the pin, it already trips the PWM outputs -- this means, everything happens inside the microcontroller.
My question is, why is this "input" pin set high? Do I have to set up the comparator registers in a concrete sequence?
Thank you very much in advance.