Open mikeygcooper opened 9 years ago
This is on my short list to implement.
Did you even get the chance to implement this? I tried using i2c yesterday with no luck. If not, can either of you point me in a direction where I can try debugging it? Maybe what functions are missing? It hangs after calling configureSecureAccessModule() (not sure if it was the original issue)
I haven't had a chance to look at this in a while but I just took a look and I think the issue not waking up the PN532 chip when using I2C
With serial, I send a Buffer of [0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
to wake up the PN532 from PowerDown. I saw this on page 99 of the PN532 User Guide page 99 as well as from Seeed-Studio's c++ library
It looks like for I2C (based on Seed-Studio's library) we need to wake up the PN532 just by starting a transmission, waiting 20ms, then stopping.
I currently don't have a I2C system setup (I could setup a BBB sometime) but if you want to take a look at it, the change should occur here. Currently the serial driver is setup to wakeup on the first command encountered, but it might be worthwhile to have an explicitly wakeup
in each HAL class that returns a Promise.
Thanks for the answer! I was looking into it a bit further. I2C works a bit different - first it is in passive mode. you have to constantly "poll" the information. wire.on("data") doesn't work as you expect it to be - it only works if you use the stream function. The write function also requires a callback as a second variable, so the current implementation actually throws an exception and ends the node process. The way to actually do it is to write the command and constantly poll one single byte, until this byte's first bit is 1. Then the board is ready to provide an answer. Found this info here - http://www.adafruit.com/datasheets/pn532um.pdf , along with some other very interesting information.
I am playing with the implementation at the moment, I think I will slowly extend the library to support i2c as well. I hope I will fine the time to finish this :-)
@RaananW The user manual from Adafruit is the same I have linked in the README and has all the definitive answers to the PN532. Keep me posted on your progress, sounds great :)
So I've only just got round to working on my project with this (original used UART but my card seems to have stopped working with that so now using I2C with the Raspberry Pi).
It seems that I2C support doesn't work at all, so am going to spend today investigating to see if I can get UART working again. If not I'll sit down and look at implementing the I2C support. (seems there are some missing methods on the wire object for I2C)