Which tool for flashing the NHS3152 via NFC

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

Which tool for flashing the NHS3152 via NFC

跳至解决方案
475 次查看
CyrilBZH
Contributor I

Hello,

i'm using the NHS3152 as a smart sensor. The device is meant to be placed on such a tiny substrate that I have no room to connect the require pins for programming.

Hence I would like to flash it using NFC (providing external DC voltage to the NHS3152 while flashing, I have room for that. That supply is then removed to deploy the sensor). There is an app available  NHS31xx NFC Program Loader – Apps on Google Play

Is there another way to do it? For instance using an NFC reader chip such the PN7642 which I'm also using to power the sensor and exchange data.

If yes can you explain how to do it?

Thanks

Cyril

0 项奖励
回复
1 解答
450 次查看
patrickgeens
NXP Apps Support
NXP Apps Support

Hello CyrilBZH,

 

I would start from the Python "nfcloader" application in the "tools" folder of the NHS3152 SDK.

This application is designed to work with a USB connected NFC reader but can be easily extended to other readers.

1) If you can run the CCID demo on the PN7642, I expect you can directly interface with it using the --pyscard option on nfcloader.py (*UNTESTED*, I don't have the PN7642 devkit available)

2) If you control the PN7642 using Python in some other way, you can extend nfcloader.py to use that interface. The connection between the programming logic and the actual reader is done via the "TagHandler" class, the definition is in "modules/taghandler.py".

Besides the constructor which stores the connection info, only 2 functions need to be provided namely read and write an ndef message

def read(self):
"""
This function reads the first record in the tag (NDEF message)
@return string containing the record payload
"""


def write(self, packet):
"""
This function writes a single MimeType record NDEF message including the packet
@param packet : The packet to be send to the tag
"""

Two subclasses of TagHandler are included and can serve as example:

  • modules/taghandler_nfc.py: high level, uses read and write ndef message
  • moduls/taghandler_pyscard.py: low level, does the whole ndef messaging itself only using page read and write commands to the tag.

Depending on the level of the PN7642 api, select the best matching subclass as a starting point for your implementation.

 

Another option is to translate the Python code in "modules/protocol.py" to C and run it on the PN7642 devkit or on your NFC reader host.

Kind regards,

Patrick

 

patrickgeens_0-1709714339281.png

 

在原帖中查看解决方案

0 项奖励
回复
2 回复数
451 次查看
patrickgeens
NXP Apps Support
NXP Apps Support

Hello CyrilBZH,

 

I would start from the Python "nfcloader" application in the "tools" folder of the NHS3152 SDK.

This application is designed to work with a USB connected NFC reader but can be easily extended to other readers.

1) If you can run the CCID demo on the PN7642, I expect you can directly interface with it using the --pyscard option on nfcloader.py (*UNTESTED*, I don't have the PN7642 devkit available)

2) If you control the PN7642 using Python in some other way, you can extend nfcloader.py to use that interface. The connection between the programming logic and the actual reader is done via the "TagHandler" class, the definition is in "modules/taghandler.py".

Besides the constructor which stores the connection info, only 2 functions need to be provided namely read and write an ndef message

def read(self):
"""
This function reads the first record in the tag (NDEF message)
@return string containing the record payload
"""


def write(self, packet):
"""
This function writes a single MimeType record NDEF message including the packet
@param packet : The packet to be send to the tag
"""

Two subclasses of TagHandler are included and can serve as example:

  • modules/taghandler_nfc.py: high level, uses read and write ndef message
  • moduls/taghandler_pyscard.py: low level, does the whole ndef messaging itself only using page read and write commands to the tag.

Depending on the level of the PN7642 api, select the best matching subclass as a starting point for your implementation.

 

Another option is to translate the Python code in "modules/protocol.py" to C and run it on the PN7642 devkit or on your NFC reader host.

Kind regards,

Patrick

 

patrickgeens_0-1709714339281.png

 

0 项奖励
回复
443 次查看
CyrilBZH
Contributor I
Hello Patrick,

thanks a lot, I'll have a look at this .
Best regards
Cyril
0 项奖励
回复