This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/UCD3138A: question about analog comparator

Part Number: UCD3138A

Tool/software: Code Composer Studio

The register of CMP setting by the code as follow:

FaultMuxRegs.ACOMPCTRL1.bit.ACOMP_C_THRESH = 30;

FaultMuxRegs.ACOMPCTRL1.bit.ACOMP_C_SEL = 0; 
FaultMuxRegs.ACOMPCTRL1.bit.ACOMP_C_POL = 0;

But i don't set the register bit of FaultMuxRegs.DPWM0FLTABDET.bit.ACOMP_C_EN. And i find the default value of ACOMP_C_EN is 0. but i find when the compare input blew the register of ACOMP_C_THRESH, the pwm output will be disable. why? i think the pwm output need to be disable when the bit of ACOMP_C_EN is 1.

  • Hi, Liwei,

    DPWM could be shut off by some other protection. You can try to disable comparator to verify this.

    You can check ADC protection, DPWM0FAULTDET. Maybe they shut off DPWM.

    Regards,
    Sean

  • Hi, Sean:
    The register of DPWM0FAULTDET is also disable. So i think that DPWM is not shutdown by them. any else?
  • Do you have interrupt enabled? Maybe it is shutdown in the firmware. You can disable comparator and see what happens.

  • which interrupt do yo mean? it have two interrupt: one is DPWM and another is CMP. You can see the code above that i have disable the CMP interrupt as the bit of FaultMuxRegs.DPWM0FLTABDET.bit.ACOMP_C_EN is 0. But PWM also is off. I don't know why it is?
  • ???????????????
  • Hi Liwei,

    Can you please post your entire initialization code? You'd better to read all the bit's value in FaultMux Register through memory debugger.

    How many analog comparators are used to shutdown DPWM0?

    I think you can refer to lab training code or any of TI's demo EVM code(like PFC) on how to configure the analog comparator to shut down DPWM.
  • Jack:
    How can i give you the initialization code? please give me your email address.
    Yes. I refer the demo EVM code. But i don't know where i set error or other. I have disable the CMP but the DPWM still shutdown.
    Thanks!
  • You can click on 'Insert code, Attached files and more...' to go to rich format, and insert your code.
  • Jack:
    I have sent the message to you. If i use the define for disable the CMP, but the cmp still occur and shutdown off the DPWM.
  • Please try a solution on clearing the bit ALL_FAULT_EN in DPWMFLTCTRL register, I believe you will get the result what you want.

    inline void init_pwm_protection(void)
    {
    volatile UINT32 tmp;

    Dpwm0Regs.DPWMFLTCTRL.bit.ALL_FAULT_EN = 0; //1;
    Dpwm0Regs.DPWMFLTCTRL.bit.AB_MAX_COUNT = MAX_FAULT_COUNT; // Set count for latched faults
    Dpwm0Regs.DPWMFLTCTRL.bit.A_MAX_COUNT = MAX_FAULT_COUNT; // Set count for latched faults
    Dpwm0Regs.DPWMFLTCTRL.bit.B_MAX_COUNT = MAX_FAULT_COUNT; // Set count for latched faults

    Dpwm1Regs.DPWMFLTCTRL.bit.ALL_FAULT_EN = 0;//1;
    Dpwm1Regs.DPWMFLTCTRL.bit.AB_MAX_COUNT = MAX_FAULT_COUNT; // Set count for latched faults
    Dpwm1Regs.DPWMFLTCTRL.bit.A_MAX_COUNT = MAX_FAULT_COUNT; // Set count for latched faults
    Dpwm1Regs.DPWMFLTCTRL.bit.B_MAX_COUNT = MAX_FAULT_COUNT; // Set count for latched faults

    Dpwm2Regs.DPWMFLTCTRL.bit.ALL_FAULT_EN = 0;//1;
    Dpwm2Regs.DPWMFLTCTRL.bit.AB_MAX_COUNT = MAX_FAULT_COUNT; // Set count for latched faults
    Dpwm2Regs.DPWMFLTCTRL.bit.A_MAX_COUNT = MAX_FAULT_COUNT; // Set count for latched faults
    Dpwm2Regs.DPWMFLTCTRL.bit.B_MAX_COUNT = MAX_FAULT_COUNT; // Set count for latched faults

    Dpwm3Regs.DPWMFLTCTRL.bit.ALL_FAULT_EN = 0;//1;
    Dpwm3Regs.DPWMFLTCTRL.bit.AB_MAX_COUNT = MAX_FAULT_COUNT; // Set count for latched faults
    Dpwm3Regs.DPWMFLTCTRL.bit.A_MAX_COUNT = MAX_FAULT_COUNT; // Set count for latched faults
    Dpwm3Regs.DPWMFLTCTRL.bit.B_MAX_COUNT = MAX_FAULT_COUNT; // Set count for latched faults

    tmp = FaultMuxRegs.FAULTMUXINTSTAT.all; //Clear all interrupt flags.
    FaultMuxRegs.ACOMPCTRL0.bit.ACOMP_EN = 1; //Enable analog comparators for now
    }