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/TMS320F28379D: How to select ADC1-B2

Part Number: TMS320F28379D

Tool/software: Code Composer Studio

Hello

I am trying to measure the voltage at pin 31 of the TI Experimenterkit (TMS320F28379D).

Until now, all the other ADC conversions worked fine, using the code below:

    //------------------------------
    //Current measurement in line 1 - SOC0
    //------------------------------
    AdcaRegs.ADCSOC0CTL.bit.CHSEL = SENSE_LEM1;      //SOC0 will convert pin ADC1A0
    AdcaRegs.ADCSOC0CTL.bit.ACQPS = acqps;             //sample window
    AdcaRegs.ADCSOC0CTL.bit.TRIGSEL = 0x05;         //trigger on ePWM1 SOCA, see page 1347/2472 in datasheet for an overview

I am now trying to set up an ADC that measures at pin 31, which should be ADC1-B2, according to the controlcard pinout.

In the reference manual, p 1357/2472, I however do not find this B2; they all refer to the pins as ADCIN0, ADCIN1, ADCIN2, ...and I used these (I guess) for the ADC1-A1 (ADCIN1).

I am however wondering how to select this pin? The B does not stand for the ADC2 right?

Could someone help me out on this?

  • Hi, Simon
    In F28379D there is a new ADC architecture: there are 4 ADCs (A, B, C, D) with 8 inputs each.
    And in future, i guess, TI can put as much ADCs as it wants - that's why they don't refer to each ADC separately. Instead they describe one ADC with its 8 inputs, refeereing like "ADCIN1", since all ADC have same structure. For ADC-B this inpur will be "ADCINB1", for example, or whatever you want.

    Back to your question: if you want to measure ADCIN1 intput of ADC-B you have to use registers for ADCB - AdcbRegs.ADCSOC0CTL etc. In your post there is a code for "AdcaRegs". Just copy it and change "AdcaRegs" to "AdcbRegs" and the try to run your project.

    Hope this helps.
  • Hello Disona

    Thanks for your reply :) It becomes more clear to me now.
    I checked again and the pin is apparently connected to ADC C-2, so I changed my code to:
    AdccRegs.ADCSOC1CTL.bit.CHSEL = SENSE_Vout; //SOC1 will convert pin ADC C2
    AdccRegs.ADCSOC1CTL.bit.ACQPS = acqps;
    AdccRegs.ADCSOC1CTL.bit.TRIGSEL = 0x05; //Deze staat nu getriggerd op dezelfde als de ingangsspanningsmeting, kan/mag dit?

    But in the debug window, I have the impression that it's still not working. All my other ADC results are constantly blinking yellow and updating their measured values but this one does not do anything and has a constant value of 18084. Is it possible that the trigsel needs to be adapted somehow? I am now triggering on EPWM1, SOCA, which works fine for adc A0...
  • Hmm...
    The code looks fine to me. FYI you can use ADCSOC0CTL for ADC-C. Each ADC has its own SOCCTL registers.
    Have you called "AdcSetMode()" function with ADCb arguments in the beginning of your code?

    For example, this is how my code looks (checked and tested):

    	// Trigger Timer Init
        EPwm4Regs.TBPRD = (CPU_FREQ / 2)* 1000 / ADC_OPS_FREQ / 2 - 1;	// (200 MHz / 2 (EPWM clock is 100 MHz, not 200 MHz)) / 64 kHz / 2(UpDown)
    
        EPwm4Regs.ETSEL.bit.SOCAEN = 1;		// enable SOCA
        EPwm4Regs.ETSEL.bit.SOCASEL = 1;	// SOC when timer = 0
        EPwm4Regs.ETPS.bit.SOCAPRD = 1;		// generate pulse on 1st event
        EPwm4Regs.TBCTL.bit.CLKDIV = TB_DIV1;
        EPwm4Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1;
        EPwm4Regs.TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN;
    	// ADC init
        EALLOW;
        AdcaRegs.ADCCTL2.bit.PRESCALE = 6;                                  //set ADCCLK divider to /4
        AdcSetMode(ADC_ADCA, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);  // Non-differential signal, 12 bit resolution
        AdcaRegs.ADCCTL1.bit.INTPULSEPOS = 1;                               // Interrupt right after S/H
        AdcaRegs.ADCCTL1.bit.ADCPWDNZ = 1;                                  // Power-up ADC
    
        AdcbRegs.ADCCTL2.bit.PRESCALE = 6;                                  //set ADCCLK divider to /4
        AdcSetMode(ADC_ADCB, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);  // Non-differential signal, 12 bit resolution
        AdcbRegs.ADCCTL1.bit.INTPULSEPOS = 1;                               // Interrupt right after S/H
        AdcbRegs.ADCCTL1.bit.ADCPWDNZ = 1;                                  // Power-up ADC
    
        AdccRegs.ADCCTL2.bit.PRESCALE = 6;                                  //set ADCCLK divider to /4
        AdcSetMode(ADC_ADCC, ADC_RESOLUTION_12BIT, ADC_SIGNALMODE_SINGLE);  // Non-differential signal, 12 bit resolution
        AdccRegs.ADCCTL1.bit.INTPULSEPOS = 1;                               // Interrupt right after S/H
        AdccRegs.ADCCTL1.bit.ADCPWDNZ = 1;                                  // Power-up ADC
    
        // Setup ADC channels
        AdcaRegs.ADCSOC1CTL.bit.ACQPS = 10;     // Sample-and-Hold Window: 10 cycles
        AdcaRegs.ADCSOC1CTL.bit.CHSEL = 14;    // Channel ADCIN14 --- Udc
        AdcaRegs.ADCSOC1CTL.bit.TRIGSEL = 0xB;  // Trigger - EPwm4
    
        AdcbRegs.ADCSOC0CTL.bit.ACQPS = 10;     // Sample-and-Hold Window: 10 cycles
        AdcbRegs.ADCSOC0CTL.bit.CHSEL = 2;    // Channel ADCINB2 --- Ib
        AdcbRegs.ADCSOC0CTL.bit.TRIGSEL = 0xB;  // Trigger - EPwm4
    
        AdccRegs.ADCSOC0CTL.bit.ACQPS = 10;     // Sample-and-Hold Window: 10 cycles
        AdccRegs.ADCSOC0CTL.bit.CHSEL = 2;    // Channel ADCINC2 --- Ia
        AdccRegs.ADCSOC0CTL.bit.TRIGSEL = 0xB;  // Trigger - EPwm4