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.

Undefined GPIO_PB6_T0CCP0 even though included pin_map.h

I am having a problem with an error that says : "error #20 identifier "GPIO_PB6_T0CCP0" is undefined.

I have included the header file for pin_map where this deceleration is located so how is it saying it is undefined?


#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "driverlib/sysctl.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/timer.h"

#include "inc/hw_ints.h"
#include "driverlib/interrupt.h"







volatile unsigned long pulseCount;


int main(void)
{
    unsigned long ulPeriod, dutyCycle;

    //40 MHz system clock
    SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);

    ulPeriod = 1000;
    dutyCycle = 250;



    //Set the peripherals that will be used
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

    GPIOPinConfigure(GPIO_PB6_T0CCP0);
    GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_6);

    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);

    //timer config
    SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
    TimerConfigure(TIMER0_BASE, TIMER_CFG_SPLIT_PAIR|TIMER_CFG_A_PWM);
    TimerLoadSet(TIMER0_BASE, TIMER_A, ulPeriod -1);
    TimerMatchSet(TIMER0_BASE, TIMER_A, dutyCycle); //Duty Cycle
    TimerEnable(TIMER0_BASE, TIMER_A);


    // use PC7 as external interrupt:
    GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_7|GPIO_PIN_6);
    GPIOPinIntClear(GPIO_PORTC_BASE,GPIO_PIN_7|GPIO_PIN_6);
    GPIOIntTypeSet(GPIO_PORTC_BASE, GPIO_PIN_7|GPIO_PIN_6, GPIO_RISING_EDGE);
    GPIOPinIntEnable(GPIO_PORTC_BASE, GPIO_PIN_7|GPIO_PIN_6);
    IntEnable(INT_GPIOC);
    // Enable processor interrupts.
    IntMasterEnable();

    while(1)
    {

    }

}


void chAHandler(void){


    unsigned int ulInts = GPIOPinIntStatus(GPIO_PORTC_BASE, true) ;

    if(ulInts & 0x80)
    {
        // Handle GPIO pin 7.
        GPIOPinIntClear(GPIO_PORTC_BASE,GPIO_PIN_7);
        pulseCount++;
    }

    if(ulInts & 0x40)
    {
        // Handle GPIO pin 6.
        GPIOPinIntClear(GPIO_PORTC_BASE,GPIO_PIN_6);
        pulseCount++;
    }


}

  • Sigh.... Everybody is doing this...

    PART_LM4F120H5QR

    Properties --> Build --> Arm Compiler --> Advanced Options --> Predefined Symbols

    On the Top Panel -- add the part.: PART_LM4F120H5QR

    Or whatever it is...

    I am assuming Code Composer Studio and Launchpad since you did not bother to tell us different -- next time include that stuff -- just like a car yah know -- Model, make and year, 4, 6 or 8 Cyl, Automatic or standard -- stuff like that -- only computer parts...

  • Oh right I should have remembered that from the workshop videos. Learning the Stellaris Launchpad definitely requires some patience and yes it is the launchpad.

    Thank you for your help.

  • As you're aware - file pin_map.h is massive - and is segregated by Stellaris MCU part numbers.  I've checked - and you are correct in that many of the newer LX4 devices and also many of the higher performing LM3S devices report, "GPIO_PB6_T0CCP0" - just as you state.  However I found that the simpler members of the LM3S family - and smaller pin-count LX4s - do not include this pin definition.

    Thus - issue breaks down into which MCU you are using - and whether your IDE has enabled you to properly include the MCU part number - so that the "proper" area w/in pin_map.h may be searched.  As stated - many M3 and several M4 devices do not recognize, "GPIO_PB6_T0CCP0."

    We do note that your latest code now includes the suggested interrupt clear function - as identified here in your earlier/similar post...

    Update: Ratz - see that sleepless, bloody Canadian has beat me to the punch once again...

  • Hey CB -- I could say that (and worse) about You! <grin>

    You need your beauty rest -- as we discussed a couple of days ago!

    I'm about to pack in -- boss is due in shortly.

    Erik is now in charge for the rest of the night.  :-)

    Erik:

    Also

    #define PART_LM4F120H5QR

    will work -- but the entry in the compiler is better since it applies to all your code.

  • i took same mistake but couldnt fix it.
  • Hello Lightsaber

    What is the define for PART that you are using? Have you included the pin_map.h file in your code?
  • Yes, for example I'm trying to make a new project on CCS and I copied the codes from Lab2 of Workbook pdfs.

    When i save my new project and run it, it gives some errors. like it said "cannot open source file inc/hw_types" and it says for all libraries

    should i create the project under StellarisWare/boards/MyLaunchPadBoard ?

    I'm a beginner and really dont have enough capabilities and sources. But I'm trying to solve it. If you can help me, I'l be glad.

  • Hello Lightsaber

    Are you using StellarisWare or TivaWare?
  • stellarisware
  • Hello Lightsaber,

    I would suggest moving to TivaWare for TM4C products.