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.

stellaris-M4 GPIOPinConfigure()

Hi, I am trying to communicate UART on the Stellaris cortex-M4 LM4F232. In the example “uart_echo”, it didn’t use the following f(x):

       GPIOPinConfigure(GPIO_PA0_U0RX);

       GPIOPinConfigure(GPIO_PA1_U0TX);

But if I use the pin PE4 and PE5 as U5RX and U5TX,do I must use the  GPIOPinConfigure()?I am pasting my code below:

  When I compile this code by MDK-Keil, there are two errors, my question is:

I have put the “pin_map.h” into my project as Fig.1, and the “pin_map.h” had defined the UART port as Fig.2. Why does it point out the U5RX andU5TX are undefined

  • Hi Paul,

         I have uart_echo example program revision 9453 of the EK-LM4F232 Firmware Package. GPIOPinConfigure() was not used to set GPIO A0 and A1 as UART. This code below was used to do that. Setting GPIO E4 and E5 as UART could be done the same way. (I have not tried)

    //
    // Set GPIO A0 and A1 as UART pins.
    //
    ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    -kel

  • Looks to me like you've covered all bases:

    Port_E Enabled
    UART Enabled
    PinType and
    Pin Config

    The UART example using Port_A may not have been well considered (for use as example) as that UART function is the "default" for Port_A bits 0 and 1.  Thus - set-up/config is simpler/easier - and will surely fail if copy/pasted (w/out required additions) to any other Port!  (the SSI bits (2-5) - Port_A - also default - set a similar trap...)

    Now file pin_map.h is MCU Specific - thus appears you've not properly informed your IDE of your MCU!

    We don't know/use Keil - but that error msg (prefixed adc.c) alarms!   And this suggests another, even larger issue.  adc.c is a "base" StellarisWare function - you should not be changing it in any manner.  adc.c is effectively "accessed" by your program by simply including its header file, adc.h, atop your program file.  And adc.c does not include pin_map.h.

    You must carefully avoid overlapping the names of any files w/in StellarisWare\driverlib with your file creations.  You will note that all StellarisWare example programs avoid any/all direct calls to the driverlib's .c files.  (i.e. you should not see - nor use - direct calls to: gpio.c, adc.c, pwm.c etc.)