2

I'm using Libnfc 1.7.1 on a Raspberry PI. I'm connecting to a NXP PN532 chip via I2C and configured the connstring (pn532_i2c:/dev/i2c-1) in the Libnfc config file accordingly.
So far, everything is working completely fine. Since every single PN532 chip has the same I2C address (0x24), I want to use a I2C Multiplexer in order to attach two or more PN532 chips to the RPI I2C Bus.

Now I have to poll data from every single NFC reader. In order to do that, I need to specify the I2C address somewhere using Libnfc. How do I manage to specify the exact I2C device address to poll data from using Libnfc? I searched on the Internet and did not find any hints on how do to this.

If it is not possible, what alternatives do you see to accomplish this task?

Thanks in advance :)

EDIT:
I found out that The address is hardcoded in libnfc/drivers/pn532_i2c.c

//I2C address of the PN532 chip.  
#define PN532_I2C_ADDR 0x24
  • Doesn't the multiplexor create additional buses? You should end up with something like /dev/i2c-1, /dev/i2c-2, /dev/i2c-3 etc. You specify the bus to select the sensor. I'm not sure about this but I think this is what happens. – joan May 23 '16 at 17:13
  • I ordered a TCA9548A 1:8 Multiplexer. This one is connected to one I2C Bus of the RPI and presents 8 I2C slaves (0x70 thru 0x77). Unfortunately, no new buses are added. This would have solved my problem. – a.Dippel May 23 '16 at 17:30
  • I think that will work. If I understand correctly you select a channel and then the device connected to that channel will respond to requests on the address it is set to (0x24 in your case). – joan May 23 '16 at 17:51
0

That should work fine.

Finally, a way to get up to 8 same-address I2C devices hooked up to one microcontroller - this multiplexer acts as a gatekeeper, shuttling the commands to the selected set of I2C pins with your command.

Using the TCA9548A I2C Multiplexer is fairly straight-forward: the multiplexer itself is on I2C address 0x70 (but can be adjusted from 0x70 to 0x77) and you simply write a single byte with the desired multiplexed output number to that port, and bam - any future I2C packets will get sent to that port. In theory, you could have 8 of these multiplexers on each of 0x70-0x77 addresses in order to control 64 of the same-I2C-addressed-part.

Source https://www.coolcomponents.co.uk/tca9548a-i2c-multiplexer.html

  • I found out that the address is hardcoded. I'll try to change that and hard code the address of the MUX instead. Thanks for clarification on the functionality of the MUX. – a.Dippel May 23 '16 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.