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.

TM4C1231H6PGE: Why does PD7 behave differently from PD6 on DK-TM4C123G launcher pad?

Part Number: TM4C1231H6PGE

Hi all, I am seeing different behavior between PD6 and PD7 on DK-TM4C123G launcher pad and hopefully someone can shed some light on why. I am running the code attached to this post which is really the blinky example project without some minor modification, when I use PD6 as the GPIO pin, I can see that its output toggles between HIGH and LOW when the code runs, however when I change the GPIO pin to PD7, its output always stay at LOW, why?

Here is the code:

#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"

#define TEST_GPIO_PORT GPIO_PORTD_BASE
#define TEST_GPIO_PIN GPIO_PIN_7
#define SYSCTL_PERIPH_PORT SYSCTL_PERIPH_GPIOD

//*****************************************************************************
//
//! \addtogroup example_list
//! <h1>Blinky (blinky)</h1>
//!
//! A very simple example that blinks the on-board LED.
//
//*****************************************************************************

//*****************************************************************************
//
// Blink the on-board LED.
//
//*****************************************************************************
int
main(void)
{
volatile uint32_t ui32Loop;

//
// Enable the GPIO port that is used for the on-board LED.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_PORT);

//
// Check if the peripheral access is enabled.
//
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_PORT))
{
}

//
// Enable the GPIO pin for the LED (PG2). Set the direction as output, and
// enable the GPIO pin for digital function.
//
GPIOPinTypeGPIOOutput(TEST_GPIO_PORT, TEST_GPIO_PIN);

//
// Loop forever.
//
while(1)
{
//
// Turn on the LED.
//
GPIOPinWrite(TEST_GPIO_PORT, TEST_GPIO_PIN, TEST_GPIO_PIN);

//
// Delay for a bit.
//
for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++)
{
}

//
// Turn off the LED.
//
GPIOPinWrite(TEST_GPIO_PORT, TEST_GPIO_PIN, 0);

//
// Delay for a bit.
//
for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++)
{
}
}
}

Thanks!

Richard

  • Typo correction: "...blinky example project without some minor modification" should be "...blinky example project with some minor modification"
  • It appears that you've "yet to note" that PD7 "defaults" into an "NMI Input" mode.     (one of two pins which does such)

    To  "rescue/remove"  PD7 from that (most often) unwanted fate - you must first "Unlock it."     Forum Search box - atop this page - details the "how to unlock" process.

    Once unlocked - your normal "GPIO as output" methods will (magically) restore PD7 to order...

    Should you (or others) be wondering - PD7's "Partner in unwanted crime is PF0" - which requires similar "unlocking."

    For ages - myself/others have suggested that "improved alerting of such"  - w/in vendor documentation & elsewhere (here?)  - proves helpful/worthwhile.     (our suggestion has (yet) to "Move vendor's needle...")

    Might it be "fair" to ask then - Does it prove useful to erect an "Insufficient Guard Rail" - knowing that  "NEW User-Clients"  will inevitably approach "S-curved" mountain peaks at high speed - and (too often) - PLUNGE  from their (temporary) mountain perch?

  • Thanks for the quick response Cb1! As you can see from the attached code, I configure PD6 and PD7 in the identical way, I just changed TEST_GPIO_PIN  macro to GPIO_PIN_7 or GPIO_PIN_6 for testing. I have thought about the default configuration of the pin PD7 might not be GPIO, however the datasheet of TM4C123G clearly states that it is a GPIO pin by default, please see table 9-8 on page 599 .

    Regards,

    Richard

  • Hello Richard,

    cb1 is mostly right though, regarding the unlock comments.

    See the following comment from the datasheet regarding the 'a' next to PD[7]:

    • a. This pin is configured as a GPIO by default but is locked and can only be reprogrammed by unlocking the pin in the GPIOLOCK register and uncommitting it by setting the GPIOCR register.


    This is where your issue lays, so you do need to follow the steps outlined in this posting: https://e2e.ti.com/support/microcontrollers/tiva_arm/f/908/t/374640

  • Hi Cb1, you are correct on "Once unlocked - your normal "GPIO as output" methods will (magically) restore PD7 to order...", I unlocked PD7 before calling GPIOPinTypeGPIOOutput (), now PD7 works as PD6!

    Thanks for the great help!

    Richard
  • Thank you Ralph! Yes, what Cb1 suggested works, I just replied in my previous post.

    Thank you guys for the quick response and helpful tips, I felt TI community is very helpful and useful, particularly for the beginners like myself.

    Thanks
    Richard
  • Richard,

    We note that you've "two times" marked your post as, "Having resolved your issue."     Yet - that is incorrect - is it not?  

    Was not the post which  first noted & advised - of PD7's "unique requirement" (to be unlocked) - REALLY the post which "Best Resolved your issue?"     That post is FAR MORE DESERVING of  the "Splash of green."    

    The 2 posts (awarded)  "This resolved" - realistically  "Only confirmed" the resolution success - provided by your (earlier) - fast responding helpers."

  • Cb1, your original post resolved my problem, sorry I didn't know how "This resolved my issue" button works and didn't pay much attention as well, yes the later posts just confirmed the resolution success.

    Thanks
    Richard
  • Thank you, Richard - and indeed - the forum (significantly FAILS) in fully/properly advising user-clients.

    Instead of properly explaining forum protocol - (i.e. Focusing upon "productive efforts") - time, funds, energy were invested in "Banning LIKE" - (even when) "Ticking LIKE" - provides motivating "affirmation" - for those providing (repeating) service - in the assistance of others.

    You should be well on your way now - again thank you - and firm/I wish you continued growth & success...