PN7160 I2C library (ARDUINO)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PN7160 I2C library (ARDUINO)

Jump to solution
1,555 Views
LucasZDS
Contributor II

Hello everyone,

I'm new to programming RFID modules, and I'm currently working with the PN7160 module. I've been searching for information on how to communicate with this module via I2C, but I've found very little documentation and examples for Arduino or other microcontrollers.

My question is whether anyone knows of a specific library that is compatible with the PN7160 module and facilitates communication via I2C. If anyone has previous experience with this module or can provide some guidance on how to approach I2C communication with it, it would be greatly appreciated.

Additionally, I wonder if it's possible to use a library designed for the PN532 module instead of one specifically for the PN7160 since I've seen more resources available for the PN532. Has anyone tried this before?

I appreciate any advice, information, or resources you can provide. Thank you very much for your time and assistance!

Best regards, Lucas López.

Tags (4)
0 Kudos
Reply
1 Solution
1,454 Views
LucasZDS
Contributor II
Hello, good evening. @Ricardo_Zamora

I hope you are all doing well. I've been working on adapting the MCUExpresso system to my Microchip Studio project, and for the most part, things are going smoothly. However, I've reached a point where I'm encountering quite a few errors.

My main objective is to implement Mifare card reading using the I2C communication system I've set up. Unfortunately, I've been facing some challenges at this stage.

I plan to attach the code I'm currently using to provide more context. If anyone could offer me some assistance or guidance in this case, I would greatly appreciate it.

Thank you in advance!

View solution in original post

0 Kudos
Reply
7 Replies
1,451 Views
LucasZDS
Contributor II

Hello, good evening.

I hope you are all doing well. I've been diligently working on adapting the MCUExpresso system to my Microchip Studio project, and for the most part, things are going smoothly. However, I've encountered a particular issue that's been causing some headaches.

The problem centers around the #include "Nfc.h" directive within the Portable\RFID\NciNxp20.c file. It seems that this inclusion is triggering a cascade of errors that I can't seem to resolve.

Moreover, I've noticed that I'm getting a couple of linkage errors that are puzzling me. From what I can tell, the source files and libraries are correctly configured, so these errors shouldn't be occurring.

I plan to attach the relevant portions of the code I'm currently using to provide more context and hopefully identify the root of the issue. If anyone could offer me some assistance or guidance in this case, I would greatly appreciate it.

Thank you in advance for your help!

0 Kudos
Reply
1,460 Views
Ricardo_Zamora
NXP TechSupport
NXP TechSupport

Hello Lucas,

 

Hope you are doing well. You could check the NXP-NCI2.0 MCUXpresso examples guide.

There you can find the available MCUXpresso examples with different microcontrollers, and the NFC functionalities for these demos.

Hope this helps!

 

Regards,

Ricardo

0 Kudos
Reply
1,455 Views
LucasZDS
Contributor II
Hello, good evening. @Ricardo_Zamora

I hope you are all doing well. I've been working on adapting the MCUExpresso system to my Microchip Studio project, and for the most part, things are going smoothly. However, I've reached a point where I'm encountering quite a few errors.

My main objective is to implement Mifare card reading using the I2C communication system I've set up. Unfortunately, I've been facing some challenges at this stage.

I plan to attach the code I'm currently using to provide more context. If anyone could offer me some assistance or guidance in this case, I would greatly appreciate it.

Thank you in advance!
0 Kudos
Reply
1,446 Views
Ricardo_Zamora
NXP TechSupport
NXP TechSupport

Hello,

 

Porting to third party MCU is out of the scope of our technical support.

 

But, you could check this documentation, that might be helpful:

 

Regards,

Ricardo

0 Kudos
Reply
1,538 Views
ramprakash11
Contributor II

Based on the information provided, there doesn't seem to be a specific Arduino library for the PN7160 module. However, you can still communicate with the module via I2C by writing your own functions, as demonstrated in the code snippet you provided.

As for using a library designed for the PN532 module, it's important to note that while both modules are NFC controllers, they may have different register maps and command sets. Therefore, a library designed for the PN532 might not work correctly with the PN7160. It's recommended to refer to the PN7160's data sheet and application notes for detailed information on how to interface with the device.

Here is a simple example of how you might write to the PN7160 using I2C:

 void write_to_pn7160(unsigned char *buffer_write, unsigned char num_bytes){     unsigned char buffer_write_nfc [9] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};     // Your code here to write to the PN7160 } 

Remember to replace '// Your code here to write to the PN7160' with the actual I2C write function for your microcontroller.

0 Kudos
Reply
1,535 Views
LucasZDS
Contributor II
I am working on a project where I need to detect and communicate with MIFARE cards using the PN7160 module from NXP Semiconductor. After doing some research, I found a number of configuration values that need to be applied to the PN7160 to enable detection and communication with different NFC technologies, including MIFARE.

Here are the configuration values I plan to apply:
0x20, 0x02, 0x94, 0x11,
0xA0, 0x0D, 0x06, 0x04, 0x35, 0x90, 0x01, 0xF4, 0x01, /* RF_CLIF_CFG_INITIATOR CLIF_AGC_INPUT_REG */
0xA0, 0x0D, 0x06, 0x06, 0x30, 0x01, 0x90, 0x03, 0x00, /* RF_CLIF_CFG_TARGET CLIF_SIGPRO_ADCBCM_THRESHOLD_REG */
0xA0, 0x0D, 0x06, 0x06, 0x42, 0x02, 0x00, 0xFF, 0xFF, /* RF_CLIF_CFG_TARGET CLIF_ANA_TX_AMPLITUDE_REG */
0xA0, 0x0D, 0x06, 0x20, 0x42, 0x88, 0x00, 0xFF, 0xFF, /* RF_CLIF_CFG_TECHNO_I_TX15693 CLIF_ANA_TX_AMPLITUDE_REG */
0xA0, 0x0D, 0x04, 0x22, 0x44, 0x23, 0x00, /* RF_CLIF_CFG_TECHNO_I_RX15693 CLIF_ANA_RX_REG */
0xA0, 0x0D, 0x06, 0x22, 0x2D, 0x50, 0x34, 0x0C, 0x00, /* RF_CLIF_CFG_TECHNO_I_RX15693 CLIF_SIGPRO_RM_CONFIG1_REG */
0xA0, 0x0D, 0x06, 0x32, 0x42, 0xF8, 0x00, 0xFF, 0xFF, /* RF_CLIF_CFG_BR_106_I_TXA CLIF_ANA_TX_AMPLITUDE_REG */
0xA0, 0x0D, 0x06, 0x34, 0x2D, 0x24, 0x37, 0x0C, 0x00, /* RF_CLIF_CFG_BR_106_I_RXA_P CLIF_SIGPRO_RM_CONFIG1_REG */
0xA0, 0x0D, 0x06, 0x34, 0x33, 0x86, 0x80, 0x00, 0x70, /* RF_CLIF_CFG_BR_106_I_RXA_P CLIF_AGC_CONFIG0_REG */
0xA0, 0x0D, 0x04, 0x34, 0x44, 0x22, 0x00, /* RF_CLIF_CFG_BR_106_I_RXA_P CLIF_ANA_RX_REG */
0xA0, 0x0D, 0x06, 0x42, 0x2D, 0x15, 0x45, 0x0D, 0x00, /* RF_CLIF_CFG_BR_848_I_RXA CLIF_SIGPRO_RM_CONFIG1_REG */
0xA0, 0x0D, 0x04, 0x46, 0x44, 0x22, 0x00, /* RF_CLIF_CFG_BR_106_I_RXB CLIF_ANA_RX_REG */
0xA0, 0x0D, 0x06, 0x46, 0x2D, 0x05, 0x59, 0x0E, 0x00, /* RF_CLIF_CFG_BR_106_I_RXB CLIF_SIGPRO_RM_CONFIG1_REG */
0xA0, 0x0D, 0x06, 0x44, 0x42, 0x88, 0x00, 0xFF, 0xFF, /* RF_CLIF_CFG_BR_106_I_TXB CLIF_ANA_TX_AMPLITUDE_REG */
0xA0, 0x0D, 0x06, 0x56, 0x2D, 0x05, 0x9F, 0x0C, 0x00, /* RF_CLIF_CFG_BR_212_I_RXF_P CLIF_SIGPRO_RM_CONFIG1_REG */
0xA0, 0x0D, 0x06, 0x54, 0x42, 0x88, 0x00, 0xFF, 0xFF, /* RF_CLIF_CFG_BR_212_I_TXF CLIF_ANA_TX_AMPLITUDE_REG */
0xA0, 0x0D, 0x06, 0x0A, 0x33, 0x80, 0x86, 0x00, 0x70 /* RF_CLIF_CFG_I_ACTIVE CLIF_AGC_CONFIG0_REG */
My goal is to detect reading MIFARE cards and perform read-only operations on specific blocks of the card. Does anyone here have experience with configuring the PN7160 for MIFARE cards or can provide guidance on how to proceed after applying this configuration?
0 Kudos
Reply
1,523 Views
LucasZDS
Contributor II
Hello again!

I realized that I forgot to mention the XTAL configuration in my previous message. This configuration is important for the proper operation of the PN7160. Here are the XTAL configuration values that I plan to apply:

0x20, 0x02, 0x05, 0x01, /* CORE_SET_CONFIG_CMD */
0xA0, 0x03, 0x01, 0x08 /* CLOCK_SEL_CFG */

These configuration values are used to configure the clock source (XTAL) of the PN7160, which directly affects its performance.
0 Kudos
Reply