pn532 discussion

Active today
Viewed 6 times

At first im only using 1 NFC PN532 and libnfc as the library, but when im trying to connect it to 2 same devices, it still gives the same address which is 0x24(because of libnfc). Since controlling it need unique address, i tried to find a way to change it. And i come to final answer which it is fixed address(hard code in the chip), to solve it i can only use raspberry gpio as additional bus but it only make the device connected to it limited. So i use another option that is to use I2C expander/multiplexer, the mux i use is TCA9548A. But now im wondering how to do this, any advice what should i do and how to do it? And when using i2cdetect it only detects mux address, is it normal?

 New contributor
  • Hi @Wesly, Welcome and nice to meet you. Ah let me see. Yes, you can use TCA9548A. to MUX multiple I2C devices with the same device address 0x24 in your case. Another workaround is to use multiple I2C buses. For Rpi4B buster, you can use multiple I2C buses, each bus handling one PN532. Let me think harder and see if there are more workarounds. Cheers. – tlfong01 1 hour ago
  • So I read my old post to refresh my memory: (1) Problem with detecting badge with PN532 and Raspberry Pi – tlfong01 StackOverflow 2020mar23 stackoverflow.com/questions/60819793/…. Now I remeber that PN532 can do all I2C, SPI, and UART. Let me read my other old post on using SPI. See you later. – tlfong01 59 mins ago
  • 1
    yeah i know another way is to use raspi GPIO as additional bus but that will only restrict it to fewer device connected. – Wesly 58 mins ago
  • Yes, I agree, use multiple I2C buses consumes GPIOs. In my above answer (Appendix F) I showed how to use DT overlays to make multiple I2C buses and also multiple SPI and UARTs. If you use SPI, then you can use GPIO expander, say MCP23x17 to get 16 GPIO pins, each of which can be a SPI CSn, In other words, you can have 16 SPI connected PN532s without wasting any Rpi GPIO. Let me read my other old post and come back to you later. Ah a bit late for my locking down supper. See you later. – tlfong01 53 mins ago
  • 1
    ok thx for helping, im still trying to find how to combine pn532 with mux. – Wesly 47 mins ago
  • So I read my other StackOverflow answer to refresh my memory. Now I remember that libnfc1.7.1 is actually very good, I just modify the config file and switch from I2C mode to SPI mode in a couple of minutes. (2) “How can Rpi read a PN532 NFC Module? – tlfong01 stackOverflow 2020apr12 Viewed 108 times”: stackoverflow.com/questions/61165652/…. Cheers. – tlfong01 47 mins ago
  • You are welcome. Before I forgot, I found WaveShare has a good demo program to use UART to talk to PN532. Ah I forgot that my other trick is to use TSX010x to level shift 3V3 to 5V0 I2C signals. TSX010x has an enable pin, so you can use this pin to do your own MUX. Anyway, TCA9548A is worth trying, Good luck and cheers. – tlfong01 40 mins ago

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: