Dear all,
I am trying to configure the analog comparators in order to implement over current protection but I have some problems. Here are the steps that I test.
1. I configured the FaultMux registers. I supplied voltage to the corresponding ADC pin with an external supply. When the voltage is below the threshold, PWMs are on and above the threshold, PWMs turn off. It means my configuration is OK.
Here is the configuration:
FaultMuxRegs.ACOMPCTRL0.bit.ACOMP_B_THRESH = 85;
FaultMuxRegs.ACOMPCTRL0.bit.ACOMP_EN = 1; //Enable analog comparators
FaultMuxRegs.ACOMPCTRL0.bit.ACOMP_B_SEL = 0; //Configures reference of analog comparator B to ACOMP_B_THRESH
FaultMuxRegs.ACOMPCTRL0.bit.ACOMP_B_POL = 1; //Polarity of comparator when an event is detected.FaultMuxRegs.DPWM0FLTABDET.bit.ACOMP_B_EN = 1;
FaultMuxRegs.DPWM0FLTABDET.bit.ACOMP_B_EN = 1;
Dpwm0Regs.DPWMFLTCTRL.bit.ALL_FAULT_EN = 1;
Dpwm0Regs.DPWMFLTCTRL.bit.AB_MAX_COUNT = 4;
2. I tested the bidirectional current sense amplifier. There was no connection between output of current sense amplifier and analog comparator. When my converter operates, I checked the output of the current sense amplifier and it works properly. I mean it gave 1.25 V offset when there is no current flowing. I tested it in both directions in terms of current and gave the proper output. So there is no problem here.
3. I connected the output of the current sense amplifier and analog comparator but I commented out the last two lines which are DPWM0Regs lines. Also is shown below. Again there was no problem. I got again 1.25 V offset and when I operated the converter, proper output values are taken.
FaultMuxRegs.ACOMPCTRL0.bit.ACOMP_B_THRESH = 85;
FaultMuxRegs.ACOMPCTRL0.bit.ACOMP_EN = 1; //Enable analog comparators
FaultMuxRegs.ACOMPCTRL0.bit.ACOMP_B_SEL = 0; //Configures reference of analog comparator B to ACOMP_B_THRESH
FaultMuxRegs.ACOMPCTRL0.bit.ACOMP_B_POL = 1; //Polarity of comparator when an event is detected.FaultMuxRegs.DPWM0FLTABDET.bit.ACOMP_B_EN = 1;
FaultMuxRegs.DPWM0FLTABDET.bit.ACOMP_B_EN = 1;
//Dpwm0Regs.DPWMFLTCTRL.bit.ALL_FAULT_EN = 1;
//Dpwm0Regs.DPWMFLTCTRL.bit.AB_MAX_COUNT = 4;
4. In the final step, the commented lines in the previous step are uncommented and the connection of current sense amplifier and analog comparator still exists. When I only supply power to current sense amplifier not to converter, output of the current sense amplifier suddenly jumps to 4 V and all PWMs are turned off.
Is it a configuration problem or is it caused by current sense amplifier?
I would be appreciated if someone helps me. Thanks in advanced.
Kind Regards,
Merih