Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle multiple requests one after each other #182

Open
mpiffari opened this issue Dec 6, 2023 · 3 comments
Open

Handle multiple requests one after each other #182

mpiffari opened this issue Dec 6, 2023 · 3 comments
Labels
question Further information is requested

Comments

@mpiffari
Copy link

mpiffari commented Dec 6, 2023

Hello folks and @dinesharjani - @philips77 - @roshanrajaratnam,
I'm struggling with the possibility of sending multiple requests one after each other without waiting for the response, and then receiving responses with matching sequence numbers.
Do you have more information about this? Is it still possibile, in order to speed up procedure? In my own implementation, it is nearly impossible to reach 8/9 kB7s as per NRC Connect dfu procedure or NRF Device manager (maybe with PRNs?).
image

Maybe, is it possible to know what happen in NRF Connect under the log "Uploading firmware"?

@philips77
Copy link
Member

Hello,
I don't remember if that's supported in nRF Connect, but for sure nRF Connect Device Manager do support it.
On Android it only works on the "Basic" mode. In "Advanced", where you can do all the steps manually, each packet awaits a notification, as it's using the legacy uploader. On iOS both views use the same uploader.
NCS 2.0 added McuMgr Params request in OS Group, which returns number of buffers and the buffer size. Although it doens't have to work all the time, you should be able to use all but one buffer (which is used for sending responses?).
This feature works better when MTU is high (we use 498) and Data Length Extension (DLE) is high (251), so the bytes are sent faster than flash can save them. The only bottleneck becomes the flash, not OTA transfer.
Remember that each packet has to have a different SEQ number than any other packet that hasn't been acked yet.

@philips77 philips77 added the question Further information is requested label Dec 7, 2023
@mpiffari
Copy link
Author

mpiffari commented Dec 11, 2023

Hi @philips77 ,
thanks for your comment.

Just two questions:

  • How can I obtain such an high MTU? With a Write (and not a write without response)? Or I need to set some specific flag in config file on firmware side? (maybe CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP?)
  • DLE: is a feature that need to be enabled via config file?

@philips77
Copy link
Member

Hello,
Sorry for the delay, I missed your questions.

How can I obtain such a high MTU? With a Write (and not a write without response)? Or I need to set some specific flag in config file on firmware side? (maybe CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP?)

In nRF Connect SDK you need to set a KConfig option to set the MTU. This will allow sending Write Without Response packets of large size on the ATT layer.

For Write With Response the packet size is always at most 512 bytes, but this is sent using Prepare Write commands if MTU is not high enough. For uploading data it's better to use Write Without Response, just negotiate the MTU to be 498.

DLE: is a feature that need to be enabled via config file?

Yes, this is also enabled in the KConfig file. I think you use CONFIG_BT_CTLR_DATA_LENGTH_MAX for that, with max value of 251. This defines the max size of a packet on L2CAP layer. It this length is not enough to send large packet (MTU>DLE), then the ATT layer will automatically split longer packets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants