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.

UCD3138A: UCD3138A and start of continuous conversions in ADC12

Part Number: UCD3138A

Dear TI,

in our design based on UCD3138A we're using channels 0, 1, and 4 of ADC12 for measuring input voltage, output voltage and current. The ADC12 is configured to be triggered by DPWM0 event1. I observe strange behaviour which I don't understand. Could you, please, help me understand what is going on?

After power-on, my firmware initializes blocks of UCD3138A. In particular, it initializes ADC12 and DPWM0, but keeps DPWM0 disabled.
Then the firmware waits for a command to enable DPWM0. After DPWM0 gets enabled, ADC12 performs the conversions, as expected.
Then the firmware listens for a command to disable DPWM0. And here is the thing which I don't understand: after disabling DPWM0 ADC12 still keeps performing the conversions.

The (I think) important values in the registers are, after initialization:

ADCCTRL:  0x0010C721
DPWMCTRL0: 0x00000002
DPWMCTRL1: 0x00018400
DPWMCTRL2: 0x00000005

after the command to enable DPWM0 the firmware changes are:

DPWMCTRL1: 0x00018000
DWPMCTRL0: 0x00000003

and again after the command to disable DPWM0 register DPWMCTRL1 and DWPMCTRL0 are restored to initial values.

My problem is that I need to have the values read also after initialization, but since I don't understand what is going on, I'm not sure what is the proper solution. Please, let me know if I'm missing something, doing something incorrectly, or if it just works this way.

Best regards,
Adam

DPWMCTRL1: 0x00018000
DWPMCTRL0: 0x00000003

  • I think you need to set bit 3 in ADCCTRL.  It's the single sweep bit.  If you don't set it, after a trigger, the ADC runs continuously.  If you set bit 3, then it will do a single sweep and stop.  

  • Since you rejected my response, but didn't provide any more information, I'll try both guessing and asking a question:

    1. If you are asking how to run the ADC before starting DPWM0, That should be easy - just set the SW_START bit in the ADCCTRL register.  Depending on the state of the Single sweep bit, you'll get either a single sweep, or continuously repeated sweeps.

    2. The question is - did you try setting bit 3?

    We generally don't use the DPWM to trigger the ADC because the ADC isn't particularly fast compared to typical switching speeds.  The EADC on the front ends is fast and has very precisely adjustable timing.  

  • Hi Ian,

    yes, you are right, I'm sorry for rejecting the answer prematurely. I misunderstood the part "it will do a single sweep and stop" in your answer. In the settings which you have suggested ADC will stop, but then a new conversion will be started next time the trigger signal becomes active, and this will repeat. This mode of operation is pretty unusual, but looks very handy.

    In this case I'm not using ADC for regulation of voltage (here EADC is used), but for monitoring the conditions of operation. ADC should be fine for this purpose, I guess.

    Best regards,
    Adam