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!