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.

Concerto ADC

Other Parts Discussed in Thread: CONTROLSUITE, OPA2320, F28M35H52C

 I’ve noticed on the Concerto ADC that the sample rate they claim (up to 2.88MSPS) is only the conversion rate and not the whole true conversion time (i.e. sample time + conversion time).  Do they claim this due to having 2 sample-and-hold circuits?

-Jason

  • The Concerto ADC has two sample and hold circuits with some degree of pipelining, so the sample rate does not directly correspond to the sample latency.  There are also 2 ADCs on Concerto, each with sample rate 2.88MSPS.  

  • Hello, 

    does it mean that continues sampling with concerto ADC will not allow to reach 2.8 MSPS continues sampling?

    Is it possible to get a clear answer on this matter, or example for this ADC configuration on single channel continues sampling?

    Thank you very much,

    Ilya

  • You will be able to get 2.8 MSPS on a single channel, sampling continuously (and since there are actually 2 ADC modules, you can get 2.8MSPS on two different channels at the same time).  My point is just that you can not calculate the sample rate using the formula:

    Sample Rate = 1 / total conversion time

    because the ADC architecture has some degree of pipelining.  Even though a sample is still converting, the ADC is able to begin the sampling phase for the next sample.  

    This is not due to having 2 S+H.  The 2 S+H allows you to sample 2 signals at the exact same time, then convert them sequentially.  The total sample rate in this case will also be near 2.8MSPS, but the sample rate for a particular signal will be half of that.  Note that EACH of the 2 ADCs has 2 S+H, for 4 total S+H circuits.  

  • My fastest configuration yet is attached, where it reaches little bit less than 1MSPS, but no more Idle time is remained to copy aside and handle the results?

    What am I doing wrong ?

    Thanks,

    Ilya

  • My fastest configuration yet is attached, where it reaches little bit less than 1MSPS, but no more Idle time is remained to copy aside and handle the results?

    What am I doing wrong ?

    Thanks,

    Ilya

  • My fastest configuration yet is attached, where it reaches little bit less than 1MSPS, but no more Idle time is remained to copy aside and handle the results?

    What am I doing wrong ?

    Thanks,

    Ilya


    #include "DSP28x_Project.h" // Device Headerfile and Examples Include File

    #define DUTY_CYCLE_A 500
    #define DUTY_CYCLE_B 500
    #define PERIOD 1000
    #define BUFFER_LENGTH (1000)

    // Prototype statements for functions found within this file.
    interrupt void adc2_isr(void);
    void Adc_Config(void);

    // Global variables used in this example:
    Uint32 LoopCount;
    Uint16 ConversionCount;
    //Uint16 Voltage1[BUFFER_LENGTH];
    Uint16 Voltage2[BUFFER_LENGTH];

    main()
    {
    // unsigned short analoginit;

    // Step 1. Initialize System Control for Control and Analog Subsytems
    // Enable Peripheral Clocks
    // This example function is found in the F28M35x_SysCtrl.c file.
    InitSysCtrl();

    // Step 2. Initialize GPIO:
    // This example function is found in the F28M35x_Gpio.c file and
    // illustrates how to set the GPIO to it's default state.
    InitGpio(); // Skipped for this example
    EALLOW;
    GpioG1CtrlRegs.GPCDIR.bit.GPIO70 = 1; //set PC6_GPIO70 as output //LED
    GpioG1CtrlRegs.GPADIR.bit.GPIO24 = 1; // Set as output

    EDIS;
    /* EALLOW;
    GpioG1CtrlRegs.GPADIR.bit.GPIO0 = 1; //Set as output
    GpioG1CtrlRegs.GPADIR.bit.GPIO8 = 1; //Set as output
    GpioG1CtrlRegs.GPAMUX1.bit.GPIO0 = 1; //Set mux to EPWM1A
    GpioG1CtrlRegs.GPAMUX1.bit.GPIO8 = 3; //Set mux to ADCSOCAn
    EDIS;
    */
    // Step 3. Clear all interrupts and initialize PIE vector table:
    // Disable CPU interrupts
    DINT;

    // Initialize the PIE control registers to their default state.
    // The default state is all PIE interrupts disabled and flags
    // are cleared.
    // This function is found in the F28M35x_PieCtrl.c file.
    InitPieCtrl();

    // Disable CPU interrupts and clear all CPU interrupt flags:
    IER = 0x0000;
    IFR = 0x0000;

    // Initialize the PIE vector table with pointers to the shell Interrupt
    // Service Routines (ISR).
    // This will populate the entire table, even if the interrupt
    // is not used in this example. This is useful for debug purposes.
    // The shell ISR routines are found in F28M35x_DefaultIsr.c.
    // This function is found in F28M35x_PieVect.c.
    InitPieVectTable();

    // Interrupts that are used in this example are re-mapped to
    // ISR functions found within this file.
    EALLOW; // This is needed to write to EALLOW protected register
    PieVectTable.ADCINT1 = &adc2_isr;
    EDIS; // This is needed to disable write to EALLOW protected registers

    // Step 4. Initialize all the Device Peripherals:
    // This function is found in F28M35x_InitPeripherals.c
    // InitPeripherals(); // Not required for this example
    InitAdc2(); // For this example, init the ADC

    // Step 5. User specific code, enable interrupts:

    // Enable ADCINT1 in PIE
    PieCtrlRegs.PIEIER1.bit.INTx1 = 1; // Enable INT 1.1 in the PIE
    IER |= M_INT1; // Enable CPU Interrupt 1
    EINT; // Enable Global interrupt INTM
    ERTM; // Enable Global realtime interrupt DBGM

    LoopCount = 0;
    ConversionCount = 0;

    // Configure ADC
    EALLOW;
    Adc2Regs.ADCCTL2.bit.ADCNONOVERLAP = 0; // Enable non-overlap mode i.e.
    // conversion and future
    // sampling
    // events dont overlap
    //Adc1Regs.ADCCTL1.bit.INTPULSEPOS = 1; // ADCINT1 trips after
    // AdcResults latch
    Adc2Regs.INTSEL1N2.bit.INT1E = 1; // Enabled ADC2NT1
    Adc2Regs.INTSEL1N2.bit.INT1CONT = 1; // Disable ADC2NT1 Continuous
    // mode
    Adc2Regs.INTSEL1N2.bit.INT1SEL = 0; // setup EOC0 to trigger ADCINT1
    // to fire
    Adc2Regs.ADCSOC0CTL.bit.CHSEL = 0; // set SOC0 channel select to
    // ADC1A0
    // Adc1Regs.ADCSOC1CTL.bit.CHSEL = 2; // set SOC1 channel select to
    // ADC1A2
    AnalogSysctrlRegs.TRIG1SEL.all = 0; // Assigning
    // ADC TRIGGER 1 of the ADC module
    Adc2Regs.ADCSOC0CTL.bit.TRIGSEL = 0; // Set SOC0 start trigger to
    // ADC Trigger 1(EPWM1 SOCA) of the
    // adc
    Adc2Regs.ADCSOC0CTL.bit.ACQPS = 6; // set SOC0 S/H Window to 7 ADC
    // Clock Cycles, (6 ACQPS plus
    // 1)
    Adc2Regs.ADCSOC1CTL.bit.ACQPS = 6; // set SOC1 S/H Window to 7 ADC
    // Clock Cycles, (6 ACQPS plus
    // 1)
    EDIS;

    // count

    // Wait for ADC interrupt
    Adc2Regs.ADCSOCFRC1.bit.SOC0 = 1;
    for(;;)
    {
    LoopCount++;
    if (0 == (LoopCount % 1000000))
    {
    //GpioG1DataRegs.GPATOGGLE.bit.GPIO70 = 1;
    if(GpioG1DataRegs.GPCDAT.bit.GPIO70 == 0)
    {
    GpioG1DataRegs.GPCSET.bit.GPIO70 = 1;
    }
    else
    {
    GpioG1DataRegs.GPCCLEAR.bit.GPIO70 = 1;
    }
    }
    }

    }

    interrupt void adc2_isr(void)
    {
    Adc2Regs.ADCSOCFRC1.bit.SOC0 = 1; // retriger next conversion

    Voltage2[ConversionCount] = Adc2Result.ADCRESULT0;

    // If 1000 conversions have been logged, start over
    if(ConversionCount == BUFFER_LENGTH - 1)
    {
    ConversionCount = 0;
    GpioG1DataRegs.GPATOGGLE.bit.GPIO24 = 1;
    }
    else ConversionCount++;

    Adc2Regs.ADCINTFLGCLR.bit.ADCINT1 = 1; //Clear ADCINT1 flag reinitialize
    // for next SOC
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE

    //Adc2Regs.ADCSOCFRC1.bit.SOC0 = 1; // retriger next conversion

    return;
    }


  • How did you set up the system clock in the M3 code and the ACIB clock?  Can you show me that code?

    Ricky

  • i am using the configuration which based on adc_soc example from

    C:\TI\controlSUITE\device_support\f28m35x\vBeta1\F28M35x_examples_Control\adc_soc\c28

        // Initialize the Analog Sub-System and set the clock divider to divide by 4
        (**InitAnalogSystemClock)(ACLKDIV4);

  • What example did you use for the M3 core?  I need to know the clock settings in the M3 code.  If you used the setup_m3 example then is this the code you used?

        // Sets up PLL, M3 running at 75MHz and C28 running at 150MHz
        SysCtlClockConfigSet(SYSCTL_USE_PLL | (SYSCTL_SPLLIMULT_M & 0xF) |
                             SYSCTL_SYSDIV_1 | SYSCTL_M3SSDIV_2 |
                             SYSCTL_XCLKDIV_4);

    Ricky

  • that's right, setup_m3 as it is

  • I found an error in your ADC2 setup code.  If you want ADC2 trigger 1 to be tied to EPWM1 SOCA the following lines need to be changed.

    The comments are also reversed.

    AnalogSysctrlRegs.TRIG1SEL.all = 5;  // Set SOC0 start trigger to ADC Trigger 1(EPWM1 SOCA) of the adc
    Adc2Regs.ADCSOC0CTL.bit.TRIGSEL = 5; // Assigning ADC TRIGGER 1 of the ADC module to SOC0

    Settings these bit fields to 0 is reserved.

    Also just a note.  You have the ADCNONOVERLAP bit set to 0, but the comment says that this statement enables non-overlap mode.  Setting this bit
    to 0 actually puts the ADC in overlap mode.  This is what you want to get the fastest performance, so maybe you can change the comment for clarity.

    Regards,

    Ricky

  • Hi,

    1. I set those bits to 0, because trigering is performed from the code by

    Adc2Regs.INTSEL1N2.bit.INT1CONT = 1 // setting continues mode

    and

    Adc2Regs.ADCSOCFRC1.bit.SOC0 = 1;  // retriger next conversion

    inside interrupt handler (this is the only way it's working although continues mode expected to spare the last writing)

    2. I am not using the EPWM triger because I need to sample it as fast as possible, is it possible to set the EPWM to triger each SOC 0.5 usec for example?

    3. Do I need to link the (EOC0 to SOC1)  (EOC1 to SOC2) (EOC2 to SOC3) and so on untill 8 and all CHSEL to one leg?

    Do you may be have a simple example on how to sequentially sample even with 1 Msps?

    Thank

    BR,

    Ilya

  • Here is code that should run at the max ADC sampling speed.

    Adc1Regs.ADCCTL1.bit.INTPULSEPOS    = 1;    //adcint pulse position at end of sample

    Adc1Regs.INTSEL1N2.bit.INT1E = 1;       //enable ADCINT1
    Adc1Regs.INTSEL1N2.bit.INT2E = 1;       //enable ADCINT2

    Adc1Regs.INTSEL1N2.bit.INT1CONT = 0;    //disable continuous mode for ADCINT1
    Adc1Regs.INTSEL1N2.bit.INT2CONT = 0;    //disable continuous mode for ADCINT2

    Adc1Regs.INTSEL1N2.bit.INT1SEL = 6;     //EOC6 will trigger ADCINT1
    Adc1Regs.INTSEL1N2.bit.INT2SEL = 14;    //EOC14 will trigger ADCINT2

    Adc1Regs.ADCINTSOCSEL1.bit.SOC0 = 2;    //ADCINT2 starts SOC0
    Adc1Regs.ADCINTSOCSEL1.bit.SOC1 = 2;    //ADCINT2 starts SOC1
    Adc1Regs.ADCINTSOCSEL1.bit.SOC2 = 2;    //ADCINT2 starts SOC2
    Adc1Regs.ADCINTSOCSEL1.bit.SOC3 = 2;    //ADCINT2 starts SOC3
    Adc1Regs.ADCINTSOCSEL1.bit.SOC4 = 2;    //ADCINT2 starts SOC4
    Adc1Regs.ADCINTSOCSEL1.bit.SOC5 = 2;    //ADCINT2 starts SOC5
    Adc1Regs.ADCINTSOCSEL1.bit.SOC6 = 2;    //ADCINT2 starts SOC6
    Adc1Regs.ADCINTSOCSEL1.bit.SOC7 = 2;    //ADCINT2 starts SOC7
    Adc1Regs.ADCINTSOCSEL2.bit.SOC8 = 1;    //ADCINT1 starts SOC8
    Adc1Regs.ADCINTSOCSEL2.bit.SOC9 = 1;    //ADCINT1 starts SOC9
    Adc1Regs.ADCINTSOCSEL2.bit.SOC10 = 1;   //ADCINT1 starts SOC10
    Adc1Regs.ADCINTSOCSEL2.bit.SOC11 = 1;   //ADCINT1 starts SOC11
    Adc1Regs.ADCINTSOCSEL2.bit.SOC12 = 1;   //ADCINT1 starts SOC12
    Adc1Regs.ADCINTSOCSEL2.bit.SOC13 = 1;   //ADCINT1 starts SOC13
    Adc1Regs.ADCINTSOCSEL2.bit.SOC14 = 1;   //ADCINT1 starts SOC14
     Adc1Regs.ADCINTSOCSEL2.bit.SOC15 = 1;   //ADCINT1 starts SOC15

    Adc1Regs.INTSEL1N2.bit.INT1E = 1;
    Adc1Regs.INTSEL1N2.bit.INT2E = 1;

    Adc1Regs.ADCSOCFRC1.all = 0x00FF; // force SOC0-15

    while(1){
    while (Adc1Regs.ADCINTFLG.bit.ADCINT1 == 0){}
    Adc1Regs.ADCINTFLGCLR.bit.ADCINT1 = 1;          //clear ADCINT1
    // Read ADC Results 0 -7 here

    while (Adc1Regs.ADCINTFLG.bit.ADCINT2 == 0){}
    Adc1Regs.ADCINTFLGCLR.bit.ADCINT2 = 1;              //clear ADCINT2
    // Read ADC Results 8 -15 here

    } // loop until done sampling

    //disable adcint1 and adcint2 to STOP the ping-pong sampling
    Adc1Regs.INTSEL1N2.bit.INT1E = 0;
    Adc1Regs.INTSEL1N2.bit.INT2E = 0;

  • Ricky,

    I plan to use all the available analog inputs provided with the Concerto eval module. This is channels ADC1 - A0,A2, A3, A4, A6, A7, B4 and ADC2 - A0, A2, A3, A4, A6, A7, B0, B4. I could not find the correlation to actual input pin from the SOC number or channel number in the headeer files.  Could you explain the relationship or point me to the information?

    Thanks,

    Pat

     

  • Pat,

    The SOC number correlates to the ADC result register, so SOC0 puts its result in ADC Result 0, and SOC1 puts its result in ADC Result 1, and so on.  It does not matter which ADC channel you use, SOC0 result will always go in ADC Result 0.  As far as relating an ADC pin to an ADC channel, see below.

    ADC1 - A0 is ADC1INA0 pin - channel field in SOC register should be 0

    ADC1 - A2 is ADC1INA2 pin - channel field in SOC register should be 2

    ADC1 - B5 is ADC1INB4 pin - channel field in SOC register should be 12 since B0 needs an 8 in the channel field in the SOC register

    Ricky

  • Ricky,

    Here is a modified adc_soc_C28 file with my analog initialization. Could you take a look to see if it is correct. My intent is to convert all available inputs sequentially using the interrupt scheme you used for triggering on EOC6 and EOC14. Instead of the while loops, I have established interrupt service. I am confused about the PieVectTable.ADCINT1= &adc1_isr. I tried to duplicate this with ADCINT2 but it didn't work. Along with this is the PieCtrlRegs.PIEIER1.bit.INTx1. How should this be done for ADCINT2?

    Thanks for you help.

    Pat

    //###########################################################################

    // FILE:   adc_soc_c28.c

    // TITLE:  ADC1 Start-Of-Conversion (SOC) Example Program.

    //

    //! \addtogroup control_example_list

    //! <h1> ADC1 Start of Conversion (adc_soc)</h1>

    //!

    //! This ADC example uses ePWM1 to generate two periodic and

    //! simultaneous SOCs to the ADC. Two channels are converted,

    //! ADC1A0 and ADC1A2, triggered by EPWM1SOCA and EPWM1SOCB

    //! respectively.

    //!

    //! Note that because ADC SOC0 has a higher priority by default

    //! than SOC1, channel 0 conversion will take precedence over

    //! channel 1 conversion.

    //!

    //! - EPWM1SOCA triggers SOC0

    //! - EPMM1SOCB triggers SOC1

    //! - EOC1 triggers ADCINT1 after ADC result register is latched

    //!

    //! New EPWM compare registers CMPC and CMPD are used to control

    //! SOCA and SOCB

    //!

    //! \b Watch \b Variables \n

    //! - Voltage1[10]    - Last 10 ADCRESULT0 values

    //! - Voltage2[10]    - Last 10 ADCRESULT1 values

    //! - ConversionCount - Current result number 0-9

    //! - LoopCount       - Idle loop counter

    //

    //###########################################################################

    // $TI Release: F28M35x Support Library v110 $

    // $Release Date: December 12, 2011 $

    //###########################################################################

     

    #include "DSP28x_Project.h"       // Device Headerfile and Examples Include File

    #include <string.h>

     

    #define  DUTY_CYCLE     500

    #define  PERIOD         1000

     

    // Prototype statements for functions found within this file.

    interrupt void adc1_isr( void );

    void ConfigAdc1( void );

    void ConfigAdc2( void );

    //void ConfigEpwm1( void );

     

    // Global variables used in this example:

    Uint16 LoopCount;

    Uint16 ChannelCount;

    Uint16 ConversionCount;

    #define ADC_usDELAY  1000L

     

            Uint32 VoltageSum[16];

            Uint16 Vavg[16];

     

    main()

    {

    //    unsigned short analoginit;

     

    // Step 1. Initialize System Control for Control and Analog Subsytems

    // Enable Peripheral Clocks

    // This example function is found in the F28M35x_SysCtrl.c file.

        InitSysCtrl();

       

    // If project is linked into flash, copy critical code sections to RAM.   

    #ifdef _FLASH

       memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);

    #endif       

     

        EDIS;

     

    // Step 2. Initialize GPIO:

    // This example function is found in the F28M35x_Gpio.c file and

    // illustrates how to set the GPIO to it's default state.

      // InitGpio();  // Skipped for this example

        EALLOW;

        GpioG1CtrlRegs.GPBDIR.bit.GPIO32  = 1;  // Set as output

        GpioG1CtrlRegs.GPBMUX1.bit.GPIO32 = 3;  // Select EPWM1SOCA as driving source

        GpioG1CtrlRegs.GPBDIR.bit.GPIO33  = 1;  // Set as output

        GpioG1CtrlRegs.GPBMUX1.bit.GPIO33 = 3;  // Select EPWM1SOCB as driving source

        EDIS;

     

    // Step 3. Clear all interrupts and initialize PIE vector table:

    // Disable CPU interrupts

        DINT;

     

    // Initialize the PIE control registers to their default state.

    // The default state is all PIE interrupts disabled and flags

    // are cleared.

    // This function is found in the F28M35x_PieCtrl.c file.

        InitPieCtrl();

     

    // Disable CPU interrupts and clear all CPU interrupt flags:

        IER = 0x0000;

        IFR = 0x0000;

     

    // Initialize the PIE vector table with pointers to the shell Interrupt

    // Service Routines (ISR).

    // This will populate the entire table, even if the interrupt

    // is not used in this example.  This is useful for debug purposes.

    // The shell ISR routines are found in F28M35x_DefaultIsr.c.

    // This function is found in F28M35x_PieVect.c.

        InitPieVectTable();

     

    // Interrupts that are used in this example are re-mapped to

    // ISR functions found within this file.

        EALLOW; // This is needed to write to EALLOW protected register

        PieVectTable.ADCINT1 = &adc1_isr;

    //    PieVectTable.ADCINT2 = &adc2_isr;  ?????????????????????????????????????????

       

        EDIS;   // This is needed to disable write to EALLOW protected registers

     

    // Step 4. Initialize all the Device Peripherals:

    // This function is found in F28M35x_InitPeripherals.c

    // InitPeripherals(); // Not required for this example

        InitAdc1(); // For this example, init the ADC

        InitAdc2();

     

    // Step 5. User specific code, enable interrupts:

    // Enable ADCINT1 in PIE

        PieCtrlRegs.PIEIER1.bit.INTx1 = 1;  // Enable INT 1.1 in the PIE

        IER |= M_INT1;                      // Enable CPU Interrupt 1

    // ADCINT2 in PIE ???????????????????????????????????????????????????????????????   

        EINT;                               // Enable Global interrupt INTM

        ERTM;                               // Enable Global realtime interrupt DBGM

     

    // Configure ADC and EPWM1 sub-modules

        ConfigAdc1();

        ConfigAdc2();

     

        LoopCount = 0;

        ChannelCount = 0;

     

    // Wait for ADC interrupt

        for(;;)

        {

            LoopCount++;

            if (LoopCount %1000)

            {

                   VoltageSum[0] += 0;

            }

        }

     

    }

     

    interrupt void  adc1_isr( void )

    {

           

    //      int i;

            VoltageSum[0] = Adc1Result.ADCRESULT0;

        VoltageSum[1] = Adc1Result.ADCRESULT1;

        VoltageSum[2] = Adc1Result.ADCRESULT2;

        VoltageSum[3] = Adc1Result.ADCRESULT3;

        VoltageSum[4] = Adc1Result.ADCRESULT4;

        VoltageSum[5] = Adc1Result.ADCRESULT5;

        VoltageSum[6] = Adc1Result.ADCRESULT6;

        Adc1Regs.ADCINTFLGCLR.bit.ADCINT1 = 1;  //Clear ADCINT1 flag reinitialize

                                                // for next SOC

        Adc2Regs.ADCINTFLGCLR.bit.ADCINT1 = 1;  //Clear ADCINT1 flag reinitialize

        PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE

     

        return;

    }

    interrupt void  adc2_isr( void )

    {

    //      int i;

        VoltageSum[7] = Adc2Result.ADCRESULT0;

        VoltageSum[8] = Adc2Result.ADCRESULT1;

        VoltageSum[9] = Adc2Result.ADCRESULT2;

        VoltageSum[10] = Adc2Result.ADCRESULT3;

        VoltageSum[11] = Adc2Result.ADCRESULT4;

        VoltageSum[12] = Adc2Result.ADCRESULT5;

        VoltageSum[13] = Adc2Result.ADCRESULT6;

        VoltageSum[14] = Adc2Result.ADCRESULT7;

        Adc1Regs.ADCINTFLGCLR.bit.ADCINT1 = 1;  //Clear ADCINT1 flag reinitialize

                                                // for next SOC

        Adc2Regs.ADCINTFLGCLR.bit.ADCINT1 = 1;  //Clear ADCINT1 flag reinitialize

        PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE

     

        return;

    }

    void ConfigAdc1( void )

    {

        // Configure ADC

        EALLOW;

       

        Adc1Regs.ADCCTL2.bit.ADCNONOVERLAP = 1;     // Set ADC to non-overlap mode

       

        Adc1Regs.ADCCTL1.bit.INTPULSEPOS   = 1;     // EOC trips after conversion result is latched

        Adc1Regs.INTSEL1N2.bit.INT1E       = 1;     // Enabled ADCINT1

       

        Adc1Regs.INTSEL1N2.bit.INT1CONT    = 0;     // Disable ADCINT1 Continuous mode

        Adc1Regs.INTSEL1N2.bit.INT1SEL     = 1;     // setup EOC1 to trigger ADCINT1

     

        // Select ADC input channels                                             

        Adc1Regs.ADCSOC0CTL.bit.CHSEL      = 0;     // set SOC0 channel select to ADC1A0

        Adc1Regs.ADCSOC1CTL.bit.CHSEL      = 2;     // set SOC1 channel select to ADC1A2

        Adc1Regs.ADCSOC2CTL.bit.CHSEL      = 3;     // set SOC2 channel select to ADC1A3

        Adc1Regs.ADCSOC3CTL.bit.CHSEL      = 4;     // set SOC3 channel select to ADC1A4

        Adc1Regs.ADCSOC4CTL.bit.CHSEL      = 6;     // set SOC4 channel select to ADC1A6

        Adc1Regs.ADCSOC5CTL.bit.CHSEL      = 7;     // set SOC5 channel select to ADC1A7

        Adc1Regs.ADCSOC6CTL.bit.CHSEL      = 12;     // set SOC6 channel select to ADC1B4

       

        // Setup ADCINT1 and ADCINT2 trigger source

        Adc1Regs.INTSEL1N2.bit.INT1SEL = 6;      //EOC6 triggers ADCINT1

        Adc1Regs.INTSEL1N2.bit.INT2SEL = 14;     //EOC14 triggers ADCINT2

     

        // Setup each SOC's ADCINT trigger source

        Adc1Regs.ADCINTSOCSEL1.bit.SOC0  = 2;    //ADCINT2 starts SOC0-7

        Adc1Regs.ADCINTSOCSEL1.bit.SOC1  = 2;

        Adc1Regs.ADCINTSOCSEL1.bit.SOC2  = 2;

        Adc1Regs.ADCINTSOCSEL1.bit.SOC3  = 2;

        Adc1Regs.ADCINTSOCSEL1.bit.SOC4  = 2;

        Adc1Regs.ADCINTSOCSEL1.bit.SOC5  = 2;

       

        // Set S/H window of 7 ADC clock cycles                                            

        Adc1Regs.ADCSOC0CTL.bit.ACQPS      = 6;     // S/H = ACQPS + 1    

        Adc1Regs.ADCSOC1CTL.bit.ACQPS      = 6;    

        Adc1Regs.ADCSOC2CTL.bit.ACQPS      = 6;    

        Adc1Regs.ADCSOC3CTL.bit.ACQPS      = 6;    

        Adc1Regs.ADCSOC4CTL.bit.ACQPS      = 6;    

        Adc1Regs.ADCSOC5CTL.bit.ACQPS      = 6;    

       

        EDIS;

    }

     

    void ConfigAdc2( void )

    {

        // Configure ADC

        EALLOW;

       

        Adc2Regs.ADCCTL2.bit.ADCNONOVERLAP = 1;     // Set ADC to non-overlap mode

        

        Adc2Regs.ADCCTL1.bit.INTPULSEPOS   = 1;     // EOC trips after conversion result is latched

        Adc2Regs.INTSEL1N2.bit.INT2E       = 1;     // Enabled ADCINT1

        Adc2Regs.INTSEL1N2.bit.INT1CONT    = 0;     // Disable ADCINT1 Continuous mode

        Adc2Regs.INTSEL1N2.bit.INT1SEL     = 1;     // setup EOC1 to trigger ADCINT1

     

        // Select ADC input channels                                             

        Adc2Regs.ADCSOC0CTL.bit.CHSEL      = 0;     // set SOC0 channel select to ADC2A0

        Adc2Regs.ADCSOC1CTL.bit.CHSEL      = 2;     // set SOC1 channel select to ADC2A2

        Adc2Regs.ADCSOC2CTL.bit.CHSEL      = 3;     // set SOC0 channel select to ADC2A3

        Adc2Regs.ADCSOC3CTL.bit.CHSEL      = 4;     // set SOC1 channel select to ADC2A4

        Adc2Regs.ADCSOC4CTL.bit.CHSEL      = 6;     // set SOC0 channel select to ADC2A6

        Adc2Regs.ADCSOC5CTL.bit.CHSEL      = 7;     // set SOC1 channel select to ADC2A7

        Adc2Regs.ADCSOC6CTL.bit.CHSEL      = 8;     // set SOC0 channel select to ADC2B0

        Adc2Regs.ADCSOC7CTL.bit.CHSEL      = 12;     // set SOC1 channel select to ADC2B4

       

        // Setup ADCINT1 and ADCINT2 trigger source

        Adc2Regs.INTSEL1N2.bit.INT1SEL = 6;      //EOC6 triggers ADCINT1

        Adc2Regs.INTSEL1N2.bit.INT2SEL = 14;     //EOC14 triggers ADCINT2

     

        // Setup each SOC's ADCINT trigger source

        Adc2Regs.ADCINTSOCSEL1.bit.SOC0  = 2;    //ADCINT2 starts SOC0-7

        Adc2Regs.ADCINTSOCSEL1.bit.SOC1  = 2;

        Adc2Regs.ADCINTSOCSEL1.bit.SOC2  = 2;

        Adc2Regs.ADCINTSOCSEL1.bit.SOC3  = 2;

        Adc2Regs.ADCINTSOCSEL1.bit.SOC4  = 2;

        Adc2Regs.ADCINTSOCSEL1.bit.SOC5  = 2;

        Adc2Regs.ADCINTSOCSEL1.bit.SOC6  = 2;

        Adc2Regs.ADCINTSOCSEL1.bit.SOC7  = 2;

       

        DELAY_US(ADC_usDELAY);                  // Delay before converting ADC1

       

        // Set S/H window of 7 ADC clock cycles                                           

        Adc2Regs.ADCSOC0CTL.bit.ACQPS      = 6;     // S/H = ACQPS + 1    

        Adc2Regs.ADCSOC1CTL.bit.ACQPS      = 6;    

        Adc2Regs.ADCSOC2CTL.bit.ACQPS      = 6;    

        Adc2Regs.ADCSOC3CTL.bit.ACQPS      = 6;    

        Adc2Regs.ADCSOC4CTL.bit.ACQPS      = 6;    

        Adc2Regs.ADCSOC5CTL.bit.ACQPS      = 6;    

        Adc2Regs.ADCSOC6CTL.bit.ACQPS      = 6;    

        Adc2Regs.ADCSOC7CTL.bit.ACQPS      = 6;    

       

        EDIS;

    }

     

     

  • I solved the adc2_isr problem (missing prototype) and have tried a PIE setup for adc2 (PieCtrlRegs.PIEIER1.bit.INTx2 = 1; IER |=M_INT2;), but still cannot read any analog inputs. All I get are bogus constant values that remain if I remove the analog inputs. I have tried the other ADC examples as well, have tried introducing delays,etc. Nothing seems to work. I would be happy if someone had an example of successfully reading just one analog input showing all the setup required.

    Thanks for any help.

  • Pat,

    The adc_soc example should work if you use it straight from controlSUITE.  The example samples channels 0 and 2 on ADC1.  I know you said you already used the example, but if it doesn't work than there could be a board issue.  Make sure you use the setup_m3 project for the M3.

    Regards,

    Ricky

  • Ricky,

    Thanks for your response. Since that last entry, I have been able to determine that my problem with ADC1 is caused by the HAL_API that is used for the PLC example software. I have communicated that to the PLC team and am waiting for a reply. The problem is that the HAL initialization seems to destroy the ADC1 result register refresh capability, such that ADC1 will only refresh with a power cycle. Although this is not directly related to the adc_soc_example, the problem first arose when I tried to add the adc_soc task with extensions for additional adc channels to the example PHY code uses ADC1_B0 only but it affects all of ADC1 channels).

    Thanks,

    Pat

     

  • Hello Ricky,

    Do you see any issue driving the Concerto ADC with OP2320?  I plan to bias the OP2320 with 3.3VDC like the Concerto ADC Module, and the ADC REFHI will be 3V, so the inputs will not be overdriven due to a fault.  I like the OP2320 due to its low output impedance, so harmonic distortion is not adversely impacted.

    Best Regards,

    Natallia

  • Hi Natallia,

    I think using 3.3V to supply the op-amp while using a 3.0V VREFHI voltage is a good idea and should work well.

    In general I don't see any issues with using OPA2320 as a driver for the Concerto ADC, although you may need more than 20MHz bandwidth if your closed loop gain is high.

    You may want to go through a checklist like this video:

    https://www.youtube.com/watch?v=8lxCo1U07Bs

    Let me know if you have any trouble finding parameters like the acquisition time and the ADC S+H capacitor size in the Concerto datasheet.

  • Hello Devin,

    During fault conditions, the circuit may drive to 3.3V, which is the ADC bias voltage.  The end goal is to eliminate any clamping diodes, which are not reliable, by judicious voltage selection, so there is no issue.

     Here is the question:  What overdrive voltage can the F28m35H52C ADC can take without issue?

    From the datasheet sheet this appears to be VDDA can you confirm?

    Natallia

  • Natallia,

    The ADC inputs have similar protection diodes to the digital pins, so the user can drive -0.3V to 4.6V on the ADC pins without causing permanent damage, assuming that both the instantaneous and continuous clamping currents are met: +/-20mA and +/-2mA respectively (DS section 5.1 - absolute maximum ratings).  The protection diodes turn on at around VDDA + 0.3V or VSSA - 0.3V.   

    The user also can not apply a voltage on the ADC inputs of greater than VDDA + 0.7V when the device is unpowered or powering up (DS section 6.5 -  power sequencing).