Abort in phNfcLib_Activate() for PN5190

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

Abort in phNfcLib_Activate() for PN5190

Jump to solution
3,390 Views
ttkk_01
Contributor I

Hello.

I use TypeA card and call phNfcLib_Activate() with blocking(PH_ON)

To check abort scenario, I call phNfcLib_AsyncAbort() in some different timings.

I found sometimes don't get out of activate loop.

By checking SPI data, I found it occurs in same timing (timer setting).

In phacDiscLoop_Sw_DetTechTypeA(), it call (void)phhalHw_SetConfig with "PHHAL_HW_CONFIG_TXWAIT_US".
For testing, I add to check return value, it can get out of the loop.
Does it no need to check the return value?

In another code(ex. phhalHw_Pn5190.c) , it checks return value about phhalHw_SetConfig with "PHHAL_HW_CONFIG_TXWAIT_US"

0 Kudos
1 Solution
2,929 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @ttkk_01 ,

 

I just got the confirmation from R&D that it is correct as you did it and it will be officially integrated in the next release.

 

Hope that helps,

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
16 Replies
3,371 Views
ttkk_01
Contributor I

Hi @Kan_Li 

Yes. I use the latest 6.13 version. 

In abort scenario, normally it can get out of activate loop by phNfcLib_AsyncAbort().

But sometime can't get out of the loop.

By checking SPI data, phNfcLib_AsyncAbort() is called during (void)phhalHw_SetConfig process.

I check library source and find it doesn't check return value and the other case check return value.

I don't find out the cause is return value checking or not. (But if it add checking, it can get out of activate loop)

Please confirm about it.

0 Kudos
3,355 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @ttkk_01 ,

 

What is the checking return value you mentioned before? Do you have a code snippet for it? 

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
3,349 Views
ttkk_01
Contributor I

Hi @Kan_Li 

Only change to check the result is success or not as following

phStatus_t wStatus = phhalHw_SetConfig(pDataParams->pHalDataParams, PHHAL_HW_CONFIG_TXWAIT_US, 500);
if(0 != wStatus){
 return wStatus ;
}

0 Kudos
3,342 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @ttkk_01 ,

 

Actually phhalHw_SetConfig(pDataParams->pHalDataParams, PHHAL_HW_CONFIG_TXWAIT_US, 500) is used to set up a TX wait timer for 500us, I don't think it is needed to check the returned value here. did you find a error value from there? Better use PH_CHECK_SUCCESS_FCT(status, phhalHw_SetConfig()) here, otherwise you would break up the protocol and skip the following steps.

Kan_Li_0-1639123943889.png

 

BTW, I didn't find phNfcLib_AsyncAbort() was used in phhalHw_SetConfig(),

Kan_Li_1-1639124101496.png

 

Have you customized the library for some purpose? Please kindly clarify.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

0 Kudos
3,336 Views
ttkk_01
Contributor I

Hi @Kan_Li ,

phNfcLib_AsyncAbort() is called in my test tool not in library.
In testing tool, it calls repeatedly as follow:
- phhalHw_FieldOn()
- phNfcLib_Activate()
- phNfcLib_Transmit()
- phNfcLib_Receive()
- phNfcLib_Deactivate()
- phhalHw_FieldOff()
And the tool also call phNfcLib_AsyncAbort() at difference timing(100us, 200us, ... after each function call)

Normaly it returns abort status and stop the sequence correctly(go to next loop).
But there is a case didn't stop the sequence in phNfcLib_Activate().
I think phhalHw_SetConfig() with PHHAL_HW_CONFIG_TXWAIT_US need to exchange command data.
If phNfcLib_AsyncAbort() is called during the phhalHw_SetConfig() process,
HAL move to 'Idle' status but phacDiscLoop_Sw_DetTechTypeA() return as PHAC_DISCLOOP_TECH_DETECTED because of calling (void)phhalHw_SetConfig (in my test, the return value is PH_ERR_ABORTED).

In another code(ex. phacDiscLoop_Sw_Int_B.c),
it uses PH_CHECK_SUCCESS_FCT about phhalHw_SetConfig(.,PHHAL_HW_CONFIG_TXWAIT_US,.,.).
I didn't find out reason between return value check and no check.

0 Kudos
3,312 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @ttkk_01 ,

 

Actually the return value is checked inside  phhalHw_SetConfig().

Kan_Li_0-1639552808307.png

It is not a must option to check the return value in case of setting PHHAL_HW_CONFIG_TXWAIT_US . and obviously phhalHw_SetConfig() with PHHAL_HW_CONFIG_TXWAIT_US needs to exchange command data with PN5190, but it doesn't poll for RF Event, just register setting. while phhalHw_AsyncAbort() is used to post an 'abort' event which is used by the HAL to move into 'Idle' state and exit from polling for RF Event. so if it is called during phhalHw_SetConfig() with PHHAL_HW_CONFIG_TXWAIT_US ,the process would not be aborted immediately until it goes to somewhere waiting for response data from the PICC/card. 

Kan_Li_1-1639557049835.png

Kan_Li_2-1639557110171.png

 

Hope that makes sense,

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

 

 

 

 

0 Kudos
3,303 Views
ttkk_01
Contributor I

Hi @Kan_Li ,

I understood return value is checked inside phhalHw_SetConfig().
So if phhalHw_AsyncAbort() is called during phhalHw_SetConfig() with PHHAL_HW_CONFIG_TXWAIT_US, phhalHw_SetConfig() will return PH_ERR_ABORTED.
But by calling (void)phhalHw_SetConfig in phacDiscLoop_Sw_DetTechTypeA(), no check and go next function: phpalI14443p3a_HaltA().
And phpalI14443p3a_HaltA() return PN5190_STATUS_NO_RF_FIELD because HAL is in 'Idle' state.
Next, bTotalTagsFound set 1 and return as PHAC_DISCLOOP_TECH_DETECTED.
So I think it occurs mismatch (HAL is 'idle' state but process continue as if the card was detected.)
Finally, phNfcLib_Activate() with blocking(PH_ON), it can't get out of activate loop.

My understand is not correct?

0 Kudos
3,293 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @ttkk_01 ,

 

Yes, you are right. I overlooked the part of checking the abort event during phhalHw_SetConfig() when the code polls for IRQ signal from PN5190.

Kan_Li_0-1639630682093.png

and yes , the code has to check the returned value in such cases, and I will check with the expert if that is the best work around.

 

Thanks for the report! I will let you know when I have any feedback from the expert team.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

 

 

0 Kudos
3,284 Views
ttkk_01
Contributor I

Hi @Kan_Li ,

Thanks.
For work around, I add to check return value as following:
PH_CHECK_SUCCESS_FCT(status, phhalHw_SetConfig())

Please check with the expert team.
I'd appreciate it if you could give me your feedback.

0 Kudos
3,222 Views
ttkk_01
Contributor I

Hi @Kan_Li ,

Did you get some feedback from expert team?
I want to know if it is the best way to check the return value as follows:
PH_CHECK_SUCCESS_FCT(status, phhalHw_SetConfig())

0 Kudos
3,213 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @ttkk_01 ,

 

Actually not yet, the expert is on Xmas vacation, so it may take more time for his feedback. From my point of view, the workaround from your side looks reasonable , and if it works for your application, please just stay with it and I will let you know when there is a statement from the expert/R&D team available.

 

Thanks for your patience!

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
2,984 Views
ttkk_01
Contributor I

Hi @Kan_Li ,

It's been a month since last reply...

Did you get some feedback from expert team?

If no, when we can get it.

And,

My concern point is new firmware v2.1.

There is Release Note at Jan 13, 2022 but I couldn't find the software. (v2.03 is available now.

I will arise new question about it)

Does the new firmware v2.1 include related fixes? 

Tags (1)
0 Kudos
2,930 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @ttkk_01 ,

 

I just got the confirmation from R&D that it is correct as you did it and it will be officially integrated in the next release.

 

Hope that helps,

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
2,925 Views
ttkk_01
Contributor I

Hi @Kan_Li ,

Thank you for making sure.
I will continue the workaround and apply the integrated library after release.

0 Kudos
2,945 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @ttkk_01 ,

 

Sorry for the late reply! I am still waiting for the feedback, but if this work around works well on your side, please just stay with it.

 

For the firmware version, I think you are referring to https://www.nxp.com/docs/en/release-note/RN00014.pdf , right? If so , the firmware version mentioned on this note is just 2.01, and the latest version is ver 2.03, which is available from the latest Cockpit tool.

 

Hope that makes sense,

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
3,379 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @ttkk_01 ,

 

Are you using the latest 6.13 version? Please kindly clarify.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos