Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I2C Support not working #2

Open
mikeygcooper opened this issue Nov 28, 2014 · 5 comments
Open

I2C Support not working #2

mikeygcooper opened this issue Nov 28, 2014 · 5 comments

Comments

@mikeygcooper
Copy link

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)

@techniq
Copy link
Owner

techniq commented Jan 10, 2015

This is on my short list to implement.

@RaananW
Copy link

RaananW commented Aug 14, 2015

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)

@techniq
Copy link
Owner

techniq commented Aug 14, 2015

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.

@RaananW
Copy link

RaananW commented Aug 15, 2015

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

@techniq
Copy link
Owner

techniq commented Aug 16, 2015

@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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants