8 Replies Latest reply on Dec 23, 2014 2:42 PM by jblackston

    MRAA GPIO Error

    jblackston

      I'm having problems trying to communicate and open up a GPIO via MRAA library. I've updated the mraa library to version 0.5.4.46 as well as the upm to 0.1.8.78.

       

      g_gpio = mraa_gpio_init(46);     //GPIO46

       

      mraa_gpi_dir(g_gpio, MRAA_GRPIO_OUT);

       

      The issue is g_gpio returns 0, so the function always fails. Not sure exactly why. I'm able to open up a UART no problem so I know at the very least my mraa library is somewhat working correctly.

       

      Am I missing something?

        • 1. Re: MRAA GPIO Error
          CMata_Intel

          Hi jblackston

           

          About the GPIO_46, are you trying to access in to the Analog Input 2 (A2)? According to the Linux Pin Distribution?

          If that is the case you should use the aio_functions . Here are some examples for c,c++, python and javascript. Please let me know if this is what you were trying to do, if not, could you be more detailed in which of the Shield's pins at are you trying to access with the GPIO_46?

           

          Regards;

          CMata

          • 2. Re: MRAA GPIO Error
            KurtE

            quick questions.

            Mini breakout?  Arduino pin does not go up that high.

             

            when you specify 46 hot mraa this corresponds to connector pin j20-5 edison gp47.  Is this what you want?  Or did you want edison pin Gp46?  If so it is on mini board mraa pin 32.  would need to look up pin on arduino...

            • 3. Re: MRAA GPIO Error
              jblackston

              I want the Edison module pin GP46 not as a A/D just as a basic IO. I'm currently using the Adruino board, which has the GP46 exposed via a test pad, but this module will not be on the Adruino board in the end, so I just want the mraa library to access the GP46 (pin 28 on the 70-pin header) and other GP pins. When I call the function mraa_gpio_init() you are suppose to pass in the GP # you want to init correct?

              • 4. Re: MRAA GPIO Error
                KurtE

                no you pass in mraa PIN number, which on arduino breakout is I believe only in the range 0-19. 

                • 5. Re: MRAA GPIO Error
                  arfoll

                  If you really want that's what mraa_gpio_init_raw() is for. But you probably just want to ask for Gpio(16) which will give A2 as a gpio.

                  • 6. Re: MRAA GPIO Error
                    jblackston

                    Ok, so if I want to open up the actual pin on the Edison Module, ie GP46, I would call mraa_gpio_init_raw(46). Otherwise I would map what pin Adruino has it set, and in this case GP46 isn't mapped so I would have to use the raw function.

                    • 7. Re: MRAA GPIO Error
                      KurtE

                      Yes and No.

                       

                      That is if you look at the current documentation for the Arduino breakout board: https://communities.intel.com/servlet/JiveServlet/downloadBody/23161-102-8-27954/edison-arduino_HG_331191-005.pdf

                       

                      You will see: for example in Table 3, that GP46 is on IO pin 16 (A2), so you could simply pass in 16 to the mraa_gpio_init.

                       

                      arfoll can answer some of this better than I can, but without me actually trying it I am now sure how well opening up the RAW version would work on actual IO pins that are used as full logical pins.

                      That is, for example the mraa_gpio_init_raw(46) would not call the gpio_init_post function for the logical pin.  It also may not do all of the work, like clear the tristate object, set the mux values, and then reset the tristate object... Again not sure without actually trying it out.

                       

                      Kurt

                      • 8. Re: MRAA GPIO Error
                        jblackston

                        I called the function mraa_gpio_init() and this time I used the value 16 and it still came back with a 0. But when I call the function mraa_gpio_init_raw(46) and then check the GPIO 46 test point (tp26) it worked.