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.

How to start ADC simultaneously form an external trigger (F28337D )?

Other Parts Discussed in Thread: CONTROLSUITE

I am working with F28337D MCU. I am very new with this MCU (I used C6748 DSP earlier). I am using the TMS320F2833D Experimenter kit + control card.

I need to start ADC-Ax and ADC-Bx in 16-bit mode, simultaneously using a HW external trigger. I figured out that I have select the GPIO XINT2 (ADCEXTSOC is this a pin?) as trigger input but I could not figure out how I can do this.

The trigger signal should be one of the output of an internal comparator (Zero cross detecting) multiplied by 2^N (N=6-10) with a PLL. I wonder how can I do this with F28337D? If the MCU (ePWM?) cannot do this then can anybody suggest an external PLL chip which works on low frequencies (50Hz to 1kHz)?

Thanks for your help.
Louis

  • Hi Louis,

    Ok, first the simultaneous part:

    Each ADC SOC has the following three configurations: ACQPS, trigger, and channel select.  If we look at the following example in ControlSUITE: C:\ti\controlSUITE\device_support\F2837xD\v150\F2837xD_examples_Cpu1\adc_soc_epwm\cpu01.  You will see these lines of code:

    AdcaRegs.ADCSOC0CTL.bit.CHSEL = channel; //SOC0 will convert pin A0
    AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is 100 SYSCLK cycles
    AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C

    Which are setting up SOC0 on ADCA.  To get simultaneous operation, just setup two SOCs on two ADCs with identical trigger and ACPQS values:

    AdcaRegs.ADCSOC0CTL.bit.CHSEL = 0; //SOC0 will convert pin A0 (12-bit mode) or A0/A1 (16-bit mode).
    AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is 100 SYSCLK cycles
    AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C

    AdcbRegs.ADCSOC0CTL.bit.CHSEL = 2; //SOC0 will convert pin B2 or B2/B3.
    AdcbRegs.ADCSOC0CTL.bit.ACQPS = acqps; //sample window is 100 SYSCLK cycles
    AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = 5; //trigger on ePWM1 SOCA/C

    As long as there aren't other SOCs configured on one ADC that aren't configured on the other, the ADCs will operate synchronously.  As far as 16-bit mode, this is a global setting in each ADC module (it affects all the conversions for that ADC), so you will want to set both ADCs to 16-bit, differential mode.  Note that the channel settings can be different, depending on what channels you want to convert simultaneously (can be any channels from each of the ADCs). Also note that 16-bit channels are differential, so it is actually a pair of channels.

    The above snippet will trigger on ePWM1 SOCA event.  You can change this to something else by chaning '5' in both configurations to something else (including the value for external pin XINT2).  I am not sure if this is what you want though. Can you clarify a little bit on exactly what you want to happen with the comparator triggering the ePWM?  If the threshold is crossed, do you want the trigger to the ADC to be delayed between 2^6 and 2^10 cycles?  What determines the length of these cycles (is it SYSCLK, a divided down SYSCLK, or some other asynchronous clock?).

  • Hi Devin,

    Thanks for the reply. This will help me getting started.

    Excuse me if my question was not clear. This is a special FFT application. The sampling must be in sync with the frequency of the input signal. For example if the input signal frequency is 100Hz and we need 1024-point FFT then we need to set the sampling frequency to 100 * 1024 = 102.400 kHz. This is necessary to avoid the “spectral leakage” of FFT (which happens when we do not have integer periods of the input signal sampled).

    We have two input channels. (Same frequency but different phase). The INPUT_A channel will be connected to ADCA.Channel0-1 and the INPUT_B channel to ADCB.channel0-1. The INPUT_A channel also will be connected to COMPA comparator's + input, the VREF/2 to COMPA - input. The COMPA should be configured to change the output at every rising edge. The COMPA output is connected:

    1. To the input of the external (?) PLL which multiplies it with 1024 (2^N). This is the sampling signal of ADCA and ADCB.
    2. To the channel 1 of the eCAPx to measure the period time of the input signal.

    So what do you think?
    Best regards,
    Louis

  • Hi Louis,
    I am not sure that it will be possible to have the sampling frequency be fully coherent with the input signal if the input signal frequency is changing. The sampling frequency eventually must be an integer multiple of the SYSCLK (even if an external triggering signal is syncronized with the input signal, the samples still end up syncronous with SYSCLK). The preferred way to limit the spectral leakage would probably be to use a windowing function. I think you would still want to use the comparator -> eCAP to continuously measure the input signal frequency, and adjust the sampling frequency as needed to be in the ballpark of the desired number of input cycles per record.
  • Hi Devin,

    This PLL based system works (since 2003) with a Silicon Labs 8051F120 and 8051F060 8-bit CPUs just fine. Now we need to simplify the design and move to the 32-bit CPU platform using the latest technologies.

    What I wonder originally was how can I configure a GPIO (and which one) to start the ADCA and ADCB at the same time form a single MCU pin? It would be nice if the MCU would contain a low frequency PLL but the internal PLL(s) can only be used for generating SYSCLK.

    Best regards,
    Louis

  • Alright, lets start with the GPIO -> ADC triggering.  As I mentioned before, to get the ADC conversions to be simultaneous, setup ADC SOCs on each ADC with identical trigger and acqps settings.  If you want that trigger to be an external pin, then use a trigger setting of 4 for the desired SOCs:

    The ADCEXTSOC signal is documented in the section for the Input X-BAR.  This signal is coming from input 5:

    The configuration is pretty straightforward, you can select any of the GPIOs on the device:

     

    Now how to get the signal from the comparator to be output on a pin...again, use an X-BAR, but this time it is the output X-BAR:

      

    You can route to any of the 8 output X-bar lines by configuring that output line to select the comparator trip that you want (you have many options here; read the output xbar documentation in the TRM). 

    Once the output XBAR line is configured, there is one more step to get the signal to a pin: configure the GPIO mux.  You want to select a GPIO as output, and select the mux position that gives one of the outputs:

    As far as implementing a pll, maybe you could implement a software pll using an ePWM timer or CPU timer?  Every time the comparator trips, record the timer count.  Adjust the period of the timer so that 1024 periods line up as close as possible with the comparator trip.  Use the timer to trigger the ADC. You may also need to use the eCAP to get the timer period in the right ball-park.

  • Hi Devin,

    Excellent, this is what I needed. Your idea about the „software PLL” is amazing good. Many thanks for your help!!!

    Best regards,
    Louis