Generating PWM on Tiva C connected launchpad (TM4C1294)

tiva pwm tutorial
Tiva C pulse width modulation
Help us grow. Share with your friends!

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.

Incoming search terms:

nuclearrambo

Salil is an electronics enthusiast working on various RF and Microwave systems. In his free time he writes on the blog, talks over ham radio or builds circuits. He has Yaesu FT2900R VHF transceiver, FT450D HF transceiver and a TYT UV8000E Handheld transceiver.

You may also like...

2 Responses

  1. Neha says:

    Complex one….but enjoyed reading programming…interesting PWM

  1. August 27, 2018

    […] the previous post where we generated PWM? We are going to use the PWM output from the TivaC microcontroller and drive an RF switch. I will […]

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.