How to receive a large amount of data by P2P (PN7150)

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

How to receive a large amount of data by P2P (PN7150)

2,763 次查看
kremezz
Contributor I

Hello
I'm using PN7150 with NXP library (SW4325). My task is to receive data via p2p (more than 1 kB), but when I'm doing it library can't receive full data packets (22 messages were sent, but only 6 were received, any messages were not recognized and after it, hard fault happened). 
pastedImage_1.png

In experiments it was determined that the maximum message length that can be correctly received is 120 bytes, more bytes are not received in one communication loop and if it's several messages in one communication loop (like in the example screen) it does not receive more.
If you initiate loops with a small amount of data, all data comes in, but there is a big delay between loops (NxpNci_StopDiscovery, NxpNci_StartDiscovery)
How can I correctly receive for example 1 kB data via p2p without large time delay?

Hope for your help, thank you. 

标签 (1)
0 项奖励
回复
11 回复数

2,364 次查看
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Dzmitry,

Be sure that you are sending the NDEF message correctly.

Please look at the next link, it will help you with the NDEF format

NFC Data Exchange Format (NDEF)

Reards,

Mario

0 项奖励
回复

2,364 次查看
kremezz
Contributor I

Yes, the NDEF message is completely correct
And first messages are true, but after receive buffer overflowed and the pointer goes beyond the memory allocated to the structure
pastedImage_1.png
In NdefRecord.recordPayload multiple messages from the phone all are in one structure. If I want to receive 22 messages of 16 bytes all messages pull in one NdefRecord.recordPayload
pastedImage_3.png
This is the first message
pastedImage_4.png
This is after the pointer goes beyond the memory allocated to the structure
All data that does not fit into the structure memory recordPayload is lost and library handles it how "Unsupported NDEF record, cannot parse", after this an HardFault error may occur due to improper memory access

And its structure overflow after several NDEF messages

0 项奖励
回复

2,364 次查看
kremezz
Contributor I

the library works well with small messages, but if you need to receive a lot of data, then there are problems with receiving and processing such a lot of data

0 项奖励
回复

2,364 次查看
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Dzmitry,

What is the board that you are using has a host?

Are you taking care of the flags?

-MB (Message Begin)

-ME (Message End)

-CF (Chunk Flag)

Regards,

Mario

0 项奖励
回复

2,364 次查看
kremezz
Contributor I

Can you try to receive large messages via P2P to see it problem yourself? I think the problem in the library, but maybe something else

0 项奖励
回复

2,364 次查看
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Dzmitry,

As you know, the libraries that we provide are for the NXP products so, I am not sure if you migrate it correctly.

However. can't receive large P2P message (NDEF), this NDEF is received from the other controller, so if the message is short or large the PN715 should receive the NDEF message.

Please look at the NFC Data Exchange Format (NDEF)Technical Specification

Regards,

Mario

0 项奖励
回复

2,364 次查看
kremezz
Contributor I


So it doesn't work with i.MX RT1064
I'm using PN7150 with NXP library (SW4325). Hardware is i.MX RT1064, example is NXP-NCI_MCUXpressoExample_V1.5, ported via guide https://www.nxp.com/docs/en/application-note/AN12290.pdf. 

0 项奖励
回复

2,364 次查看
mario_castaneda
NXP TechSupport
NXP TechSupport

Hi Dzmitry,

I already provided the workaround in the other secure channel that we have.

Regards,

Mario

0 项奖励
回复

2,364 次查看
kremezz
Contributor I

so PN715 receive NDEF messages, but it works with linux and doesn't work with library SW4325 for MCU

0 项奖励
回复

2,364 次查看
kremezz
Contributor I

I am sure that I migrated correctly because other functionality works well (NFC cards, etc.)
NDEF allows you to receive messages limited to a length of 258 bytes, so you need to break large messages into smaller ones and send multiple messages given the flags ME, MB, CF. And if the first message is received, then the next message in one data exchange session will be received outside the allocated memory NdefRecord.recordPayload
if the messages are small, then they can receive more until NdefRecord.recordPayload is filled
could you check it yourself to see that this problem is real or not?

0 项奖励
回复

2,364 次查看
kremezz
Contributor I

I'm using STM32 nucleo with PN7150 board (cubeIDE, NFC library SW4325) and android phone with "Legic NFC P2P Example" app
It app works correctly with another phone, I tried it with somlabs board under Linux, it works too with example code for PN7150, in these cases the board receives large messages fast and correctly. I think with flags everything is OK. But the library SW4325 still can't receive large P2P message (NDEF)

0 项奖励
回复