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.

ADC Code Problem with TMS320F28027 (C2000 Piccolo LaunchPad)

Other Parts Discussed in Thread: TMS320F28027

Hello guys,

I run the example code (Example_2802xAdcSoc - Direct Register Access) on my C2000 Launchpad MCU (TMS320F28027). The problem is that I can't change the sampling frequency of the signal. Even if I change the  "AdcRegs.ADCSOC0CTL.bit.TRIGSEL" and  "AdcRegs.ADCSOC0CTL.bit.ACQPS " values, I see no difference in the sampled signal (I use  "graph" to view my sampled signal). I tried to change the PWM Period too ("EPwm1Regs.TBPRD" - it is used for the interrupts I suppose), but I see no difference in the graph. The result is incorrent, because the signal I see in graph is not exactly the input signal I use. I need a higher samping frequency...How can I change the sampling frequency in ADC??? I would also appreciate it, if you could give me some example codes for the ADC Sampling and Conversion (except these included in Control Suite).

Thanks for your support!

Nick.

  • Hi Nikolaos,

    In this example to increase the sample rate you will want to reduce the value of EPwm1Regs.TBPRD.

    Increasing ACQPS will reduce the sample rate, but only in continuous sampling operation. In ePWM driven operation it will increase the trigger-to-output latency.

    You may want to get the unmodified example to work correctly before worrying about changing the sample rate. How are the results incorrect? Is it distorted, or not at all what you input? In the first case, you may want to look at what circuitry you are using for signal conditioning and consider things like reducing the signal source impedance, adding some signal filtering, increasing the S+H duration, and/or buffering the signal. In the second case, you may want to check that you are sourcing your signal to the correct pin and that the current sample rate won't cause aliasing of your signal (if you are getting aliasing, try to get things working with a slower signal first).

    Note that there are some continuous conversion examples for F2807x. This device has a somewhat similar ADC SW model to F2802x, so it shouldn't be too hard to port these examples to F2802x. I think there is also an example of continuous full-speed conversions in the ADC header files in the Uint16 AdcConversion(void) function inside F2802x_adc.c inside the F2802x_common directory.
  • Thank you Devin! Your answer was very helpful! Thanks a lot for your advice, too!

    Nick.