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/TMS320F280041C: PGA input mux

Part Number: TMS320F280041C


Tool/software: Code Composer Studio

Greetings! I can`t understand how to use the PGA inputs! I`m following the pga_ex1_dac_adc_ext_loopback example. I have my own board and I have connected pin B1 to an analogue source. Also I have connected all PGA inputs to analogue sources. Here is my code:

[code]

if(ADC_getInterruptStatus(MY_ADC_BASE, ADC_INT_NUMBER1))
{
//
// Acknowledge flag
//
ADC_clearInterruptStatus(MY_ADC_BASE, ADC_INT_NUMBER1);

dacResult = ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER0);
pgaResult = ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER1);
//pgaGain = (float)pgaResult / (float)dacResult;

//
// Force ADC conversion
//
ADC_forceSOC(MY_ADC_BASE, ADC_SOC_NUMBER0);
ADC_forceSOC(MY_ADC_BASE, ADC_SOC_NUMBER1);

}

void initADCSOC(void)
{
//
// Configure SOC0. The temperature sensor is internally connected to B14
// and requires an acquisition time of at least 450 ns.
//
ADC_setupSOC(MY_ADC_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_EPWM1_SOCA,
ADC_CH_ADCIN1, 45);

ADC_setupSOC(MY_ADC_BASE, ADC_SOC_NUMBER1,
ADC_TRIGGER_EPWM1_SOCA, ADC_CH_ADCIN2, 45);

//
// Set SOC0 to set the interrupt 1 flag. Enable the interrupt and make
// sure its flag is cleared.
//
ADC_setInterruptSource(MY_ADC_BASE, ADC_INT_NUMBER1, ADC_SOC_NUMBER1);
ADC_enableInterrupt(MY_ADC_BASE, ADC_INT_NUMBER1);
ADC_clearInterruptStatus(MY_ADC_BASE, ADC_INT_NUMBER1);
}

[/code]

based on the example. The problem is none of my PGA inputs seems to react accordingly. The Analogue input is working and it seems the second value(pgaRsult) is following the B1 input. i`ve tried to use the CMPHPMux register -> no luck. In the example code the PGA modul is just enabled. Nothing more. I`ve tried different combination on ADC_CH_ADCINx -> no luck. I don`t fully inderstand how the analogue and PGA inputs are muxed. Do I have to use another register? Do I have to enable the filters and then to connect the PGA to the analogue modul?

Thanks!

  • Hi Pavlin,

    B1 is a PGA output filter channel and not an input. PGA inputs are channels labeled PGAx_IN. I recommend you read through the Analog Subsystem Chapter along with the Analog Pins and Internal Connections" table. Let us know if you have any questions after going through those sections.

  • I think I was misunderstud. I`ve been through these pages several time! . So my uC has 100 pins and as for the Figure 5-28. Analog Subsystem Block Diagram (100-Pin PZ LQFP) my PGA1_IN is in Analog group 1. So In this case I can use C0(PIN 19), when I use ADCC_BASE and channel 0. But can`t understand how to select PGA1_IN(PIN 18). Do I have to mux somehow this analog group? I can`t find any register with muxing analog group purpose. I`ve tried using different input channel -> no luck. 

    The datasheet says I can pass PGA input directly to the ADC! Or I have to use the input filter first and than to the ADC? Is there any sample code?

    Thanks!

  • Hi Pavlin,

    You should also go through the PGA chapter if you haven't already. There is no muxing for the PGA. The PGA has one input (PGA_IN) and 2 outputs (PGA_OUT and PGA_OUTF). The PGA inputs come directly to the pins. Both PGA outputs go to the ADC but only PGA_OUTF comes out on a pin; for filtering purposes.

    The "Analog Pins and Internal Connections" table has all the information you need so i recommend you go through it one more time. For the example you highlighted above, since you have the 100-pin package, C0 is not a PGA input. The PGA input in group1 is pin18 as you pointed out. There is no muxing required. Just connect your signal to pin18 (PGA1_IN) and you can sample the two PGA1 outputs on ADC A2/B6 or A11/B7, no muxing needed. The example you mentioned in your first post is already doing this.

    Let us know if it's still not clear.

  • Thanks! I finally got it.

  • Glad it's clear now! Let us know if you have anymore questions.