7 Replies Latest reply on Oct 28, 2015 4:15 PM by CMata_Intel

    Latest xdk iot edition (2571) broke my ISR Grove button

    gwfong

      I'm very new to XDK, Edison, and hardware in general. But I know code. Any my once working code no longer works after last nights XDK upgrade to 2571. My very simple Grove button which I connected using Gpio() no longer receives events when connected via ISR. This is the first time going through and XDK update. My node libraries are up to date:


      mraa version: v0.8.0

      upm version: v0.4.0

       

      The built-in ISR template doesn't work, though that didn't work for me in the past. It appears the template has a bug. When fixed, it still doesn't work.

       

      My code has a stepper, lcd rgb, and a button. The button connected via ISR no longer receives the ISR event. I even started a brand new blank project and re-typed (cut-n-pasted) the code in and still it doesn't work.

       

      Here's my overly simplistic broken code:

       

      var mraa = require('mraa');

      //var LCD = require('jsupm_i2clcd');

      //var Grove = require('jsupm_grove');

      //var myLCD = new LCD.Jhd1313m1(0, 0x3E, 0x62);

      var gpio = new mraa.Gpio(4);

      function xxx() {

          console.log('xxx');

      }

      gpio.isr(mraa.EDGE_BOTH, xxx);

       

      Since this is my first XDK update, do I have to re-image the Edison? Should it just have worked after the update?

       

      Thanks

        • 1. Re: Latest xdk iot edition (2571) broke my ISR Grove button
          CMata_Intel

          Hi gwfong

           

          After upgrading the XDK, did you receive a message with a notification to upgrade the daemon in the board?

          Are you receiving an error message in the log when you upload and run the code? Or is it just that it’s not working as it should?

          Is the only thing that have happened the upgrade of the XDK?

           

          After the XDK update, you shouldn’t need to re-flash your board.

           

          Regards,

          Charlie

          • 2. Re: Latest xdk iot edition (2571) broke my ISR Grove button
            gwfong

            Hey Charlie,

             

            I did receive the message to upgrade the daemon, which I did. It didn't help.

             

            I don't get any kind of code or syntax error. When I run it, I do not get any runtime error. It's coded such that if the pin goes hi/lo, then my callback should be called and I get a console message. When I press my (grove) button, my function is not called because I never see my console message.

             

            The XDK upgrade was the only thing I did.

             

            BTW, I'm on a MacBook Pro (running 10.10.5). I have also been using my Ubuntu box which I *did not yet update* XDK. I'll give it a try on there when I get some time.

             

            Again, I didn't have any problems before the upgrade on my Mac. But now I do. I wonder if I have to reboot the Mac? Worth a shot, I guess.

             

            Since I posted this message I decided to re-flash. I used the Mac all-in-one tool that on the Intel downloads page. MRAA and UPM versions look good. The XDK is the same. But my simple code still doesn't work. Very odd.

            • 3. Re: Latest xdk iot edition (2571) broke my ISR Grove button
              CMata_Intel

              Hi gwfong ,

               

              Do you have updates in this? Have you been able to test this in your Ubuntu machine?

              Have you tried to run another example like the Blink example?

              Let’s try running:

              systemctl enable xdk-daemon
              systemctl restart xdk-daemon

              Also, in the XDK go to the Manage your daemon/IoT device icon  and select Sync PC time w/ clock on target board. Let me know if you get improvements after this.

               

              Regards,

              Charlie

              • 4. Re: Latest xdk iot edition (2571) broke my ISR Grove button
                gwfong

                Sorry. Been too busy. Now I'm back working on this.

                 

                Running XDK IOT 2170 on Ubuntu, I'm having the same problem. I synced the time and that didn't help. I noticed that the reason why the ISR callback isn't firing is because the node app is immediately exiting. I registered a callback for the process 'exit' event and it is fired immediately.

                 

                Maybe what was going on was that I had some code that was using some library that established a message pump loop and I didn't realize it? And then when I removed the code the app was exiting? The sample javascript ISR app doesn't include a setInterval() call or anything to keep node running. This is all conjecture since I don't really know what's going.

                 

                Gary

                • 5. Re: Latest xdk iot edition (2571) broke my ISR Grove button
                  CMata_Intel

                  Hi Gary,

                   

                  How are you connecting the button in your configuration?

                  I tested the same example with the 2571 version and had the same behavior.

                  Are you able to run the other templates successfully?

                   

                  Regards,

                  Charlie

                  • 6. Re: Latest xdk iot edition (2571) broke my ISR Grove button
                    gwfong

                    Hey Charlie,

                     

                    I have been able to successfully run other templates. I have even been able to run simple Johnny Five apps (very simplistic apps). My guess with all of these, however, is that there is a setInterval() or setTimeout() loop that's running. This keeps node from exiting. Again, with the basic Grove button example template there is no loop that keeps node running. And when I add a callback handler for the 'exit' event, it is called. It would seems reasonable to conclude that the reason the ISR callback isn't getting called is because node exited before I got a chance to push the button.

                     

                    Does that seem reasonable to you (or to anyone else reading this post)?

                     

                    Gary

                    • 7. Re: Latest xdk iot edition (2571) broke my ISR Grove button
                      CMata_Intel

                      Hi Gary,

                       

                      I think you are right, the code doesn’t use a loop so I suggest you to change your code, you can do something like the Blink example with the periodicActivity() function.

                       

                      Regards,

                      Charlie