GPIO default state

Discussion in 'General Discussion' started by mirots, Jan 15, 2014.

  1. mirots

    mirots New Member

    Joined:
    Dec 26, 2013
    Messages:
    15
    Likes Received:
    1
    Hi guys,

    I understand that most GPIOs of both processors are connected between them and setting a connected GPIO on both processors to "out" can damage the board.

    But what is the default state of the GPIOs? Is it configured to "IN" by default on both processors?

    For example: Is it safe to set pin GPIO 123 on Freescale (pin 22) to OUT and change it values, without checking the state of Atmel? (Explicitly making an Arduino sketch that defines PIN 2 to IN)

    Thanks
    Meir Tseitlin
     
  2. delba

    delba Administrator Staff Member

    Joined:
    May 8, 2013
    Messages:
    1,064
    Likes Received:
    9
    Well lets see, for the imx6 side the GPIO are configured to "IN" by default while for the SAM there isn't a default configuration for the GPIO but the processor puts them in High impedance (which means "IN") when there's no sketch uploaded.
     
  3. mirots

    mirots New Member

    Joined:
    Dec 26, 2013
    Messages:
    15
    Likes Received:
    1
    Tanx!
     
  4. delba

    delba Administrator Staff Member

    Joined:
    May 8, 2013
    Messages:
    1,064
    Likes Received:
    9
  5. mirots

    mirots New Member

    Joined:
    Dec 26, 2013
    Messages:
    15
    Likes Received:
    1
    Regarding Freescale - you are probably right.

    Regarding SAM - this is not what I am experiencing (and it is actually pretty weird):

    On all GPIOs I measure 3.3v by default (even if I explicitly set them as INPUT). Only if I set them to OUTPUT and LOW, I can measure 0v.

    According to my knowledge - GPIO set to INPUT should behave as "Disconnected".

    Can you explain it?

    --
    Meir Tseitlin
     
  6. crystofhervega

    crystofhervega New Member

    Joined:
    Sep 16, 2014
    Messages:
    1
    Likes Received:
    0
    I'm having the exact same issue, I've been looking for hours now, have you found an answer yet, someone please respond to this matter
    thank you in advance
     
  7. TomFreudenberg

    TomFreudenberg Member

    Joined:
    May 12, 2014
    Messages:
    59
    Likes Received:
    2
  8. sirrab

    sirrab UDOOer

    Joined:
    Jul 26, 2014
    Messages:
    264
    Likes Received:
    32
    When a digital I/O pin set to an input, it will usually "float" high(your 3.3v).
     
  9. fetcher

    fetcher Member

    Joined:
    Mar 9, 2014
    Messages:
    166
    Likes Received:
    20
    I found at least one exception to all SAM3X pins coming up as input/high-impedance state by default, which instead gets forced hard-high (not just pulled up). This is "CANTX" over in the corner near the DACs and analog-ins, also known as "D69" when used as a plain Arduino GPIO, and gpio8 on the i.MX6 side. Maybe the standard Arduino library enables CAN bus I/O by default? This only happens when the SAM3X chip is actually running-- if it's held in reset (via echo 0 >/sys/class/gpio/gpio0/value, or shorting jumper J16) then CANTX/D69 remains high-impedance, while overall Udoo power consumption also drops by about 0.44W -- something to keep in mind if you don't need the SAM3X.

    Fortunately, it's easy to override this with a simple pinMode statement in the sketch setup() section. I explicitly set D68 (CANRX) as an input as well, just in case there's any weirdness with that one:

    Code:
      pinMode(68, INPUT);
      pinMode(69, INPUT);
    
     

Share This Page