• 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 » Settings SysCtlClockSet
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
  • Settings SysCtlClockSet

    Settings SysCtlClockSet

    This question is not answered
    Luk Fel
    Posted by Luk Fel
    on Aug 11 2011 09:19 AM
    Prodigy65 points

    Hi. I know that my question may seems very simple but i don't know how to solve it. I'm beginning the work with EKK-LM3S9B96 and i stuck in the easiest program. I just want to turn on some led.

    #include <LM3Sxxxx.H>
    int main()
    {
    while(1)
    {
    SysCtlClockSet(SYSCTL_SYSDIV_2,SYSCTL_USE_OSC,SYSCTL_XTAL_16MHZ); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE,GPIO_PIN_3); GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_3,0xff);
    }
    }

    I think that the section responsible for set GPIO is correct. I just enable peripheral PORTA, set PIN3 as output and write 1. I think the problem is with SysCtlClockSet. I tried several options with this funkcion and possible set clock wrong.
    How to calculate arguments of SysCtlClockSet? For example i want to get 6MHz oscillator. What ulConfig should be?
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Andy Neil
      Posted by Andy Neil
      on Aug 11 2011 09:30 AM
      Guru31975 points

      You forgot to link to the story so far: http://www.keil.com/forum/19369/

      Latest:

      There is a 'Blinky' example for every Stellaris Evaluation Kit (EK), and the DK-LM3S9B96 - so that covers every Stellaris family!

      And:

      There is no "EKK-LM3S9B96" listed on the TI site - only the DK-LM3S9B96:

      http://focus.ti.com/docs/toolsw/folders/print/dk-lm3s9b96.html

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Christian Jolivet
      Posted by Christian Jolivet
      on Aug 11 2011 10:03 AM
      Expert5240 points

      Hi Luk,

      The function SysCtlClockSet is documented in the SW-DRL-UG-####.pdf file in the "docs" directory of your main StellarisWare folder.  That should address your questions about how to achieve a variety of different system clock frequencies.  Other than that, exactly what is the problem you are seeing?

      Christian

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Luk Fel
      Posted by Luk Fel
      on Aug 11 2011 10:59 AM
      Prodigy65 points

      Hi Christian,

      The problem is i can't turn on led and i think when i try several options with SysCtlClockSet i may set somethink wrong. Is possibility to go back to default settings clock. I search in my Stellaris folder but i don't found a file that You write. Maybe i'm overtired and i don't see it :(

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Andy Neil
      Posted by Andy Neil
      on Aug 11 2011 11:07 AM
      Guru31975 points

      The documents are in a folder named, appropriately enough, "docs"

      For Stellarisware release 7243, the document you require is: SW-DRL-UG-7243.pdf

       

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • cb1_mobile
      Posted by cb1_mobile
      on Aug 12 2011 13:52 PM
      Guru21870 points

      Doubt "speed" is your problem- do realize that you've potentially turned "all bits" of that port "high."  (not just your led control pin)  Might it be that the Led's cathode returns to the MCU pin - meaning that MCU pin must go "low" to light the Led?  Also - add delay as shown:

      SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);

      Delay();

      GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE,GPIO_PIN_3);

      GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_3,  GPIO_PIN_3);  //  preferred manner to "set" specific port pin

      GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_3,  0);  // this is how to "reset" that same pin

      More useful if your code would alternate between each of the above GPIO_PIN_3 settings.  You must insert delays so that you can physically "see" these changes.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • slandrum
      Posted by slandrum
      on Aug 15 2011 09:01 AM
      Mastermind9510 points

      Actually, his setting of the pin will only set the single pin to high, and will work just as well as the "recommended" solution.  If it didn't work, correctly, then the recommended solution wouldn't work either, as it would force the outputs of the other pins on the port to zero.

      The 2nd argument to GPIOPinWrite is a mask that defines which pins on the port will be written to.  So a call of the form GPIOPinWrite(<port>, <pins>, 0xff) will always set the specified pins (and only the specified pins) to a high output state.  And there's a small chance that it will generate smaller/faster code with an optimizer if 0xff is a constant value that's used a lot and will tend to be hanging around in a register.

       

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • cb1_mobile
      Posted by cb1_mobile
      on Aug 15 2011 09:46 AM
      Guru21870 points

      You are correct - however sense that you "missed" my key word "potentially."   Precision of law school & engineering exploits such detail...  Stand by my post.

      BTW - how many times are you/I/Andy going to "correct" such GPIO issues?

      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