safe i.Mx6 GPIO out -> REQ. arduino all pins INPUT???

Discussion in 'General Discussion' started by PeterZ, Aug 24, 2014.

  1. PeterZ

    PeterZ New Member

    Joined:
    Aug 24, 2014
    Messages:
    7
    Likes Received:
    0
    An Arduino Pin on Output, stays on Output after Power Off/On. Right?

    So if I have a blinking output Pin 13 on Arduino (Sam3x), I can destroy it, by also doing GPIO ouput from i.mx6.
    Correct?

    Example:
    How to destroy pin 13:
    Arduino (Sam3x): blink on pin 13
    Code:
    int led13=13;
    
    void setup() {
        pinMode(led13, OUTPUT);
    }
    
    int state = 0;
    void loop() {
        state = !state; // toggle state
        digitalWrite(led13, state);
        delay(1000);
    }
    
    i.Mx6 (toggle same pin, but different delay...)
    Code:
    ## in a shell
    echo out > /sys/class/gpio/gpio40/direction
    while true; do
        echo 1 > /sys/class/gpio/gpio40/value
        sleep 3
        echo 0 > /sys/class/gpio/gpio40/value
        sleep 3
    done
    
    Is it true that this will severely mess up and destroy pin 13?

    So my actual question:
    If I really want to do GPIO from i.mx6, I have to load a "dummy" arduino sketch that ensures all pins on Input. Correct???
    Is there not a better way? Or any other way?

    "dummy" arduino sketch that ensures all pins Input.
    Code:
    void setup() {
        int i;
        for (i=0; i < 54; i++) {
            pinMode(i, INPUT);
        }
    }
    
    void loop() {
        delay(1000);
    }
    
    Will this work?

    Thanks for pointers and insight.
    P.
     
  2. peter247

    peter247 Member

    Joined:
    Mar 10, 2014
    Messages:
    263
    Likes Received:
    2
    If you cut the power the Sam side should go back to default .
    I`m 99.9% sure this is what happens !!!!

    1/ You power cycle !!!! .... REMOVE THE POWER .... and power again
    2/ The Sam runs the boot loader which set all gpios to their default state.
    3/ The Sam now runs the script which sets the pins via pinMode(led13, OUTPUT); etc
    I can`t see why not
     

Share This Page