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.

TMS320F28335: Need support for PWM with potentiometer in TMS320F28335 control card.

Part Number: TMS320F28335

Hello,

Am trying to run  HRPWM_SFO_CCS5 example program inC2000 explorer kit with F28335 control card.

With the above example, epwm signals(duty cycle/voltage) get varying, automatically.

But I would like to do the same by  varying the potentiometer VR2 to see change in PWM voltage & dutycycle.

Kindly help me to achieve this. Thanks.

  • Nethaji,

    please confirm my understanding: you would like to control the duty cycle of a PWM signal with a potentiometer. Note:Our devices do not have the ability to adjust the voltage of the PWM signals, their voltage is either at Ground or VDDIO.

    If my understanding is correct, you should connect the potentiometer to an ADC pin, for the best way to do this I would recommend you look at a circuit design book. Using the F28335 device you can sample the voltage on that pin using the ADC. After sampling you can then use some simple math to convert the voltage you read into your desired PWM output.

    Regards,
    Cody

  • Hello Cody,

    Thanks for the Reply.

    As mentioned above, do i expect to connect Potentiometer to ADC Pins? But the Board [C2000 explorer Kit ] have 2 Pot's, VR1[A0] & VR 2[A1], do i need to any external POT ?

    In Such Case, Please confirm my understanding :
    Shall i use the control Suite Example: "ADC Start of Conversion (adc_soc) //! //! This ADC example uses ePWM1 to generate a periodic ADC SOC on SEQ1". But here thy use ADCINA3 and ADCINA2 for ADC Conversion.

    If I make bit modification with ADCINA0[VR1] & ADCINA1[VR2] , do the program would satisfy my need , "Change PWM duty Cycle by Varying Potentiometer "

    Please correct me, if i do wrong anywhere.

    Thanks,
    Nethaji D
  • I apologize Nethaji, I didn't realized you were using the peripheral explorer, I thought you were wanting to use an external Potentiometer, I’ll be sure to read more carefully next time.

    You do not need an external pot, if you change the code to read from ADCINA0/ADCIN1 you can use VR1/VR2 to provide different voltages on those ADC pins. From that point it should be pretty easy to setup the PWM and vary its duty cycle depending on the value you read from ADCINA0 or ADCINA1.

    Regards,
    Cody

  • Hi Nethaji,

    There is an example in MATLB/Simulink support packages for C2000 processors. This example utilizes the ADC results to adjust the PWM duty cycle.

    See the below link, it will help you if you want to compile your code using MATLAB.

    www.mathworks.com/.../texasinstrumentsc2000_product-c280x_2833x_adcpwmasynctest_ert-adc-pwm-synchronization-via-adc-interrupt

    Javy
  • Hello Javy,

    Thanks for the reply.

    In the matlab example, there is a point that :

    Hardware Connections
    Connect the function generator output to the ADC input ADCINA0 on the board.

    Please could anyone clarify,Is there any ADC pin after the name, ADCINA0. Becoz, I believe ADCINA0 is the Potentiometer VR1 from the C2000 explorer kit.


    And Much I couldn see any reference to define POTENTIOMETER in any example. Please let me know how to declare the Potentiometer PINS [ for c2000 explorer kit ] in the programs.

    Note: I assumed with ADCINA0 to be Potentiometer in C2000 Explorer kit & created OUT file. After loading in C2000 explorer kit, I couldn't see any change in the EPWM1 pin with changing the Potentiometer.

    Thanks.

  • Nethaji,

    I don't have access to MATLAB tools, and cannot help you debug that specifically.

    However, from a Peripheral Explored standpoint: ADCINA0 is connected to the potentiometer VR1 through the peripheral explorer, this allows you to vary the voltage on ADCINA0. I don't know anything about the MATLAB example, however it is my understand that the function generator is solely used to drive a voltage on the ADCINA0 pin. If that assumption is correct you shouldn't need to connect a function generator, and can simply use VR1 to adjust the voltage.


    Regards,
    Cody

  • Hello Javy,

    Thanks for the reply.
    Atleast I have tried this with C2000 explorer kit and am getting the PWM signal at epwm1A.
    But am getting voltage range of 1mV to 1.6 Volts on varying the VR1. why is it so ? why not Board reference voltage 3.3V ?
    And muchmore to get 0-5v range from PWM, do i suppose to add-on anything to the simulink model ?
    Anyhelp would be greatly appreciated.
    Thanks,
    Nethaji D