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.

Why GPIO2 mot working?

Other Parts Discussed in Thread: AM3358

Hi,

I can control GPIO0 with __raw_writel(), but it doesn't work for GPIO2. When  I write

__raw_writel(0xFFFFFFBF, 0x481AC000+0x134);

The program hangs up. How can I output a high on GPIO2_6? I'm using AM3358. Thanks.

DL

 

  • 1 reason I can think of is that the clock for GPIO2 is not enabled. Or even if the pin-mux for GPIO2 is not properly set

  • Hi Coder,

    I think, by default GPIO2 clock is not enabled in u-boot, add these lines to interface_clocks_enable function in "board/ti/am335x/pll.c" file to enable GPIO2 clock.

    /* GPIO2 */
    writel(PRCM_MOD_EN, CM_PER_GPIO2_CLKCTRL);
    while (readl(CM_PER_GPIO2_CLKCTRL) != PRCM_MOD_EN);

    Regards

    AnilKumar

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

  • Thank you, Gururaja and Anil,

    It's just like what you said. After the GPIO2 clock is enabled, the GPIO2 output works. I was totally on a wrong track. Time and time again I learned that most of the problems are in the first order. Don't jump quickly to higher orders.

    Thanks again,

    DL