Question about "NXP PN7160 example code"

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Question about "NXP PN7160 example code"

521 次查看
BruceChang
Contributor I

Hi . 

PN7160 NXP-NCI MCUXpresso Example Project (SW6705.zip)
The example code is one way to display message through UART port.
Example : main.c call nfc_example(); to display NFC TAG information.

---------------------------------------------------------------------------------------------------------------
I want to change it; Let User can typing command to read or write NFC TAG.

Is it have some method to reach the target ?

Thanks

0 项奖励
3 回复数

462 次查看
BruceChang
Contributor I
NDEF record received has bug :
 
My Tag has write data(1234567890)
The example code is always read data as below:
---------------------------------------------------------------------------
Running the NXP-NCI2.0 example.
WAITING FOR DEVICE DISCOVERY
 - POLL MODE: Remote T2T activated
SENS_RES = 0x44 0x0
NFCID = 04 70 1d a2 a5 70 80 
SEL_RES = 0x0
--- NDEF record received:
   Text record: 1234567
CARD REMOVED
WAITING FOR DEVICE DISCOVERY
---------------------------------------------------------------------------
The wrong code on here : 
nfc_example_RWandCE.c
void NdefPull_Cb(unsigned char *pNdefMessage, unsigned short ReceivedSize, unsigned int NdefMessageSize)
{
...
        case WELL_KNOWN_SIMPLE_TEXT:
            {
                save = NdefRecord.recordPayload[NdefRecord.recordPayloadSize];
                NdefRecord.recordPayload[NdefRecord.recordPayloadSize] = '\0';
                PRINTF("   Text record: %s\n", &NdefRecord.recordPayload[NdefRecord.recordPayload[0]+1]);
                NdefRecord.recordPayload[NdefRecord.recordPayloadSize] = save;
            }
            break;
...
}
 
When I print the data before and after, the '\0' is put wrong place. (38 ---> 00)
NdefRecord.recordPayload : 02 65 6e 31 32 33 34 35 36 37 38 39 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ...
   Text record: 1234567
NdefRecord.recordPayload : 02 65 6e 31 32 33 34 35 36 37 00 39 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ...
 
My modify code as below :
            int eol = NdefRecord.recordPayload[0]+1+NdefRecord.recordPayloadSize;
            save = NdefRecord.recordPayload[eol];
            NdefRecord.recordPayload[eol] = '\0';
            PRINTF("   Text record: %s\n", &NdefRecord.recordPayload[NdefRecord.recordPayload[0]+1]);
            NdefRecord.recordPayload[eol] = save;
 
The test result as below :
---------------------------------------------------------------------------
Running the NXP-NCI2.0 example.
WAITING FOR DEVICE DISCOVERY
 - POLL MODE: Remote T2T activated
SENS_RES = 0x44 0x0
NFCID = 04 70 1d a2 a5 70 80 
SEL_RES = 0x0
--- NDEF record received:
   Text record: 1234567890
CARD REMOVED
WAITING FOR DEVICE DISCOVERY
---------------------------------------------------------------------------
0 项奖励

508 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

In the SDK package, there is shell example, you can use it to communicate between PC and  the LPC so that the LPC can execute the instruction to read/write PN7160 which you send via shell and return the result to PC via uart.

But I suppose that the LPC55xx and i.mxrt117x have the shell example in SDK, it is easy for you to modify it to adapt your application. The low cost LPC82x does not have the shell example in SDK.

xiangjun_rong_0-1685090966160.png

Hope it can help you

BR

XiangJun Rong

0 项奖励

503 次查看
BruceChang
Contributor I

Unfortunately, we are use LPC82x....>_<

So, I need to check with LPC55xx and i.mxrt117x example in SDK and hope it is easy porting to LPC82x.

Thanks

0 项奖励