• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Microcontrollers » Stellaris® ARM® Microcontrollers » Stellaris® ARM® LM3S Microcontrollers Forum » Get some problem: use GPIOC pin3 like a normal GPIO pin
Share
Stellaris® ARM® Microcontrollers
  • Forum
Options
  • Subscribe via RSS
Helpful Stellaris® LM4F Series Links
  • LM4F Series
  • Stellaris PinMux Utility
  • Stellaris® LM4F120 LaunchPad
  • LM4F MCU Applications
  • LM4F MCU Video
  • ARM Cortex-M4F Whitepaper
  • Stellaris MCU Brochure
  • LM4F232 Eval Kit
  • Get some problem: use GPIOC pin3 like a normal GPIO pin

    Get some problem: use GPIOC pin3 like a normal GPIO pin

    This question is answered
    James Miler
    Posted by James Miler
    on Dec 27 2012 02:45 AM

    I used LM3s811 EVAL Board and configed GPIO pin3 (1 of 4 JTAG pin) like a normal GPIO pin and write '1' value to this pin, so I get some problem: "Please power cycle the board and try again".

    Somebody can help me fix it?

    Many thanks!

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • cb1-
      Posted by cb1-
      on Dec 27 2012 10:09 AM
      Verified Answer
      Verified by James Miler
      Mastermind9110 points

      You've "broken" the normal JTAG connection array by re-configuring PC_3.  MCU datasheet advises (more than once) that PC_0 - PC_3 are JTAG - should not be used otherwise!

      Most Stellaris enable a utility w/in LMI Flash Programmer to "restore" JTAG - but unfortunately your part is "Sandstorm" class - and not included.

      If you reconfigured PC_3 deep enough w/in your code - you may be able to "force" the program to halt - and then attach debugger and remove the PC_3 offending code.  (search this forum - I advised TI client in just this manner - and it worked!)  Each case is unique though - prescribe more datasheet reading - less action - in your case...

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • James Miler
      Posted by James Miler
      on Dec 27 2012 11:36 AM
      Mastermind0 points

      Many thanks to you!

      It is my mistake, I want to use PC4 but I typed wrong. Then I didn't check before use!

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • cb1-
      Posted by cb1-
      on Dec 27 2012 12:13 PM
      Verified Answer
      Verified by James Miler
      Mastermind9110 points

      James Miler
      I want to use PC4 but I typed wrong.

      Ouch!  That is unfortunate...

      Again - depending upon "where" in your code this misfortune occurred - you may be able to "force" the MCU to halt - and then switch in the debugger to remove this errant code.

      There's one other possibility - although its very messy.  You have not lost SWD program/debug capability.  (appears upon PC_0 & PC_1.)  Should you have an SWD/JTAG probe - and if you can "break" the existing connections from MCU PC_0 - PC_3 - to the FTDI chip on the 3S811 board - you can likely use SWD for debug & programming.  (of course you must "bring out" PC_0 & PC_1 for attachment to your SWD/JTAG probe for this to work)

      Our firm places warning cards about PC_0 - PC_3 at each workstation - any use of Port C should be double/triple checked when using Sandstorm...   Good luck... 

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • James Miler
      Posted by James Miler
      on Dec 27 2012 22:10 PM
      Mastermind0 points

      I paste my code below. I've readed this topic http://e2e.ti.com/support/microcontrollers/stellaris_arm_cortex-m3_microcontroller/f/471/p/127677/458597.aspx#458597, but my line Display96x16x1Init(false) below wrong code line.

      int
      main(void)
      {
          uint8_t data;
          uint8_t i;
          unsigned long result;
          //
          // Set the clocking to run directly from the crystal.
          //
          SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                         SYSCTL_XTAL_6MHZ);

          //
          // Enable the peripherals used by this application.
          //
          SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
          SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
          SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
          SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI);

          // Configure the push button as an input and enable the pin to interrupt on
          // the falling edge (i.e. when the push button is pressed).
          //

          GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_4);
          GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_3);
          GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_5);
          GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_6);
          GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_3);

          GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 |
                         GPIO_PIN_2);
          SSIConfigSetExpClk(SSI_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0,
                             SSI_MODE_MASTER, 1000000, 8);
          GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_3,0);
          SSIEnable(SSI_BASE);
          //
          // Set the global and local indicator of pin mode to zero, meaning JTAG.
          //

          //
          // Initialize the OLED display.
          //
          Display96x16x1Init(false);
          Display96x16x1StringDraw("Hello", 0, 0);
          SysCtlDelay(SysCtlClockGet()/3);
          //initMRF24J40();
          //enterSendMode();
          SSIDataPut(SSI_BASE, 0x99);
          SSIDataPut(SSI_BASE, 0x33);
          while(SSIBusy(SSI0_BASE))
          {
          }
          SSIDataGet(SSI_BASE, &result);
          Display96x16x1StringDraw(tem, 1, 1);
          for (i = 0x00; i <= 0x3F; i++)
          {
              data = getShortRAMAddr(i<<1);
              snprintf(tem, sizeof(tem), "%d", i);        
              Display96x16x1StringDraw(tem, 0, 0);
              tem[0]='\0';
              snprintf(tem, sizeof(tem), "%d", data);
              Display96x16x1StringDraw(tem, 0, 1);
              tem[0]='\0';
              SysCtlDelay(SysCtlClockGet()/3);
              Display96x16x1Clear();
          }                       */
          
          //
          // Loop forever.  This loop simply exists to display on the OLED display
          // the current state of PB7/PC0-3; the handling of changing the JTAG pins
          // to and from GPIO mode is done in GPIOCIntHandler().
          //
          while(1)
          {
          }
      }

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • cb1-
      Posted by cb1-
      on Dec 27 2012 22:52 PM
      Verified Answer
      Verified by James Miler
      Mastermind9110 points

      James Miler
      GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_6);
          GPIOPinTypeGPIOInput(GPIO_PORTC_BASE, GPIO_PIN_3);

      As you realize - red highlight is the instruction which, "does you in."  Just maybe - if we're extremely lucky - instruction just before (which places PC_6 as input) can trigger an interrupt "before" PC_3 instruction executes.  (your code shown does not reveal - or I've missed it.)  This "may" enable enough time for your debugger to establish contact - although I would not, "hold my breath." 

      Should you - or friends/firms nearby have automated equipment - simplest & cleanest fix is to remove that MCU and replace. 

      Our misfortune is that the re-purposing of PC_3 happens quite early in your code - may not be time (or a proper means) for the debugger to gain control.  (your MCU actually reverts to JTAG from power-up/reset - only switches PC_3 upon reaching the highlighted instruction - this is what we seek to prevent)

      If you/friends do not have proper equipment - and you have a "real" JTAG/SWD Probe - my earlier suggestion about SWD should work.  (our firm uses SWD: PC_0 & PC_1 almost exclusively - gaining 2 GPIO in the process)  But you must "open" tracks joining your MCU to the FTDI chip - and then create a lead extension for PC_0 & PC_1 - not for the faint of heart...

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • James Miler
      Posted by James Miler
      on Dec 28 2012 09:27 AM
      Mastermind0 points

      I fixed it. I don't know how to say thank you.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • cb1-
      Posted by cb1-
      on Dec 28 2012 09:47 AM
      Mastermind9110 points

      Thanks is always nice - and you've shown that repeatedly!

      More importantly - for unfortunate others (sometime in the future) - kindly explain w/some detail, "just how" you achieved the "fix."

      I suffered the same fate - back in 2007 - and was saved by, "Stellaris Dan" - who taught me this method.

      There is a better way yet - which should be mandatory for ALL Sandstorm Class (i.e. LM3S1xx, LM3S3xx, LM3S6xx, and LM3S8xx) users!  Find, study and employ the file, "gpio-jtag.c" which provides a SW safety mechanism which can restore JTAG without use of the LMI Flash Programmer.  (Flash Programmer signals "no support" for Sandstorm)  You are to place this "gpio-jtag.c" defensive/safety code at the top of your program - this enables JTAG to be quickly/easily restored should a Port_C "mistake" occur. 

      This method works well for newer class devices too - far faster/easier/less stressful to, "recover JTAG" via a single GPIO - or Timer - or xxx - than to have to run the Flash Unlock Utility...

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use