14 Replies Latest reply on Oct 6, 2016 2:41 PM by Intel Corporation

    Edison GPIO issue

    Pawek

      Hello,

      I have problem. Beforem my vacation everything works fine, but now it suddenly doesnt. The Edison "works" all that week.

      When I run this code:

      #include <stdio.h>
      #include <string.h>
      #include <unistd.h>
      #include <sys/types.h>
      #include <stdlib.h>
      #include "mraa.h"
      
      
      #define GPIO_BUTTON_PIN 2
      #define GPIO_BUZZER_PIN 5
      #define GPIO_TOUCH_PIN 3
      #define GPIO_RED_LED_PIN 4
      #define GPIO_BLUE_LED_PIN 7
      
      
      mraa_gpio_context button,
         buzzer,
         touch,
         led_red,
         led_blue;
      int main(void)
      {
        /*Initialize mraa libraries*/
        mraa_init();
        buzzer = mraa_gpio_init(GPIO_BUZZER_PIN);
        button = mraa_gpio_init(GPIO_BUTTON_PIN);
        touch = mraa_gpio_init(GPIO_TOUCH_PIN);
        led_red = mraa_gpio_init(GPIO_RED_LED_PIN);
        led_blue = mraa_gpio_init(GPIO_BLUE_LED_PIN);
      
      
        mraa_gpio_mode(button, MRAA_GPIO_STRONG);
        mraa_gpio_dir(button, MRAA_GPIO_IN);
      
      
        mraa_gpio_mode(buzzer, MRAA_GPIO_STRONG);
        mraa_gpio_dir(buzzer, MRAA_GPIO_OUT);
      
      
        mraa_gpio_mode(led_red, MRAA_GPIO_STRONG);
        mraa_gpio_dir(led_red, MRAA_GPIO_OUT);
      
      
        mraa_gpio_mode(led_blue, MRAA_GPIO_STRONG);
        mraa_gpio_dir(led_blue, MRAA_GPIO_OUT);
      
      
        mraa_gpio_mode(touch, MRAA_GPIO_STRONG);
        mraa_gpio_dir(touch, MRAA_GPIO_IN);
      
      
        printf("%d\n%d\n%d\n%d\n%d\n",buzzer,button,
         led_red,touch,
         led_blue);
        while(1)
        {
        }
      
      
        return 0;
      }
      

      I get that logs:

      489.PNG

      From what I know 0 stands for "uninitialized". I had similar issue before and it turned out that no all sensors where conected properly to the board.

      Now I double checked that.  I use Arduino ex. board and Grove Starter Kit.

       

      What is wrong? Is there any possibility that when I was away GPIOs broke?

       

      Thanks for support

        • 1. Re: Edison GPIO issue
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi Pawek,

           

          That's a weird problem, I tested your code and it worked perfectly, take a look at this photo:

           

          GPIO issue.PNG

           

          As you see in the photo, when I ran it the values are fine (Non-Zero). Can you provide me more information that can help me to found the issue? Information like the Image version that you're using, MRAA library version, have you installed something after your code was working? Any information that you think that can be useful.

           

          I'll be waiting for your information to help you.

           

          Regards,
          -Leonardo

          • 2. Re: Edison GPIO issue
            Intel Corporation
            This message was posted on behalf of Intel Corporation

            Hi Pawek,

            Can you send me the information that I asked you? Any information can be helpful.

            Remember that we are here to help you.

            Regards,
            -Leonardo

            • 3. Re: Edison GPIO issue
              Pawek

              Hi,

              Sorry I got another task, so Edison have to wait.

               

              Any usefull information I can recall is that I had to flash firmware. Your GUI setup doesnt work it still shows that I have old image, but it was the newest. Instaler fails and fails so i decided to do it manually. About third approach it finally succcessed. I also was able to configure WiFi and SSH, but from there Edisons' gpios seems to be dead.

              Linux works flawless. Even configuring them from shell layer doesnt work (but here is probability that I made mistake, because of numerations (you know gpioX <- what x is proper)).

              I used this: https://theiotlearninginitiative.gitbooks.io/inteledison/content/documentation/Arduino_pin_mux_and_pin_mode_settings.png

               

               

              asd.PNG

               

              Well if you ask about Edison I have installed nothing, on my PC some non- programming related softwere like Spotify. No drivers was installed since then.

               

              Thanks!

              Pawel

              • 4. Re: Edison GPIO issue
                Intel Corporation
                This message was posted on behalf of Intel Corporation

                Hi Pawel,

                 

                Looks like you're having problem flashing the Edison with the latest image and maybe this can be the problem, I tested your code again and it works, so I recommend you to try to follow the steps that I'm going to give you to flash your Edison and run the code just like I did and see if you have the same results and to make sure if it is a problem with the GPIOs.

                 

                1. Flash your Edison with the Flashall Script guide. (Download the latest image here: https://software.intel.com/en-us/iot/hardware/edison/downloads).

                 

                2. Run the configure_edison --setup command to configure WiFi and SSH.

                 

                3. Install the latest MRAA library using opkg with the following commands:
                echo "src mraa-upm http://iotdk.intel.com/repos/3.5/intelgalactic/opkg/i586" > /etc/opkg/mraa-upm.conf
                opkg update
                opkg install mraa

                 

                4. Copy the code on your Edison (In your case I used cat << EOF >> GPtest.c command and I copied your code and at the end I wrote EOF).

                 

                5. Finally compile the code and run it. Take a look at the image:

                GPtest.PNG

                I'll be waiting for your results, if you have issues with any step don't doubt to ask us.

                 

                Regards,
                -Leonardo

                • 5. Re: Edison GPIO issue
                  Intel Corporation
                  This message was posted on behalf of Intel Corporation

                  Hi Pawel,

                  Did you follow the steps that I gave you? Did you test the code?

                  If you still have issues just let me know.

                  Regards,
                  -Leonardo

                  • 6. Re: Edison GPIO issue
                    Pawek

                    Hi,

                    After folowing your instructions I get another issue,

                    This is how looks my serial connection to Edison board.

                    dfgdgfdg.PNG

                    I also cannot connect to my WiFi network. In device menager I have got yellow exclamation mark near RNDIS driver.

                     

                    Im unable to test the code, because i cant connect to board. Even in Eclipse it doesnt work at all.

                     

                    Best,

                    Pawel

                     

                    I am also unable to start SSH connection:

                    54.PNG

                    PS2

                    Ok, I menaged it. But still im unable to put my code on Edison. Pinging IP adress, that Edison have ended up with Request timeout. Eclipse cant connect as well.

                    • 7. Re: Edison GPIO issue
                      Intel Corporation
                      This message was posted on behalf of Intel Corporation

                      Hi Pawel,

                      That's weird, why don't you try the steps again? But in this time open the serial terminal before you start it (PuTTY), you will see the flashing process there. If you still have the same error send us the screenshot of the error.

                      If you successfully flash the image do all the remaining steps that I gave you using the serial terminal. Look on my last reply that I did all these step in the Linux interface, so please try to do them just like I told you without using the Edison Board Configuration Tool.

                      If you still need help, just let us know.

                      Regards,
                      Leonardo

                      • 8. Re: Edison GPIO issue
                        Pawek

                        Hi,

                        I followed your procedure, but when I try to conenct to serial port I get this error:

                        1.PNG

                        I tried to run it couple of times. But still this error occures.

                        Flashing procedure using terminal succeded. But im unable to run this configure_edison comand, because I cant execute it anywhere. Serial doesnt work and I cant configure ssh over ssh becasue ssh isnt configured.

                        This is reason why i used your GUI configurator.

                         

                        After another flashing serial opens, but it is offline and doesnt send or recive data.

                        3.PNG

                         

                        Pawel

                         

                        I gave it a try on cooworker computer with linux. Here some logs:

                        -----edison.log--- ########################################################## - Pastebin.com

                         

                        Still doesnt work on windows.

                         

                         

                        Edit:

                        Ok, I menaged it too. But now, configure_edison throws that errors when i try to edit anything:

                        Configure Edison: WiFi Connection

                         

                         

                        Scanning: 1 seconds left

                         

                         

                        Traceback (most recent call last):

                          File "/usr/bin/configure_edison", line 1219, in <module>

                            main()

                          File "/usr/bin/configure_edison", line 1098, in main

                            connectNetwork()

                          File "/usr/bin/configure_edison", line 528, in connectNetwork

                            (ssid_keys, network_map) = scanForNetworks()

                          File "/usr/bin/configure_edison", line 339, in scanForNetworks

                            network_file = open(STATE_DIR + "/networks.txt", "w")

                        IOError: [Errno 30] Read-only file system: '/var/lib/edison_config_tools/networks.txt'

                        root@Edison:~#

                         

                        And when i type configure_edison --version i get "none"

                         

                         

                        ----Another Edit:

                         

                        I flashed it from my virtual machine linux again and I was able to go through configure_edison --setup. But it isnt possible to connect to board via ssh.

                         

                         

                        Rest of your steps finish up with this:

                        Serial issues: (sudo screen /dev/ttyUSB0 115200 )

                        454.PNG

                        It loops forever. Even ctrl+c doesnt work:

                        46546464.PNG

                         

                         

                         

                         

                         

                         

                        ---------------New info:

                         

                        456.PNG

                        Summarizing:

                        Now im unable to connect via SSH to my Edison. I want to flash my program on it using fillezilla but around 81% it loses connection and fails. As you can see I have big ping value and 75% of data loss. Ping on edison does nothing. Just freez until ctrl c. This Edison lay on my desk and Im using local network to access it. I try with 3 diffrent acces points, nothing changes. GPtest loops as well.

                         

                        I flash edison many times. Sometimes it fails, some times I get that strange serial issue form above, sometimes im unable to flash it because of

                        C:\Users\pzydziak\Desktop\Edison>flashall.bat

                        Using U-boot target: edison-blankrndis

                        Now waiting for dfu device 8087:0a99

                        Please plug and reboot the board

                        Device has DFU interface, but has no DFU functional descriptor

                        Cannot open DFU device 8087:0a99

                        Device has DFU interface, but has no DFU functional descriptor

                        Cannot open DFU device 8087:0a99

                        Device has DFU interface, but has no DFU functional descriptor

                        Cannot open DFU device 8087:0a99

                        error. To get rid of it I have to reset edison many times and rerun script many times as well and then magicly it start to work. Configure_edison works also not everytime.

                        If I would be able to connect via ssh from eclipse or drop it in Filezilla and run via commad line on my virtual machine I will be happy. Or you can provide me any way to put my binary on edison without ssh.

                         

                        Thanks.

                         

                         

                         

                        PS.

                        My PM ask my to ask you. Is there any possibility to change this board for another Edison? Or send it to you for futher investigation?

                        • 9. Re: Edison GPIO issue
                          Intel Corporation
                          This message was posted on behalf of Intel Corporation

                          Hi Pawel,

                          Those problems that you are getting are very weird, and yes we can help you with a further investigation of this case, so I personally recommend you to submit a service ticket in the following form: https://customercare.intel.com/?lang=en-US

                          Once you submit the service ticket we are going to help you in a closer way.

                          Have a nice day.

                          Regards,
                          -Leonardo

                          • 10. Re: Edison GPIO issue
                            Intel Corporation
                            This message was posted on behalf of Intel Corporation

                            Hi Pawel,

                            I was wondering if you have had a chance to submit the service ticket.

                            Let us know when you did it.

                            Regards,
                            -Leonardo

                            • 11. Re: Edison GPIO issue
                              Pawek

                              Ok, I figured it out. Now it works, but to be honest I have no idea why. It was wierd problem. Now gpios and everything, except transfer files via FileZilla or running app form eclipse, seems to works flawless.

                               

                              By the way. Do you know when Edison gets IP Adress?

                              I have created .service file, because I found on the net hat rc.local doesnt exist on Edison:

                               

                              [Unit]

                              Description= Agent  Service

                              After=xdk-daemon.service

                              Requires=xdk-daemon.service network.service network-online.target

                               

                              [Service]

                              ExecStart=/home/root/agent/app

                               

                              [Install]

                              WantedBy=multi-user.target

                               

                              But after reboot Edison it reports this garbage:

                              1.PNG

                              Here prof that my app is running:

                              2.PNG

                              When I run it manualy after login works fine:

                              3.PNG

                              I have to have my app in autostart.

                               

                              Thanks for patience and support. I really appreciate it.

                               

                              Paweł

                              • 12. Re: Edison GPIO issue
                                Intel Corporation
                                This message was posted on behalf of Intel Corporation

                                Hi Pawel,

                                Wow that's weird, at least it works. About your new issue, try to modify .service file adding the following line:

                                [Service]
                                ExecStart=/home/root/agent/app
                                Type=idle

                                The line Type=idle will delay execution of the service until all the jobs finish (Check it here: https://wiki.archlinux.org/index.php/systemd.) 

                                I hope this works for you.

                                Have a nice day.

                                Regards,
                                -Leonardo

                                • 13. Re: Edison GPIO issue
                                  Pawek

                                  It doenst but I think I can handle it.

                                   

                                  Thanks a lot.

                                   

                                  Best,

                                  Paweł

                                  • 14. Re: Edison GPIO issue
                                    Intel Corporation
                                    This message was posted on behalf of Intel Corporation

                                    Hi Pawel,

                                    Thank you for letting us know, try to keep us updated on this.

                                    Remember that we are here to help, just contact us.

                                    Have a nice day.

                                    Regards, 
                                    -Leonardo