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.

Read F28M35 ADC result register

Other Parts Discussed in Thread: CONTROLSUITE

Dear All,

        When I debug the sample project "adc_soc_c28"in the controlSUITE,which located:

         \controlSUITE\device_support\f28m35x\v200\F28M35x_examples_Control\adc_soc

        ADC will trigger interrupt after conversion and read the adc result register,the problem is that execute one instruction that read the result register will need 40 clock cycles,why need so many? Please help me.

         And the picture is here.

   Thanks and Best regards!

  • Hi,

    I guess this post will surely shed some light on your doubt:

    http://e2e.ti.com/support/microcontrollers/c2000/f/171/t/149673.aspx

    Regards,

    Gautam

  • Dear Gautam,

    My question is that why the CPU spend so many cycles(40 cycles)  on read ADC conversion result register one time. I think it should  be 2-5 cycles execute the instruction one time.

           " Voltage1[ConversionCount] = Adc1Result.ADCRESULT0;"

    Regards,

    Lynn 

  • I got your question now, did you check with :

    volt1 = Adc1Result.ADCRESULT0;

    Just interchanging array with an integer. Let mew know what your observations are.

    Regards,

    Gautam

  • Dear Gautam,

    Change the array to integer,here is the picture

    Regards,

    Lynn

  • Hi Lynn,

    Thanks for the detailed screenshot. I'm amazed to check out the clock cycles. Let me check it on my hardware and revert.

    Regards,

    Gautam

  • Lynn, here's my observation:

    9 clock cycles for V_digital = ((AdcRegs.ADCRESULT0>>4) );

    Hardware: F28335 control card at 150MHz clock

    Regards,

    Gautam

  • Dear Gautam,

    Thanks for your debug carefully.

    The ADC of F28335  is very different from F28m35.(Fastest conversion time,F28335:80ns,F28m35:172ns)

    I want to know that what the CPU(F28m35) doing in the 40 cycles,

    Whether or not start the conversion when read the ADC result registers?

    Thank and regards

    Lynn

  • The ADC of F28335  is very different from F28m35.(Fastest conversion time,F28335:80ns,F28m35:172ns)

    I want to know that what the CPU(F28m35) doing in the 40 cycles,

    Whether or not start the conversion when read the ADC result registers?

    Yup, I know that but that's what I'm wondering 40cycles is huge!

    What I've observed with F28335 to is:

    When you go for the full resolution ie

    V_digital = AdcRegs.ADCRESULT0;        // It takes 33 clock cycles

    if with lesser resolution say:

    V_digital = (AdcRegs.ADCRESULT0>>4);   // It takes 9 clock cycles

    So finally, what one can conclude from this is; the time taken to move the huge data to the variable is what consuming clock cycles. Smaller the data faster it is:)

    Regards,

    Gautam

  • Dear Gautam,

          F28m35 ADC register is right-justified.

          Now,I debug like this:

    bb = Adc1Result.ADCRESULT1;   // It takes 35 cycles

    bb = Adc1Result.ADCRESULT1>>4;  // It takes 3 cycles

    bb = (Adc1Result.ADCRESULT1<<4)>>4;  // It takes 3 cycles

    It seems strange !

    Thanks and best regards.

    Lynn

  • So are you satisfied with the result or still have any doubt ?

    Regards,

    Gautam

  • Dear Gautam

         Yes,my doubt is that why "    aa = (Adc1Result.ADCRESULT0<<4)>>4;"takes 3 cyecles,but 

         aa = Adc1Result.ADCRESULT0; takes 33 cycles.

    Thanks and regards

    Lynn

  • Lynn what I feel is, if you monitor the AdcResult registers with both the configurations you would observe that the values tend to increase if aa = Adc1Result.ADCRESULT0 is used. So moving the value from Result register to "aa" variable is what might be taking more cycles. Whereas in the other case with "aa= AdcRegs.ADCRESULT0>>4" implementation the value of result register varies from 0 to 4095; which takes lesser time to be moved to "aa".

    Regards,

    Gautam

  • Dear Gautam,

           Thanks for your help very much.

            Best regards

    Lynn

  • You're welcome, Lynn.

    Good Luck & Regards,

    Gautam

  • Dear all,


    I unfortunately encounter a similar problem as above, but on a F28M36 Control Card, on the C28 processor.

    The sampling time seems normal (around 1us to sample two channels sequentially), i get the interrupt after the ADC results are done, and to read the values from the memory it takes a lot of time. For me to read the data for 8 ADC channels it takes about 2us, just to copy the numbers from the memory to variables!!!

    As mentioned above, i have tried the normal way (variable= Adc1Result.ADCRESULT0;), the CCS debug shows 4 clock cycles necessary, and also 4 disassembly instructions. But come on, these 4 cycles and instructions will take 2us/8=250ns? The clock frequency is setup as 150MHz, 6.666ns/cycle.

    The shift to the right does not work in this case, as you loose relevant bits, and i have also tried (variable= (Adc1Result.ADCRESULT0<<4)>>4;) which takes about the same time but 5 clocks and 5 assembly instructions.

    Can someone please explain why it takes so much time to read and copy the data from the ADC result registers?

    Best regards,

    Ionut

  • Hi Ionut,

    ADC result reads need to cross the ACIB.  The ACIB clock is typically 37.5MHz:

    The number of ASYSCLK cycles need for various operations are given in the TRM here:

  • You can also reference this thread to see if the DMA can help reduce your ADC result read latency: e2e.ti.com/.../1072786
  • Dear Devin,

    Thanks for pointing out the facts. I am however disappointed with the ADC in the F28M36, as however i think of it is in the end very slow. I was thinking that the simultaneous sampling would make it faster bu the conversion time is the same, so not too much value added with the additional sample and hold.

    Unfortunately my conclusion is that the nice ADC features in the good old F28335 are not present anymore in the F28M36. I don't know yet the quality of the sampler in this ADC, but the good old F28335 could sample data much much faster. I guess there must have been some compromises to be made when making the joint with the ARM core.

    Best regards,

    Ionut

  • Dear Tlee,
    Thanks for the suggestion, but since the ADC is so slow i will probably not mess with the DMA for now - but seems like a good idea when you want fast data pull out of 1 or 2 channels.
    I have 8 channels to read, so i will program to get the interrupt after the EOC0, and then slowly start to read data while is sampling the other channels. I may loose about 1us more, but then the whole slow ADC process increases from 2.24us to 3.52us. If I will need another us to spare, I will probably go for the DMA, thank for the suggestion.
    Best regards,
    Ionut