4 Replies Latest reply on May 6, 2015 1:37 PM by DiegoV_Intel

    Setting pins high with Arduino development board

    brandor

      Hi,

       

      Edison noob trying to do something very basic: Set a pin high according to serial input.  I've chosen to use a combination of arduino and python for the task as I'm more familiar with them, but not picky about implementation.  So here's the problem:

      I've successfully uploaded and run 'blink' and everything looks good: nice little blinking on-board LED and on a multimeter I see pin 13 goes high on a 1 sec interval.  (I have both microUSB interfaces connected to my machine.)  If I do something only slightly different, I find that I can always turn the on-board LED on and off, but that doesn't always correspond to pin 13 reading high (close to 5 V). In other words, the on-board LED will blink, but the output of pin 13 remains unchanged.  Furthermore, it seems to depend on what combination of usbmodem/serial connections I have, how many resets I've performed, etc.  I expect there is something fundamental that I don't understand here.  Thanks in advance for any help -

       

      Here's the code:

      int led = 13;
      int state = 0;
      
      void setup() {
       pinMode(led,OUTPUT);
       Serial.begin(9600);
      }
      
      
      void loop () {
        state = Serial.read();
        delay(100);
        if (state == '1' ) {
          digitalWrite(led,HIGH);
        }
        if (state == '0' ) {
          digitalWrite(led,LOW);
        }
      }
      
        • 1. Re: Setting pins high with Arduino development board
          DiegoV_Intel

          Hi brandor,

           

          I have tested your code and the blink example too. At the beginning I didn't have any problems. The onboard LED was blinking and the IO13 was changing too. Check the picture below.

          Onboard LED test1.JPG

          Then I rebooted the board with the reset button SW1U15 and ran again the sketch but this time the onboard LED was blinking but the IO13 wasn't changing as it should have. See the picture below.

          Onboard LED test2.JPG

          I had to power off the board. When I powered it on again and uploaded the sketch everything worked fine. So this time I ran the command "reboot" in the Linux terminal to reboot the board instead of using the reset button and this time the LED and the IO13 were working as they should. So the issue happens when you use the button SW1U15 to reboot the board.

           

          I checked the Hardware Guide of the Arduino Expansion Board (http://download.intel.com/support/edison/sb/edisonarduino_hg_331191007.pdf) and I found the description of the SW1U15 button. It says the following:

          System reset. Pressing the system reset button (SW1UI5) will reset the Intel® Edison compute module, and

          reset the I/O expanders, setting all the shield pins to high impedance state with no pullups.

          So according to that description this behavior on the IO13 is expected to happen. But, why is the LED still blinking? I checked the Arduino Expansion Board schematic (http://download.intel.com/support/edison/sb/edison_arduino_hvm_8_26.pdf) and I found that the LED is not connected directly to the IO13. There is an IC between them, the 74LVC1T45. This IC is enabled by the PCAL9555 IC which is the IO expander that is reset when the button is pressed. The IO13 is connected to the 74LVC1T45 and since it is not enabled after the reset, the IO13 is in high impedance but the LED is connected before that IC where the signal is still toggling. That is why the LED blinks but the IO13 doesn't change.

           

          I hope this information has answered your question.

           

          Regards,

          Diego.

          • 2. Re: Setting pins high with Arduino development board
            brandor

            Hi Diego,

             

            This was hugely helpful.  Thanks for taking the time to sort it out! 

            • 3. Re: Setting pins high with Arduino development board
              ruben_vleuten

              Hi Diego,

               

              I'm running into the same problems after I press the Reset (SW1U15) button none of the IO pins is working anymore. Is there a way to get them running again without unplugging the system. I'm using the arduino IDE.

               

              Cheers,

               

              R.

              • 4. Re: Setting pins high with Arduino development board
                DiegoV_Intel

                Hi ruben_vleuten,

                 

                The reset button will set all the shield pins to high impedance state (I posted a more complete explanation above). You can use the "reboot" command instead. This command will reboot the Edison without setting the pins to high impedance.

                 

                Regards,

                Diego.