• 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 » ARM® Processors » Sitara™ ARM® » AM3x Sitara ARM Processors Forum » AM3359 ICE GPIO config
Share
Sitara™ ARM®
  • Forum
  • Announcements
Options
  • Subscribe via RSS

AM3359 ICE GPIO config

AM3359 ICE GPIO config

This question is answered
eugenio
Posted by eugenio
on May 28 2012 07:29 AM
Intellectual550 points

Hi all.

I want to configure an AM3359 pin as GPIO input on ICE dev board. The pin is GPIO1.8. 

Thihs is the configuration code:

	// GPIO.0 POWER ENABLE
	HWREG( SOC_PRCM_REGS + 0x408 )  			   |= 0x2;
	// GPIO.1 POWER ENABLE
	HWREG( SOC_PRCM_REGS + 0x0AC )  			   |= 0x2;


	// PINMUX SETUP
	HWREG( 0x44E10948) = 7 | 0;	//	gpio0[0]	mdio_data -> LED 6a
	HWREG( 0x44E1094C) = 7 | 0;	//	gpio0[1]	mdio_clk  -> LED 6b
	HWREG( 0x44E10954) = 7 | 0;	//	gpio0[3]	spi0_d0  -> output
	HWREG( 0x44E10968) = 7 | 0;	//	gpio1[8]	uart0_ctsn  -> input

	GPIODirModeSet(SOC_GPIO_0_REGS,0,GPIO_DIR_OUTPUT);
	GPIODirModeSet(SOC_GPIO_0_REGS,1,GPIO_DIR_OUTPUT);
	GPIODirModeSet(SOC_GPIO_0_REGS,3,GPIO_DIR_OUTPUT);
	GPIODirModeSet(SOC_GPIO_1_REGS,8,GPIO_DIR_INPUT);


Then a simple loop procedure get the pin state and toggles accordingly a led in ICE board and a GPIO pin:

		if (GPIOPinRead(SOC_GPIO_1_REGS,8))
		{
			GPIOPinWrite(SOC_GPIO_0_REGS, 3,GPIO_PIN_HIGH);
			GPIOPinWrite(SOC_GPIO_0_REGS, 0,GPIO_PIN_HIGH);
		}
		else
		{
			GPIOPinWrite(SOC_GPIO_0_REGS, 3,GPIO_PIN_LOW);
			GPIOPinWrite(SOC_GPIO_0_REGS, 0,GPIO_PIN_LOW);
		}

The GPIOPinWrite() is working, but the GPIOPinRead() always returns FALSE, so nothing lits up.

Suggestions?

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Gurudutt Bharadwaj
    Posted by Gurudutt Bharadwaj
    on Jun 22 2012 06:16 AM
    Verified Answer
    Verified by eugenio
    Prodigy625 points
    Pad Control Register.JPG

    Hello Eugenio,

    Firstly, apologize for the late reply.

    The code snippets that you have provided in your post are quite clear.

    However, I see that the Pin Multiplexing code is incomplete. It  is assumed that you are referring to the Pad Control Register to perform Pin Multiplexing. This register description is present in the Control Module chapter of the AM335x TRM. Please find the register description snapshot attached.

    The Pin multiplexing details for GPIO1[8] is given below.

    Bit 6 : SLEWCTRL : Fast – 0

    Bit 5:  RXACTIVE :  Receiver Enabled :  1 (Since GPIO1[8] shall be used an Input pin)

    Bit 4:  PULLTYPESEL :  Pullup selected : 1

    Bit 3: PULLUDEN : Pullup/pulldown enabled – 0

    Bits 2:0 : MUXMODE : 7

    Therefore the pin multiplexing code for GPIO1[8] is:

    HWREG(SOC_CONTROL_REGS + CONTROL_CONF_UART_CTSN(0)) = (0x20 | 0x10| 0x7)

     

    Similar procedure for Pin Multiplexing has to be followed for all the other pins in context.

     

    Thanks and Regards.

    Gurudutt.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Anil
    Posted by Anil
    on Jun 23 2012 01:27 AM
    Verified Answer
    Verified by eugenio
    Expert6655 points

    Hi eugenio,

    These are the basic steps to toggle the GPIO line

    Pinmux:-

    Do pinmux configurations accordingly

    GPIO:- Set gpio3 pin to high

    Set GPIO value:

    gpio_reg_val = 0x00000008; /* for GPIO3 */
    writel(gpio_reg_val, GPIO0_BASE + 0x194);

    Set GPIO direction:

    gpio_reg_val = readl(GPIO0_BASE + 0x134);
    gpio_reg_val &= ~(0x00000008);
    writel(gpio_reg_val, GPIO0_BASE + 0x134);

    Note: Make sure that same pinmux registers are not configured for different purpose

    Regards

    AnilKumar

    Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question.  Thanks!

    AM335x GPIO
    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