tinygo-org / drivers

TinyGo drivers for sensors, displays, wireless adaptors, and other devices that use I2C, SPI, GPIO, ADC, and UART interfaces.
https://tinygo.org
BSD 3-Clause "New" or "Revised" License
587 stars 180 forks source link

Support pn532 nfc module #586

Open Transmitt0r opened 12 months ago

Transmitt0r commented 12 months ago

Hey, I'm currently working on a new project where I'd love to use tinygo together with an pn532 module. I'd be happy to contribute a driver for the module myself! Just wanted to create an issue first per to Contribution.md :)

graugans commented 9 months ago

Hej, @Transmitt0r I do own an PN532 based module. Anything I can help you with?

graugans commented 9 months ago

I did some rough prototype based on the Adafruit Arduino code currently it only supports the I2C bus and only reading of the firmware version, card reading not yet implemented. I personally find the PN532 User Manual much more of a help than the datasheet linked above.

Is there a good reference for a driver supporting both I2C and SPI and UART?

In general, the check between different busses is similar to the Arduino code by checking if pointers are set, with no fancy interface tricks.

Transmitt0r commented 9 months ago

@graugans very cool, I was also using the adafruit Arduino code as reference but didn't get it working 😅

graugans commented 9 months ago

@graugans very cool, I was also using the adafruit Arduino code as reference but didn't get it working 😅

It looks like the Chip is quite picky about initialization. It requires kind of a Voodoo dance. It failed the last time I tried it. So it is time for the logic Analyzer. I will update the issue once I do know more.

graugans commented 8 months ago

Hej @Transmitt0r I now have a working implementation of a PN532 driver I have tested this on a cheap NFC Module V3 from Elechouse. The RST Pin they made available on the board is an output, this is why it did not work for me in the first place. This driver does not use all features for anyone who owns an Adafruit breakout board with the correct reset being available. On the other hand spending 50€ for the Adafruit board here in Germany is a bit too much for a just for fun project for now.