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.

TMS320F2800156-Q1: ADC-DAC Loopback Testing

Part Number: TMS320F2800156-Q1
Other Parts Discussed in Thread: SYSCONFIG,

Tool/software:

Hi,

I want to test ADC with Loopback testing for FuSa. The chip variant that I am using does not have CMPSS module. It only has CMPPS_LITE. 

Is it possible to do ADC-DAC Loopback Testing with CMPSS_LITE module?

if it is not possible, What I need to do to test ADC module?

Thanks

  • Hi, 

    Since the ADC module always samples the CMPSS1 DACL output and the device you are using doesn't have CMPSS1, it's not possible to do Loopback testing.

    let me ask other experts to see how you can do the test without cmpss1.

    Regards,

    Hadi

  • Hi Mesut,

    for devices without CMPSS, CMPSS_LITE module should work , Can you try Loopback Testing with CMPSS_LITE module?

    Regards,

    Hadi

  • Hi Hadi,

    Thank you for your answer.

    I have tried loopback testing with CMPSS_LITE module. It did not worked. I measure 0 all the time.

    However CMPSS1 module that is not included in the variant has worked. When I update DACL value the ADC results is changing. In CCS CMPSS1 has registers and values are changing. It is strange. 

    In DS Table 4-1. Device Comparison says device variant does not have CMPSS module but I have working with it. Sysconfig has CMPSS1 module for TMS320F2800156-Q1 variant and does generate code for it. 

    Here is my working code, but it shouldn't work according to documentation. (DS and TRM)

    #include "driverlib.h"
    #include "device.h"
    #include "board.h"
    #include "c2000ware_libraries.h"
    
    #define myADC0_BASE ADCA_BASE
    #define myADC0_RESULT_BASE ADCARESULT_BASE
    
    #define myCMPSS0_BASE CMPSS1_BASE
    #define myCMPSS0_HIGH_COMP_BASE CMPSS1_BASE    
    #define myCMPSS0_LOW_COMP_BASE CMPSS1_BASE   
    
    uint16_t myADC0Result[3];
    
    //Generated by Sysconfig
    void myCMPSS0_init(){
        //
        // Select the value for CMP1HPMXSEL.
        //
        ASysCtl_selectCMPHPMux(ASYSCTL_CMPHPMUX_SELECT_1,0U);
        //
        // Select the value for CMP1LPMXSEL.
        //
        ASysCtl_selectCMPLPMux(ASYSCTL_CMPLPMUX_SELECT_1,0U);
        //
        // Sets the configuration for the high comparator.
        //
        CMPSS_configHighComparator(myCMPSS0_BASE,(CMPSS_INSRC_DAC));
        //
        // Sets the configuration for the low comparator.
        //
        CMPSS_configLowComparator(myCMPSS0_BASE,(CMPSS_INSRC_DAC));
        //
        // Sets the configuration for the internal comparator DACs.
        //
        CMPSS_configDACHigh(myCMPSS0_BASE,(CMPSS_DACVAL_SYSCLK | CMPSS_DACSRC_SHDW));
        CMPSS_configDACLow(myCMPSS0_BASE, CMPSS_DACSRC_SHDW);
        //
        // Sets the value of the internal DAC of the high comparator.
        //
        CMPSS_setDACValueHigh(myCMPSS0_BASE,1500U);
        //
        // Sets the value of the internal DAC of the low comparator.
        //
        CMPSS_setDACValueLow(myCMPSS0_BASE,2000U);
        //
        //  Configures the digital filter of the high comparator.
        //
        CMPSS_configFilterHigh(myCMPSS0_BASE, 0U, 1U, 1U);
        //
        // Configures the digital filter of the low comparator.
        //
        CMPSS_configFilterLow(myCMPSS0_BASE, 0U, 1U, 1U);
        //
        // Sets the output signal configuration for the high comparator.
        //
        CMPSS_configOutputsHigh(myCMPSS0_BASE,(CMPSS_TRIPOUT_ASYNC_COMP | CMPSS_TRIP_ASYNC_COMP));
        //
        // Sets the output signal configuration for the low comparator.
        //
        CMPSS_configOutputsLow(myCMPSS0_BASE,(CMPSS_TRIPOUT_ASYNC_COMP | CMPSS_TRIP_ASYNC_COMP));
        //
        // Sets the comparator hysteresis settings.
        //
        CMPSS_setHysteresis(myCMPSS0_BASE,0U);
        //
        // Configures the comparator subsystem's high ramp generator.
        //
        CMPSS_configRampHigh(myCMPSS0_BASE, CMPSS_RAMP_DIR_DOWN, 0U,0U,0U,1U,true);
        //
        // Configures the comparator subsystem's low ramp generator.
        //
        CMPSS_configRampLow(myCMPSS0_BASE, CMPSS_RAMP_DIR_DOWN, 0U,0U,0U,1U,true);
        //
        // Disables reset of HIGH comparator digital filter output latch on PWMSYNC
        //
        CMPSS_disableLatchResetOnPWMSYNCHigh(myCMPSS0_BASE);
        //
        // Disables reset of LOW comparator digital filter output latch on PWMSYNC
        //
        CMPSS_disableLatchResetOnPWMSYNCLow(myCMPSS0_BASE);
        //
        // Sets the ePWM module blanking signal that holds trip in reset.
        //
        CMPSS_configBlanking(myCMPSS0_BASE,1U);
        //
        // Disables an ePWM blanking signal from holding trip in reset.
        //
        CMPSS_disableBlanking(myCMPSS0_BASE);
        //
        // Configures whether or not the digital filter latches are reset by PWMSYNC
        //
        CMPSS_configLatchOnPWMSYNC(myCMPSS0_BASE,false,false);
        //
        // Disables the CMPSS module.
        //
        CMPSS_disableModule(myCMPSS0_BASE);
    
        //
        // Delay for CMPSS DAC to power up.
        //
        DEVICE_DELAY_US(500);
    }
    
    //
    // Main
    //
    void main(void)
    {
    
        //
        // Initialize device clock and peripherals
        //
        Device_init();
    
        //
        // Disable pin locks and enable internal pull-ups.
        //
        Device_initGPIO();
    
        //
        // Initialize PIE and clear PIE registers. Disables CPU interrupts.
        //
        Interrupt_initModule();
    
        //
        // Initialize the PIE vector table with pointers to the shell Interrupt
        // Service Routines (ISR).
        //
        Interrupt_initVectorTable();
    
        //
        // PinMux and Peripheral Initialization
        //
        Board_init();
    
        // Configures a start-of-conversion (SOC) in the ADC and its interrupt SOC trigger.
        ADC_setupSOC(myADC0_BASE, ADC_SOC_NUMBER0, ADC_TRIGGER_SW_ONLY, ADC_CH_ADCIN5, 500U);
        ADC_setInterruptSOCTrigger(myADC0_BASE, ADC_SOC_NUMBER0, ADC_INT_SOC_TRIGGER_NONE);
    
        ADC_setupSOC(myADC0_BASE, ADC_SOC_NUMBER1, ADC_TRIGGER_SW_ONLY, ADC_CH_ADCIN1, 360U);
        ADC_setInterruptSOCTrigger(myADC0_BASE, ADC_SOC_NUMBER1, ADC_INT_SOC_TRIGGER_NONE);
    
        ADC_setupSOC(myADC0_BASE, ADC_SOC_NUMBER2, ADC_TRIGGER_SW_ONLY, ADC_CH_ADCIN0, 360U);
        ADC_setInterruptSOCTrigger(myADC0_BASE, ADC_SOC_NUMBER2, ADC_INT_SOC_TRIGGER_NONE);
    
        ASysCtl_enableADCDACLoopback(ASYSCTL_ADCDACLOOPBACK_ENLB2ADCA);
    
        CMPSS_enableModule(CMPSS1_BASE);
    
        uint16_t dacl = 1000U;
    
        //
        // C2000Ware Library initialization
        //
        C2000Ware_libraries_init();
    
        //
        // Enable Global Interrupt (INTM) and real time interrupt (DBGM)
        //
        EINT;
        ERTM;
    
        while(1)
        {
          dacl += 100;
          CMPSS_setDACValueLow(CMPSS1_BASE,dacl);
    
          //
          // Convert, wait for completion, and store results
          //
          ADC_forceMultipleSOC(myADC0_BASE, (ADC_FORCE_SOC0 | ADC_FORCE_SOC1 | ADC_FORCE_SOC2));
    
          //
          // Wait for ADCA to complete, then acknowledge flag
          //
          while(ADC_isBusy(myADC0_BASE) != false);
    
          //
          // Store results
          //
          int i;
          for(i=0; i<3; ++i)
          {
            myADC0Result[i] = ADC_readResult(ADCARESULT_BASE, (ADC_SOCNumber)((int)ADC_SOC_NUMBER0+i));
          }
    
          //
          // Hit run again to get updated conversions.
          //
          ESTOP0;
            
        }
    }
    
    //
    // End of File
    //
    

    Register Info of DEV CFG Register

    PARTIDL = 0x00064280
    PARTIDH = 0x07FE0500
    REVID = 0x00000002

    Thanks