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.

Problem with read of two channel ADC

Hello,

I´m using the launchPad tiva and I´m have problems. In my case I need read two channel of the ADC and I get to read when two channel are connected in potentiometers, for example, but when one of the ports (I´m using PE1 and PE2) is floating, there are pulses that are generate in frequency of 1 Hz and my measure is distorted.

Attached the following image when the PE1 is floating and PE2 is connected in potentiometer.

What´s happened?

  • Hi Gabriel,

    Is that probe connected to the pins? 

    Without any code i can't analyze what you did wrong. You ask what happened but i don't know any wiring schematic or code so i really can't say anything.

  • Hello Gabriel,

    As Luis mentioned "the code is important". Leaving one of the ADC pins floating can generate spurious noise randmly but not something periodic like what the snapshot shows unless there is a signal of 1Hz close to the PE1 pin that is getting coupled.

    You may want to check the proximity of a timer or a rtc-type signal close to the probe, or may be check if the probe point is correct as well.

    Regards

    Amit

  • Hello Luis,

    So, my code can be viewed below.

    // This function configure the ADC and GPIO.

    SYSCTL_RCGCGPIO_R |= SYSCTL_RCGCGPIO_R4;
    SYSCTL_RCGC0_R |= 0x00010000;

    delay = SYSCTL_RCGCGPIO_R; 
    delay = SYSCTL_RCGCGPIO_R;

    GPIO_PORTE_DIR_R &= ~0x30;
    GPIO_PORTE_AFSEL_R |= 0x30;
    GPIO_PORTE_DEN_R &= ~0x30;
    GPIO_PORTE_AMSEL_R |= 0x30;

    ADC0_PC_R &= ~0xF;
    ADC0_PC_R |= ADC_PC_SR_250K;

    ADC0_SSPRI_R = 0x3210;
    ADC0_ACTSS_R &= ~ADC_ACTSS_ASEN0;

    ADC0_EMUX_R &= ~ADC_EMUX_EM0_M ;

    ADC0_SSMUX0_R &= ~(ADC_SSMUX0_MUX0_M|ADC_SSMUX0_MUX1_M);

    ADC0_SSMUX0_R = 0x0089;

    ADC0_SSCTL0_R |= (ADC_SSCTL0_END1 | ADC_SSCTL0_IE1);

    ADC0_IM_R &= ~ADC_IM_MASK0;
    ADC0_ACTSS_R |= ADC_ACTSS_ASEN0;

    long ADC0_In (char numCanal)                       // This function read the channels.
    {
    ADC0_PSSI_R = ADC_PSSI_SS0;

    while((ADC0_RIS_R&ADC_RIS_INR0)==0) {};

    ADC0Valor[1] = ADC0_SSFIFO0_R&0xFFF;
    ADC0Valor[2] = ADC0_SSFIFO0_R&0xFFF;

    ADC0_ISC_R = ADC_PSSI_SS0;


    return ADC0Valor[numCanal];
    }

  • Hi Gabriel,

    The probes are connected to what? The analog pins?

    I don't usually program direct register so i'll take a bit to analyze the code. Probably gonna see that only later

  • Hello Amit,


    I also think that this problem is not noise and I think I don´t configured some register of ADC, but I don´t have sure about this.


    Other point is that I don´t use none timer at 1 Hz, however I use some timers for to synchronization my functions.


    Now, I did more tests and I put a op amp to see what happened and I noticed that problem disappeared, but I yet to know what is happening.

  • Hello Luis,

    My probe is connected in analog pins (PE1 and PE2). I connected the proble because I noticed that the measure was wrong. 

    Don´t worry Luis, I understand you. When you to have time, please look to me.

  • Hello Gabriel,

    Can you send a picture of how the circuit is connected with OPAMP and how the measurement is being done both before and after making the OPAMP addition to your design?

    Regards

    Amit

  • Hi Gabriel,

    I started analyzing your code but there's something that to me doesn't add up.

    With the chance of sounding stupid:

    GPIO_PORTE_DIR_R &= ~0x30; 
    GPIO_PORTE_AFSEL_R |= 0x30; 
    GPIO_PORTE_DEN_R &= ~0x30; 
    GPIO_PORTE_AMSEL_R |= 0x30;

    Doesn't this configure bit4 and bit5? You want bit1 and bit2 right? So it's 0x06?

  • Hello,
    I thank you for your replies. I discover what was the problem. I was re activating the GPIO and ADC every time that I would read the pin and then o pin stayed floating.
    When I stopped of reactivate the pins and ADC the problem stopped of happen.
    Thank you!