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/TM4C1294NCPDT: TM4C Microcontrollers Forum

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: EK-TM4C1294XL

Tool/software: Code Composer Studio

I have found a example program as follows from tivaware of PWM doesnot get build.  

#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_types.h"
#include "inc/hw_gpio.h"
#include "inc/hw_memmap.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/pwm.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "utils/uartstdio.h"
#include "drivers/pinout.h"
#include "driverlib/rom_map.h"


//system clock variable
uint32_t g_ui32SysClock;

int main(void){

//1. set the clock to run off of crystal at 25Mhz
g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN \
| SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480), 120000000);

//2. Enable the PWM Module in the System Control using
//enable peripheral (port F)
SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

//2b. secret level; unlock port F0 so that we can use it!!! >=O
while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOF)));
HWREG(GPIO_PORTF_AHB_BASE+GPIO_O_LOCK) = GPIO_LOCK_KEY;
HWREG(GPIO_PORTF_AHB_BASE+GPIO_O_CR) |= GPIO_PIN_0;

//configure pin as a PWM pin
GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_1);
GPIOPinConfigure(GPIO_PF0_M0PWM0);

//3. Set the pwm clock to the system clock/64
PWMClockSet(PWM0_BASE, PWM_SYSCLK_DIV_64);

//4. Configure the PWM generator
PWMGenConfigure(PWM0_BASE, PWM_GEN_0, (PWM_GEN_MODE_DOWN | PWM_GEN_MODE_NO_SYNC));

//5. Set the period for the generator
//set pwm to run at 100hz . (N = (1 / f) * SysClk) ; (1 / 100Hz) * (120MHz/64) = 18750 cycles
unsigned long period = 18750;
PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, period);

//6. Enable the PWM outputs
// Enable the PWM1 Bit 0 (PF1) and Bit 1 (PF2) output signals.
PWMOutputState(PWM0_BASE, (PWM_OUT_0_BIT | PWM_OUT_1_BIT), true);

//7. set the pulse width
PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0, (period/2));

//8. Enable the PWM Generator
PWMGenEnable(PWM0_BASE, PWM_GEN_0);
}

The following errors are found when build. What may be the problem.

  • Hi Azim,

     Can you tell me where is this example in Tivaware you found? Have you tried the PWM examples under <TivaWare_Installation>\examples\pwm?

     In order for the example you are showing to compile you need to have the include path to the drivers folder. The drivers folder is normally found as shown below under examples/boards/ek-tm4c1294xl.

  • Azim,

    Did you just copy/paste the program into a blank project?

    You should actually use the CCS Menu option Project, and then Import CCS Project. That is likely to recover all the necessary settings.

    Bruno
  • @Bruno,

    Indeed you, vendor agents, and experienced (thru the wars) CCS vets "know this." But from where is this EASILY/PROPERLY "PRESENTED" to hapless new users? So many posters - landing here - PROVE that "existing descriptions/methods - have FAILED!"

    May we note that while there was NO TIME to FIX this Weakness - there was "time aplenty to BAN "LIKE" - for the most unjustifiable reason (fiction, anyone?) and pronounce that a (laughable) forum upgrade...

    Fixing the (extreme number/occurrence) of "JTAG Lock-Outs" should receive (some) consideration too - is that not patently true?

    Might this "ducking the real issues" - while destroying an important "contributor feedback monitor" - display a "misapplication of resources?"