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 PWM question - Initialization and PWM on/off control



Hi,

I was following a TI sample code. (HVACI_Sensorless_28335) The code initializes the IO pins as PWM outputs first, and then initializes the PWM module.

Then what is the state of the PWM port pins after initialization of the IO until initialization of PWM?

Also is there a nice way to turn on or off the PWM outputs? I am thinking to do this by changing the port function from PWM to GPIO or vice versa. If anyone has a better solution, please let me know.

Thank you!

  • Hi Seok,

    All GPIOs will be a GPIO input at reset.  However, note that some GPIOs will have a pull-up enabled while others do not.  Most GPIOs that can be used as PWM outputs have the GPIO pull-up disabled at reset.

    See:
    http://processors.wiki.ti.com/index.php/General_Purpose_IO_%28GPIO%29_FAQ_for_C2000


    There are several methods to force PWM outputs:
    1) change the duty cycle and its respective CMPx to 0% or 100%
    2) change the PWM outputs to GPIOs
    3) force the PWM outputs (using the PWM's AQCFRC register)
    4) use Trip Zone (TZ) events to force several PWMs high or low simultaneously.  These TZ events could be driven by software or by external inputs into the device.


    Thank you,
    Brett

  • Thank you, Brett

    I am going to use your solution 2) in my code.

    I think that you did not understand the first part of my question. The first question was:

    - I thought that the ePWM output pin should show either '1' of '0' once the GPIO was configured as PWM output. In the TI's sample project, the code initializes the GPIO as PWM function before PWM function is initialized. What will be show at the PWM output after this GPIO initialization? Is the output in high impedance state until the PWM function is initialized? I could not find clear explanation of this situation in any TI document.

     

    To avoid any unkown situation, I am going to follow the next steps.

    1) Initialize GPIOs as GPIO inputs. (As reset default)

    2) Initialize ePWM to generate PWM

    3) Wait at least one PWM cycle so that the internal PWM signal is in known state.

    4a) Change GPIO configuration as ePWM output when I need tp turn on PWM outputs.

    4b) Change GPIO configuration as GPIO intput when I need to turn off PWM outputs.

  • Seok,

    Once the PWM signal is chosen to go through the GPIO mux the signal will be driven (not hi-Z).  Based on the default initialization of the PWM it will be driven low until it is configured differently.  Note that this is not explicitly stated in the user manual.

    What you plan to do is valid as well.


    Thank you,
    Brett

  • Brett,

    I finished testing. It was working fine.

    Thank you!