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.

DELFINO ADC PROBLEM

Other Parts Discussed in Thread: CONTROLSUITE

Hello All

I want to acquire data from all 16 channels of ADC...

I am using Delfino 28335 but i am unable to program the ADC to acquire data from all channels...

I want to start conversion from software and read all 16 channels and keep then updating..

 

plz help how to set parameter for that..

also how to use Regs.ADCMAXCONV.all for reading all 16 channels...

also i coudnt set clock timings..

 

Regards

Salman

  • Hello Salman,

    What hardware setup are you using (TI controlcard, TI experimenter's kit, custom PCB, etc.)?

    Your best bet is to start with one of the F28335 ADC examples from controlSUITE.  

    After the function InitAdc() is called

    ADC setup can be as follows:

    //25MHz ADC clock setup with 150MHz CPU clock speed

    AdcRegs.ADCTRL1.bit.ACQ_Pfor S = 0; // Sampling window 12.5 MS/s
    AdcRegs.ADCTRL3.bit.ADCCLKPS = 0; // Core clock divider, set to HSPCLK/1 => 25MHz ADCLK


    AdcRegs.ADCTRL1.bit.SEQ_CASC = 1; // 1 Cascaded mode

    AdcRegs.ADCMAXCONV.bit.MAX_CONV1 = 0xF; // Set for 16 conversions each sequence

    AdcRegs.ADCCHSELSEQ1.all = 0x3210;   // All conversions will be performed on separate channels
    AdcRegs.ADCCHSELSEQ2.all = 0x7654;
    AdcRegs.ADCCHSELSEQ3.all = 0xBA98;
    AdcRegs.ADCCHSELSEQ4.all = 0xFEDC;

    AdcRegs.ADCTRL1.bit.CONT_RUN = 1; // Set the ADC to run in continuous mode

    AdcRegs.ADCTRL2.bit.SOC_SEQ1 = 1; // Software trigger SOC for sequencer (start converting on selected channels)

    ADC will continue to convert until CONT_RUN = 0

    Regards,

    Adam

  • Thanks for the answer...

    now i shd write the above lines in main code and then proceed as follow

    while(1)

    {

            while (AdcRegs.ADCST.bit.INT_SEQ1== 0) {}
            AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1;
            SampleTable[0] =((AdcRegs.ADCRESULT0>>4) );

            SampleTable[1] =((AdcRegs.ADCRESULT1>>4) );

             SampleTable[2] =((AdcRegs.ADCRESULT2>>4) );

           SampleTable[3] =((AdcRegs.ADCRESULT3>>4) );

            SampleTable[4] =((AdcRegs.ADCRESULT4>>4) );

             SampleTable[5] =((AdcRegs.ADCRESULT5>>4) );

             SampleTable[6] =((AdcRegs.ADCRESULT6>>4) );

             SampleTable[7] =((AdcRegs.ADCRESULT7>>4) );

             SampleTable[8] =((AdcRegs.ADCRESULT8>>4) );

              SampleTable[9] =((AdcRegs.ADCRESULT9>>4) );

              SampleTable[10] =((AdcRegs.ADCRESULT10>>4) );

             SampleTable[11] =((AdcRegs.ADCRESULT11>>4) );

             SampleTable[12] =((AdcRegs.ADCRESULT12>>4) );

             SampleTable[13] =((AdcRegs.ADCRESULT13>>4) );

             SampleTable[14] =((AdcRegs.ADCRESULT14>>4) );

             SampleTable[15] =((AdcRegs.ADCRESULT15>>4) );

    }

    now this code will continuously read the 16 channels...

    m i right??

  • Yes. That looks correct.

    You can also use AdcMirror.ADCRESULTx instead of shifting each result for efficiency.

    ex. SampleTable[0] = AdcMirror.ADCRESULT0

    Regards,

    Adam

  • thanks for the reply..

    u set clock as follow

    //25MHz ADC clock setup with 150MHz CPU clock speed

    AdcRegs.ADCTRL1.bit.ACQ_Pfor S = 0; // Sampling window 12.5 MS/s
    AdcRegs.ADCTRL3.bit.ADCCLKPS = 0; // Core clock divider, set to HSPCLK/1 => 25MHz ADCLK

    if i want to sample at 100 samples or 100 Ksamples / sec (all channels)... How should i change the register values????

     

  • Salman,

    I think your best bet would be to use ePWM to trigger the ADCSOC's so that you can have greater control of the sampling rate.  You can find an example in controlSUITE named Example_2833xAdcSoc which uses this method.

    Regards,

    Adam

  • thanks for the reply..

    well my pwm channels are already in use so i cant use them for this adc...

    actually by running ur code i found following issues..

    1. I coudnt read exact values at all channels.. like whn i apply 2.6V i read 2.53 V... similarly when i applied 3V i read 2.8V... and at 1.62V i read 1.59V...

    their was jumps of about 3mV in the values as well... The values were not static...

    error in readings was alot...

    so how ro reduce this error... i want to reduce sampling rate so that i can get more time to sample the signals... So how to set it for a sample rate of 100Hz or 1000Hz or 100KHz...

     

  • Hello All

    I am stuck in my adc..

    Actually it is not giving me true readings...

    error of almost 0.03V is in my adc

    i am using the code as written in above posts...

    my problems are

    1. i cannot able to run simultaneous mode like when i set ADCTRL3.bit.SMODE_SEL = 1 my adc only convert first channel... rest shows garbage data...

    however when i set this bit as 0 and run in sequential mode ADC convert my 15 channels but not the 16th... with 0.03V error in it..

    why their is error and why my adc not reading 16th channel...

    also why my simultaneous mode not running...

  • Salman,

    ADCTRL3.bit.SMODE_SEL  should be zero by default.  This will put the device in sequential sampling mode.

    What hardware setup are you using (TI controlcard, TI experimenter's kit, custom PCB, etc.)?

    What is/are the source/s of the voltages you are trying to sample?  Are all 16 channels sampling the same source?

    What is the CPU clock frequency at which you are running?

    Adam

  • im using custom board with 150Mhz frequecy...

    im giving prescision voltage on the channels...

    error is +/-30mV on all channels...

    How to use simultaneous sampling??

  • Salman,

    An example for simultaneous mode using cascaded sequencer can be found in the ADC UG on p. 19.

    If you are already using all PWMs, you can use CPU timers to trigger your ADCSOCs.  The setup info for the timers can be found in the System Control and Interrupts UG.

    Hope this helps.

    Adam