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.

TMS320F280039C: ADC reference issue

Part Number: TMS320F280039C
Other Parts Discussed in Thread: LAUNCHXL-F280039C

Hi,

I am using a LAUNCHXL-F280039C and I want to configure the ADCs to use external reference voltage from VREFHI. I am calling ADC_setVREF(..) before any kind of ADC initialization, but it does not work. All of the ADC result registers are zero, but the SOC must be triggered as I have ISRs triggered by the ADC conversion complete events.

I have noticed, that the ADCs are working just fine with ADC_setVREF(ADCx_BASE, ADC_REFERENCE_INTERNAL, ADC_REFERENCE_3_3V), but if I choose the 2.5V reference voltage, the same issue came up: all results registers are zero. I can switch between the internal reference voltage levels during debugging by changing the ANAREF2P5SEL bit and the conversion is ok if I use ANAREF2P5SEL=0, but it is not if I use ANAREF2P5SEL=1. I can measure the 2.5V reference voltage on the VREFHI pin if ANAREF2P5SEL=1.

I saw no info regarding this in the errata sheet. Is there something else to do to select different reference voltage level?

  • Hi Szabolcs,

    There are 3 ADC modules on the F280039C device.  The VREFHI pin on all 3 ADCs are common and this means that all 3 ADCs need to have the same VREFHI configuration.  If you need to switch between ADC_REFERENCE_3_3V and ADC_REFERENCE_2_5V, you need to call ADC_setVREF for each ADC module and only choose either ADC_REFERENCE_3_3V  or ADC_REFERENCE_2_5V for ADCA, ADCB and ADCC.

    Best regards,

    Joseph

  • Hi Joseph, 

    I was aware of that, so my problem is that even if I set all ADC module refernce to external or 2.5V, the conversion is not working.Ok hand

  • Hi Szabolcs,

    I cannot reproduce what you are observing when you are switching from ADC_REFERENCE_3_3V to ADC_REFERENCE_2_5V.  I have also used a  LAUNCHXL-F280039C and tried it on the adc_ex1_soc_software example.  I am feeding a DC signal on A0 and A1 since the example code is using those input channels.  I can switch between ADC_REFERENCE_3_3V and ADC_REFERENCE_2_5V and i am getting expected conversion results.  I can also switch from external (feeding 2.5V to VREFHI pin and GND) and internal VREF (disconnecting external VREF source from VREFHI) mode and also getting the expected conversion results.

        //
        // Set up ADCs, initializing the SOCs to be triggered by software
        //
        Board_init();
    
        //
        // Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
        //
        EINT;
        ERTM;
    
        ADC_setVREF(myADC0_BASE, ADC_REFERENCE_INTERNAL, ADC_REFERENCE_2_5V );
    
        //
        // Loop indefinitely
        //
        while(1)
        {
            //
            // Convert, wait for completion, and store results
            //
            ADC_forceMultipleSOC(myADC0_BASE, (ADC_FORCE_SOC0 | ADC_FORCE_SOC1));
    
            //
            // Wait for ADCA to complete, then acknowledge flag
            //
            while(ADC_getInterruptStatus(myADC0_BASE, ADC_INT_NUMBER1) == false)
            {
            }
            ADC_clearInterruptStatus(myADC0_BASE, ADC_INT_NUMBER1);
    
            ADC_forceMultipleSOC(myADC1_BASE, (ADC_FORCE_SOC0 | ADC_FORCE_SOC1));
            //
            // Wait for ADCC to complete, then acknowledge flag
            //
            while(ADC_getInterruptStatus(myADC1_BASE, ADC_INT_NUMBER1) == false)
            {
            }
            ADC_clearInterruptStatus(myADC1_BASE, ADC_INT_NUMBER1);
    
            //
            // Store results
            //
            myADC0Result0 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER0);
            myADC0Result1 = ADC_readResult(ADCARESULT_BASE, ADC_SOC_NUMBER1);
            myADC1Result0 = ADC_readResult(ADCCRESULT_BASE, ADC_SOC_NUMBER0);
            myADC1Result1 = ADC_readResult(ADCCRESULT_BASE, ADC_SOC_NUMBER1);
    
            //
            // Software breakpoint. At this point, conversion results are stored in
            // myADC0Result0, myADC0Result1, myADC1Result0, and myADC1Result1.
            //
            // Hit run again to get updated conversions.
            //
            ESTOP0;
        }
    

    I added ADC_setVREF() before the while loop and where I can change any ref mode and ref voltage with no issues.

    Have you followed any of the examples especially on the order of ADC setup?

    Regards,

    Joseph

  • Hi Joseph,

    the issue was solved. I left the analog pins unconnected on the launchpad and, for some reason, if I was using the 3V3 reference settings, all my configured SOC result registers contained some random values, but with the other two kinds of reference settings all of them were zero.

    It was fooling me, because with the adc_ex1_soc_software example code I got random SOC values with all three types of reference settings, hence I assumed that something is wrong with my code.

    Anyway, thanks for your help!

    Regards,

    Szabolcs