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 mdio_data -> LED 6a
HWREG( 0x44E1094C) = 7 | 0; // gpio0 mdio_clk -> LED 6b
HWREG( 0x44E10954) = 7 | 0; // gpio0 spi0_d0 -> output
HWREG( 0x44E10968) = 7 | 0; // gpio1 uart0_ctsn -> input
Then a simple loop procedure get the pin state and toggles accordingly a led in ICE board and a GPIO pin:
The GPIOPinWrite() is working, but the GPIOPinRead() always returns FALSE, so nothing lits up.
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 is given below.
Bit 6 : SLEWCTRL : Fast – 0
Bit 5: RXACTIVE : Receiver Enabled : 1 (Since GPIO1 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 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.
These are the basic steps to toggle the GPIO line
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
Please mark this Forum post as answered via the Verify Answer button below if it helps answer your question. Thanks!
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.
TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs andembedded processors, along with software, tools and the industry’s largest sales/support staff.