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.

CCS/TMS320F28335: Sine input analog signal in ADC

Part Number: TMS320F28335
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Greetings TI team, 

I am using TMS320F28335 experimenter kit. I want to input sine signal (0-3V) from a function generator into the ADC pin A0 and obtain SPWM from ePWM block . As per the calulation in the manual http://www.ti.com/lit/ug/spru812a/spru812a.pdf

Digital Value= 0, when input ≤ 0 V 

Digital Value =4096 *(( Input Analog Voltage* ADCLO)/ 3) , when 0 V < input < 3 V

Digital Value = 4095, when input ≥ 3 V 


Input parameters 

Sine signal 0-3V .

Freq = 50Hz

offset = +1.5V

ePWM Block

Timer period = 7500  i.e Switching Freq of 10KHz

up-down counting mode

CCS V5 and Matlab 2015a. Thanks in advance for your help.

Simulink model

The PWM output is as follows:

SPWM output is not continous.

  • Something looks wrong with your numbers.  If you take a 0-3V sine input and offset it by +1.5V the ADC would see a 1.5-4.5V sine wave a the ADC pin.  If that's what you mean above.  Start by physically measuring what's at the ADC pin on an oscilloscope to verify it's what you expect.

    In your model, you should be able to connect a 'scope block or something to the ADC output to check the numbers there are in range.  I don't know how to do that with an EC model (you'd have to check with Mathworks).  You could also experiment by lowering the value of the gain block to get a clue what's going on.

    If you are still in difficulty I suggest raising the question on The Mathworks customer support page, here:

    http://www.mathworks.com/support/  

    Regards,

    Richard

  • Greetings Richard,

    Thanks for your reply. I have cross checked the ADC signals settings as follows ,

    Frequency = 50Hz

    Amplitude 3V = +1.5V to -1.5V

    Offset : 0.75V for 1.5V

    Regarding the Gain calculation, Since my carrier frequency is 10KHz, I kept the timer period as 7500 clock cycles.

    So ADC block digital output will be 4096 for 3V.

    Gain = (7500/4096)

    Gain =1.83 or 2 approx.

    Regarding the Model i load and run in F28335 via CCS not with MATLAB, So i wont be able to monitor via matlab when i run the DSP.
    Is there any option to monitor each value of input and output pins of the F28335 experimenter kit via Code composer studio.

    Regards,

    Logeesan

  • OK, thanks for doing that.  The first thing is to ensure the voltage at the ADC pin is in the 0-3V range. I didn't quite follow "Offset : 0.75V for 1.5V" but I assume your input signal is correct.

    If you're using CCS it's straightforward to log a variable and display it in a graph window. There is a fixed-point data logger in the Digital Control Library in C2000Ware (in the file "DCL_log32.h"), or maybe you have a different one you prefer. Anyway, I recommend logging the ADC results to verify they are what you expect. I think your problem lies there.

    You could also run the ADC SOC example for this device in C2000Ware.

    C:\ti\c2000\C2000Ware_2_00_00_03\device_support\f2833x\examples\adc_soc

    Regards,

    Richard

  • Greetings Richard, 

    Thanks for replying. I did run sample program and as well as my custom program as below model 1. I have logged the data and attached screenshot for reference of model 1. Are these logged values are normal or do i need to change the parameters. 

    Model 1:

    ADC input sine wave 0.5V and no offset voltage

    ADC input sine wave 1.0V and no offset voltage

    ADC input sine wave 1.5V and no offset voltage

    ADC input sine wave 1.5V and with 0.75V offset voltage

    Best REgards,

    Logeesan 

  • Logeesan,

    Yes, these plots could be correct.  If you reduced the sampling rate or increased the frequency of the sine wave the last plot should look more sinusoidal.

    Regards,

    Richard

  • This post will be closing soon, please reply here or start a related thread if you have more questions.

    Regards,
    Cody