Community
cancel
Showing results for 
Search instead for 
Did you mean: 
GMenv1
Innovator
1,405 Views

Problem with PN532 example

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 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. (/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; http://iotdk.intel.com/docs/master/upm/node/classes/pn532.html 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
8 Replies
Carlos_M_Intel
Employee
182 Views

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 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

GMenv1
Innovator
182 Views

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. (/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

Carlos_M_Intel
Employee
182 Views

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

GMenv1
Innovator
182 Views

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 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

Carlos_M_Intel
Employee
182 Views

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.[http://iotdk.intel.com/repos/3.0/intelgalactic/opkg/i586/ 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.

https://github.com/intel-iot-devkit/upm/blob/master/examples/c%2B%2B/pn532.cxx upm/pn532.cxx at master · intel-iot-devkit/upm · GitHub

Regards,

Charlie

GMenv1
Innovator
182 Views

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

Carlos_M_Intel
Employee
182 Views

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 http://www.seeedstudio.com/wiki/Xadow_Wearable_Kit_For_Edison?

Regards,

Charlie

Carlos_M_Intel
Employee
182 Views

Hi Gregory,

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

Regards,

Charlie

Reply