8 Replies Latest reply on Apr 15, 2016 5:34 PM by CMata_Intel

    Problem with PN532 example

    Gregory@smartnotify

      Hello,

      After doing a "fresh" install of Edison and adding the PN532 lib on node, we run:

      https://software.intel.com/en-us/iot/hardware/sensors/pn532-nfc

      Straight cut and paste of the code.

       

      Yet we keep getting this error:

      ERROR: var myNFCObj = pn532.PN532(3,2);                                                                                                                               

                  ERROR:          ^                                                                                                                                         

      ERROR: Error: Illegal arguments for construction of _exports_PN532                                                                                                    

          at Object.<anonymous> (/home/root/.node_app_slot/main.js:33:22)                                                                                                   

          at Module._compile (module.js:456:26)                                                                                                                             

          at Object.Module._extensions..js (module.js:474:10)                                                                                                               

          at Module.load (module.js:356:32)                                                                                                                                 

          at Function.Module._load (module.js:312:12)                                                                                                                       

          at Function.Module.runMain (module.js:497:10)                                                                                                                     

          at startup (node.js:119:16)                                                                                                                                       

          at node.js:935:3

       

       

      Looking at the doc here;  PN532  the declaration seems to take 4 variables (as opposed to the 2 in the examples) but toying around different settings does not help.


      Any suggestions?


      Thank you!
      Gregory

        • 1. Re: Problem with PN532 example
          CMata_Intel

          Hi Gregory,

           

          I would like to know more information regarding the configuration you are using:

          Which UPM and MRAA library versions are you using? Be sure that you are using the latest one, for this I suggest you to run the following commands:

          echo "src mraa-upm http://iotdk.intel.com/repos/3.0/intelgalactic-dev/opkg/i586" > /etc/opkg/mraa-upm.conf
          opkg update
          opkg install mraa
          opkg install upm
          

          Which image are you using (run configure_edison --version)?

          It seems that you are using the XDK, are you using the 2571 version?

          Do you have the PN532 NFC/RFID connected to your board?

           

          Regards,

          Charlie

          • 2. Re: Problem with PN532 example
            Gregory@smartnotify

            Hi Charlie,

            Thanks for the ideas. There is some progress thanks to you :-)
            We had an older lib referenced; I checked and some of the older documentation point to an older version of the intelgalactic.

            It still gives the same error.
            Interesting enough if we do this:  var myNFCObj = new pn532.PN532(0,0,1);  then we get a "new" error:

             

            var vers = myNFCObj.getFirmwareVersion();                                                                                                                             

                                ^                                                                                                                                                 

            ERROR: Error: UPM Runtime Error: writeCommand: mraa_i2c_write() failed                                                                                                

                at Object.<anonymous> (/home/root/.node_app_slot/main.js:57:21)                                                                                                   

                at Module._compile (module.js:456:26)                                                                                                                             

                at Object.Module._extensions..js (module.js:474:10)                                                                                                               

                at Module.load (module.js:356:32)                                                                                                                                 

                at Function.Module._load (module.js:312:12)                                                                                                                       

                at Function.Module.runMain (module.js:497:10)                                                                                                                     

                at startup (node.js:119:16)                                                                                                                                       

                at node.js:935:3   

             

             

            Which at this stage leads me to think that we need to figure out the proper init I2C bus for IRQ and reset.


            We have the xadow wearable NFC hooked on one board but also have another NFC reader that hooks to a regular grove extension board so we can try different setups.

             

             

            Our version of edison:  159.devkit

            • 3. Re: Problem with PN532 example
              CMata_Intel

              Hi Gregory,

               

              Do you have the card connected to the board? I don’t have the card you are using to test this but I’m having the same error message.

              The problem could be that the board sends a signal but the card is not returning correctly the ACK signal. I suggest you to check the connection you are using.

              Are you using the Arduino Expansion Board or the Breakout Board? If you are using the latter you must know that the pins in this board has a maximum voltage of 1.8V. Have you tried to read the signals with a logic analyzer or oscilloscope?

               

              Regards,

              Charlie

              • 4. Re: Problem with PN532 example
                Gregory@smartnotify

                Chris,
                Testing on 2 different setups:

                The Edison + Grove board (attaching a picture here as I don't have the specific specs. Note that it's not the actual sensor attached to the board!)  and this kit: http://www.seeedstudio.com/wiki/Xadow_Wearable_Kit_For_Edison

                Same error message in either case. I'm pretty sure it comes down to referencing the right input/output/ground...but I can't find any info anywhere on what the right values should be.

                So I'll take all ideas and infos at this stage to make it work


                Gregory

                2016324112002.jpg

                • 5. Re: Problem with PN532 example
                  CMata_Intel

                  Hi Gregory,

                   

                  I suggest you to measure the VCC and GND on the lines of the sensor. Also, check the SDA and SCL signals. With this you could detect where the problem is, if it is related to the power for VCC or if it related to the signals in the sensor.

                  If you are using the latest UPM and MRAA versions, there shouldn’t be problems while using the example.[i586/]

                  You can also try with the example for C++, there could be some improvements if the problem is the code and not the configuration.

                  upm/pn532.cxx at master · intel-iot-devkit/upm · GitHub

                   

                  Regards,

                  Charlie

                  • 6. Re: Problem with PN532 example
                    Gregory@smartnotify

                    Charlie,

                    Upm and Mraa are up-to-date but still was running into the problems described above.

                    Then I ran i2cdetect -y -r 6

                    And got the results attached here.  Could you, or something from the community help me figure out if those map to:

                    // Instantiate an PN532 on I2C bus 0 (default) using gpio 3 for the

                    // IRQ, and gpio 2 for the reset pin.

                    var myNFCObj = new pn532.PN532(3, 2);

                     

                    Something tells me it's pointing to pins other than the ones in the example but my knowledge of i2c does not run that deep!

                     

                    Thank you

                    Gregory

                    • 7. Re: Problem with PN532 example
                      CMata_Intel

                      Hi Gregory,

                       

                      You can try by using external pull up resistors in the SCL and SDA signals. I highly suggest you to check these signals with an oscilloscope or logic analyzer in order to see the behavior of them.

                      Have you tried with the examples for the Arduino IDE that appears on http://www.seeedstudio.com/wiki/Xadow_Wearable_Kit_For_Edison?

                       

                      Regards,

                      Charlie

                      • 8. Re: Problem with PN532 example
                        CMata_Intel

                        Hi Gregory,

                         

                        Have you been able to work on this and check the signals for SDA and SCL?

                         

                        Regards,

                        Charlie