Interrupt handling of Library software

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

Interrupt handling of Library software

959 Views
smiwa
Contributor III

Hi Christian san,

Very sorry to ask too basic question to you but please let me know.how to receive the data form PN5180?

Library software is too sophisticated for me to fully understand by myself. I think the command/data is sent by using some kinds of Read(Write)Registe function such as instr_Read(Write)Register, Rad(Write)RegisterAndMask, etc which call LpcOpenSpi_Exchange function.

My question is;

(1) It looks there are two methods to get data:One is using  phhalHw_Pn5180_Transmit/phhalHw_Pn5180_Receive and another is using phhalHw_Exchange. What is the difference between them and what function do they have?

(2) When receiving the data from PN5180, I think, IRQ is used. But I cannot find where the INT is detected and handler is executed in Library software coding. Could you tell me the mechanism to get the data from INT detection to putting them to buffer?

Very sorry to ask complicated questions every time and thank you for your supports!

Best regards,

   S. Miwa

2 Replies

748 Views
smiwa
Contributor III

Hi Christian san,

Thank you for answering every time and you are very smart to explain.

For this matter, I fully understood!

Thanks again!

Best regards,

   S. Miwa

0 Kudos
Reply

748 Views
christianeisend
NXP Employee
NXP Employee

HI,

first, apologize my delayed response to that question, I didn't see it sooner.

ad 1) You are right: There are two data exchange APIs: phhalHw_Exchange is the fully synchronous send/receive API. So it sends our a frame and waits for card response. So once this API returns you either have already received something from the card (and it's in the receive buffer), or, in case of an error (for instance card is not in proximity any longer) this function returns with an appropriate error message. Second API set (phhalHw_Transmit and phhalHw_Receive is doing the same but splits in send and receive operation. The former API returns once data has been transmitted to a card, the latter returns once card response has been received (or receive timeout). 

So why do we need two different API sets? The actual difference is that phhalHw_Exchange is mainly used in reader mode, i.e. PN5180 is the reader and communicates with a card. 

PN5180 and the reader library can also be operated in card emulation (or p2p target mode), i.e. PN5180 and reader lib behave like a card and the counterpart is a reader. In this case first phhalHw_Receive needs to be called. The received data from the reader will be forwarded to the application. The application then prepares a response and this response is sent out using phhalHw_Transmit. Using phhalHw_Exchange would not be possible in that case (even if phhalHw_Exchange would first receive and then transmit) since it's blocking and doesn't return back to application between receive and transmit.

I guess your 2nd question has been answered in a different thread, if not, please let me know!

Christian.

0 Kudos
Reply