reading and writing to multiple tags (ntag213) with pn7150

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

reading and writing to multiple tags (ntag213) with pn7150

938 Views
ziv1
Contributor I

Hello

 

I am working with the pn1750 nfc controller

 

 I am trying to read one tag and write to the other like in the duplicate example.

 

It does not work !

 

I can see that I read the tag's data (I change it), I do the ' NxpNci_ReaderReActivate(..) ' and then try to write and read the other tag but actually I right and read to the first tag that I read from. Maybe you know why?

 

Besides that, when I try to rewrite the wait for discovery notification function (cause I can't have a running real time code with all this while loops) then I see strange results right at the start maybe you can help:

 

(it could have been much easier to analyze it by myself if I knew what is the meaning of nfcc return values and what are all the necessary commands (in byte array values context) .

 

  1. in the example i am looking at there is a function ' NxpNci_StartDiscovery '

which creates a message  { 0x21, 0x03, 0x09, 0x04, 0x00, 0x01, 0x02, 0x01, 0x01, 0x01, 0x06, 0x01, 00000 }

what does that message mean, it does not start with 0x00, 0x00 like you wrote 

i can guess according to data sheet the 0x2 is the 001 MT of Control Packet - Command Message as a payload

and the 1 in the first 4 bits of the first byte is the GID, but what is GID = 1, what other values the GID has ? i could not find it in the data sheet 

same question about the second byte, i guess it is the OID , what are the possible values of the OID and what do they refer to ?

 

  1. what is the meaning or return message 0x60, 0x08, 0x02, 0x01, 0x00 

and if i want to read or write to a tag to i have to run start discovery before  (in my case tags will be inserted to microswitches so i have some validation that a tag is present ) ?

 

  1. what is the meaning of 0x61, 0x05, 0x17 (instead of 0x03 in the 3 byte)

 

  1. i have noticed that if i try to read to a buffer of 6 bytes and the pn7150 has more data for the DH then the IRQ pin is kept high, is there a way to know how much i need to read because it seems wasteful to keep a 255 byte buffer for every message even if i just except to read the 6 bytes of receive ACK  ?

 

  1. when i send to receive after read command then i get the 6 bytes of ACK and right after that i get 0xff, 0x00, 0x00, 0x11 (which is not what you wrote in your previous response) what does it mean and why does it return much more then the 4 bytes i requested to read ?

 

  1. one more things, after the i call for 'NxpNci_StartDiscovery(..)' i make a 'do-while' loop like in your example for multiple tags read/write, i sometimes get stuck in this loop because i only get responses starting with 0x60 instead of 0x61. if i am in debug mode and i make a breakpoint on the while then after sometimes one sometimes 10 times it gets the 0x61, why is that, also i watch the IRQ pin state, i don't understand how come it stays on also after i read the info from the card and how come when i get stuck if i don't put a breakpoint it stays low ???

I can not have such infinite loop in my program, how can i better do that with out looping waiting for the desired answer ??

 

  1. can i get an API with all public functions and some info about them, also a list of commands and return packets meaning  pls ?

 

  1. i try to work by the ' NxpNci_WaitForDiscoveryNotification()' but i can't be using all this while loops in my program, in this function there is this line:

while(Answer[AnswerSize-1] == 0x02) NxpNci_WaitForReception(Answer, sizeof(Answer), &AnswerSize, TIMEOUT_100MS);

what does it means ? do you not know a head how many messages the pn7150 has? i only have 2 tags, of the same ntag213 type, to read. 

does it work like waiting for some data from each tag in the area ? 

 

  1. beside all the above questions that needs to be answer please, when running the code from the example,

      after the NxpNci_WaitForDiscoveryNotification() return SUCCESS, 

      in the NxpNci_ReaderActivateNext(&RfInterface[1]) , i get the following response 

      00 00 00 00 00 00 04 00 41 04 01 00 ff 61 05 17 01 01 02 00 ff 01 0c 44 00 07 04 83 b8 aa 28 63 81 01 00 00 00 00 00 ff ff ff ...

      while, this is expected:

         /* First disconnect current tag */
         NxpNci_HostTransceive(NCIStopDiscovery, sizeof(NCIStopDiscovery), Answer, sizeof(Answer), &AnswerSize);
         if((Answer[0] != 0x41) && (Answer[1] != 0x06) && (Answer[3] != 0x00)) return NXPNCI_ERROR;
         NxpNci_WaitForReception(Answer, sizeof(Answer), &AnswerSize, TIMEOUT_100MS);
         if((Answer[0] != 0x61) && (Answer[1] != 0x06)) return NXPNCI_ERROR;

         in the last line i get NXPNCI_ERROR, and its the same message for both parts

 

 

best regards 

Ziv

0 Kudos
0 Replies