Generating PWM on Tiva C connected launchpad (TM4C1294)

Browse By

Spread the word
  • 43
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    43
    Shares

Texas Instrument's Tiva C connected launchpad is a really powerful Cortex M4 microcontroller board. The possibilities with this chip are endless. In this post, we will be generating PWM output on one of the GPIO pins of TM4C1294 microcontroller. A simple PWM output can be of great use in many applications. Few of the common applications include motor control, LED brightness control, switching solid state relays and so on. On the other hand, I have something else in my mind. I plan on using this PWM output to toggle Minicircuits RF SP2T switch for generating pulsed RF. We will that discussion for a second part of this article. Meanwhile, we will have a quick look on generating PWM with the Tiva microcontroller.

Let us define a few things before we begin.

We will use Port G pin 1 on the microcontroller as our PWM output pin.

Let's begin

Let us begin by enabling a few things.

We have to use the PWM module 0 since it is connected to Port G pin 1 as defined in the data sheet.

Table showing pins connected to PWM module 0

Moving ahead, we will now enable the alternate function of the GPIOG Pin 1, that is, PWM-channel-5. Furthermore, we will configure the PWM module to work in UP-DOWN mode, set the frequency and duty cycle. Finally, we shall enable the output and observe waveform on an oscilloscope.

You may have noticed the variable "pwm_word" and wondered what that is. According to data sheet, the frequency is calculated according to the following equation:

Finally, we end the configuration with a...

Now, we should see the desired PWM output on the screen.

PWM On time waveform

Screenshot showing the ON time as 100ns

PWM entire cycle

Screenshot showing inter pulse period of 100us. Thus, frequency = 10kHz

In the next article we will look at how this waveforms helps in producing a pulsed RF waveform. I am sure you will find that one interesting as well!

You can find the complete code below.

 


Spread the word
  • 43
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    43
    Shares

One thought on “Generating PWM on Tiva C connected launchpad (TM4C1294)”

  1. Neha says:

    Complex one….but enjoyed reading programming…interesting PWM

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.