5 Replies Latest reply on May 30, 2017 4:52 PM by Intel Corporation

    In Need of Help With Edisons GPIO

    lewis-astbury

      Hi, the problem i seem to be stuck with is based around the edisons GPIO. I am currently using a code provided by Sensitronics for one of their products, this product being a MatrixArray Multi Touch Pad. The code supplied is easy downloaded and once the small circuit that is required has been built it simply uploaded with no modifications.

       

      My problem lies with converting this over to an edison, this code is made for an arduino uno but can be compiled and uploaded to an edsion no problem. For the MatrixArray to work it requires 5 consecutive I/O pins, on an arduino this is simple, it has a straight line of I/O pins from 0 - 13. To access the edisons I/O pins i am using a Sparkfun GPIO Breakout Board, which uses linux pin mapping and can be quite a challenge to get your head round.

       

      So my questions are, is it possible to access 5 consecutive pins on the edison? Has anyone had any experience with the same product? Can anyone help me on this?

       

      Thank you for your time, any knowledge would be helpfull and if the code or circuit diagram is required i can provide it.

       

      Lewis.

        • 1. Re: In Need of Help With Edisons GPIO
          SpiderKenny

          **EDIT** Correction

           

          Although the hardware setup and software examples on Sensitronics web site shows 5-consecutive GPIO pins, I'm not sure that they have to be consecutive.

          If I am looking at the right thing (here) then the code actually treats all 5-Pins as discrete pins, and I see nothing that treats them as a bus (consecutive pins).

           

          Therefore I think it should be a reasonably straighforward job to map the pins to any convenient Edison GPIO pins.

           

          If I am looking at the wrong code, then it may be a different story.

           

           

          ** CORRECTION ***

          I see in their shift code that they are using math on pins numbers!

          digitalWrite(PIN_MUX_INHIBIT_0 + current_enabled_mux, LOW);

           

          so I don't think this would work on Edison - but all you'd have to do is re-write that function to use logic rather than math to get the name of the next pin.

          Some thing like....

           

          if (current_enabled_mux == 0)

          {

              digital_write(PIN_MUX_INHIBIT_0, LOW);

          }

          else if (current_enabled_mux == 1)

          {

              digital_write(PIN_MUX_INHIBIT_1, LOW);
          }

           

          or even

           

          switch(current_enabled_mux)

          {

          case 0:

              digital_write(PIN_MUX_INHIBIT_0, LOW);

              break;

          case 1:

              digital_write(PIN_MUX_INHIBIT_0, LOW);

               break;

          default:

               break;

          }

          • 2. Re: In Need of Help With Edisons GPIO
            lewis-astbury

            Thankyou for your quick reply!

             

            So if i map the pins over from what they are on the arduino to what they relate to on the edison, they should work regardless of them not being consecutive?

             

            Yes that seems right to change them to logic, in your code you set them both to low? Would it not have to be set to high, then to low?

             

            Thans again.

            • 3. Re: In Need of Help With Edisons GPIO
              SpiderKenny

              As far as I can see, the only reason they need to be consecutive is so they can do the math on the pin numbers.

              If you change to using logic to select a pin then I don't see any reason why they should be consecutive.

               

              You may well be right about the high/low - I didn't examine the code too carefully, but it seems that you know what you are doing! :-)

               

              Good luck!

              • 4. Re: In Need of Help With Edisons GPIO
                lewis-astbury

                Hello again, i was wondering if you would be able to help me again, i managed to get the code working but i was meant with a constat stream of 0's in my serial monitor. After tracking everything back and running a few tests ive narrowed it down to one cable, A0.

                 

                I put an ossiliscope on the cable and i can see the analog readings being sent to the edison but nothing in the serial monitor, for testin purposes i opened up the analog read example and ran that with an arduino uno and it brought back results no problem. I ran the same code on the edison using GP44 which maps to A0 and i get 0's asif its not reading what is coming through.

                 

                do you have any advice or knowledge on this? does the edison need telling its an analog pin and not a GPIO?

                 

                Thanks again, lewis.

                • 5. Re: In Need of Help With Edisons GPIO
                  Intel Corporation
                  This message was posted on behalf of Intel Corporation

                  Hello lewis,

                  I tested the AnalogReadSerial example in the Intel Edison Kit for Arduino* since I don’t have access to the SparkFun Block for Intel® Edison – GPIO. I followed this basic guide http://www.intel.com/content/www/us/en/support/boards-and-kits/000006276.html and didn’t experience any issues. As you can check, an unmodified AnalogReadSerial is used, which means that there is no need to tell the Edison that A0 is an analog pin and not a GPIO.

                  I’m assuming the issue might be related to the GPIO block, have you check this link that discusses the recommended console communication block and how to use the GPIO Block as an input device: https://learn.sparkfun.com/tutorials/sparkfun-blocks-for-intel-edison---gpio-block?_ga=2.176152418.1738329009.1496171127-222343974.1481842962

                  Since I can’t reproduce the issue, I’ll recommend you to post your inquiry in SparkFun’s forum (https://forum.sparkfun.com/) or contact their technical support team (https://www.sparkfun.com/support). 

                  Have a nice day.

                  Regards,
                  Andres V.