<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Speeding up DFU OTA on Linux</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/107355/speeding-up-dfu-ota-on-linux</link><description>Hello, I am using Linux computer as an update hub for BT device, based on NRF52840. 
 The device is set to use Coded PHY, so there is no possibility to use McuMgr - but with Bluez 5.64 and Bleak 0.21.1. The application is compiled using NRF Connect 2</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 16 Jan 2024 08:01:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/107355/speeding-up-dfu-ota-on-linux" /><item><title>RE: Speeding up DFU OTA on Linux</title><link>https://devzone.nordicsemi.com/thread/464304?ContentTypeID=1</link><pubDate>Tue, 16 Jan 2024 08:01:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b399bd8d-dc1e-4515-87d9-10b8dec8da82</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Good to see that I was able to provide helpful help.&lt;/p&gt;
[quote user="Paskin"]my knowledge in Kotlin/Java is not enough to understand it from the Android mcumgr code[/quote]
&lt;p&gt;This made me think of our recently implemented SMP Client for microcontrollers, which is implemented in C.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/pull/56934"&gt;https://github.com/zephyrproject-rtos/zephyr/pull/56934&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;I do not know if this implements the sliding or not, and I have not tested the speed of it.&lt;br /&gt;But it could be worth having a look at.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Speeding up DFU OTA on Linux</title><link>https://devzone.nordicsemi.com/thread/464226?ContentTypeID=1</link><pubDate>Mon, 15 Jan 2024 14:32:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38d744a0-b44d-4ba0-9de9-3e85a0b24578</guid><dc:creator>Paskin</dc:creator><description>&lt;p&gt;Thanks a lot, I will look into this.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I believe it is not about just speeding up the transfer of bytes - but somehow sending data in parallel/ahead of confirmation. There are some references to &amp;quot;sliding window&amp;quot; in SMP&amp;nbsp; - but I am not sure how it has to be implemented and my knowledge in Kotlin/Java is not enough to understand it from the Android mcumgr code (especially based on Android OS APIs, I am not familiar with at all).&lt;br /&gt;&lt;br /&gt;With regard to SMP packet length you mentioned above - yes, even before the special re-assembly mechanism created for DFU images, each SMP command can span over multiple lower-level GATT packets - because latter are limited by MTU, and without this mechanism it will be challenging to deliver, for example, &amp;quot;list images&amp;quot; response.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;This is exactly what I am looking for - how to combine BLE packet size, MTU, SMP protocol-level re-assembly, SMP image upload-specific re-assembly, buffer size and number of buffers ;) to improve performance.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Thanks again!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Speeding up DFU OTA on Linux</title><link>https://devzone.nordicsemi.com/thread/464203?ContentTypeID=1</link><pubDate>Mon, 15 Jan 2024 13:52:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa1c03ef-7e22-41c0-8b77-62afa5c70acf</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;And after that I got the following:&lt;/p&gt;
&lt;p&gt;Try to tweak DLE as well, maybe that can help you.&lt;/p&gt;
&lt;p&gt;Also, see &lt;a href="https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/building-a-bluetooth-application-on-nrf-connect-sdk-part-3-optimizing-the-connection#mcetoc_1ftnic3900"&gt;https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/building-a-bluetooth-application-on-nrf-connect-sdk-part-3-optimizing-the-connection#mcetoc_1ftnic3900&lt;/a&gt; for some tips on speeding up BLE.&lt;/p&gt;
&lt;p&gt;Other than that, if you send a &lt;a href="https://www.nordicsemi.com/Products/Development-tools/nrf-sniffer-for-bluetooth-le"&gt;BLE sniffer&lt;/a&gt; trace from the DFU, we can have a look at it and see if we find any bottlenecks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Speeding up DFU OTA on Linux</title><link>https://devzone.nordicsemi.com/thread/464199?ContentTypeID=1</link><pubDate>Mon, 15 Jan 2024 13:45:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3da2f35e-3ed9-4c77-bbac-e259785fba82</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;The nRF Device Manager code is public for both &lt;a href="https://github.com/NordicSemiconductor/Android-nRF-Connect-Device-Manager/"&gt;android&lt;/a&gt; and &lt;a href="https://github.com/NordicSemiconductor/IOS-nRF-Connect-Device-Manager"&gt;iOS&lt;/a&gt;.&lt;br /&gt;This implements FOTA, so we can have a look at what that does to be so fast.&lt;/p&gt;
&lt;p&gt;From the android one, &lt;a href="https://github.com/NordicSemiconductor/Android-nRF-Connect-Device-Manager/blob/main/mcumgr-ble/src/main/java/io/runtime/mcumgr/ble/McuMgrBleTransport.java#L216-L238"&gt;Maximum SMP packet length&lt;/a&gt; seems to enable longer packets than the MTU, which probably speeds this up. But if BlueZ does not support that, that is not possible I guess.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/NordicSemiconductor/Android-nRF-Connect-Device-Manager/blob/6470b87a91b97fdbd21cf94cb86165e66cdd295b/mcumgr-ble/src/main/java/io/runtime/mcumgr/ble/McuMgrBleTransport.java#L543"&gt;here&lt;/a&gt; is also something mentioning file transfer speeds.&lt;br /&gt;Also &lt;a href="https://github.com/NordicSemiconductor/Android-nRF-Connect-Device-Manager/blob/6470b87a91b97fdbd21cf94cb86165e66cdd295b/mcumgr-ble/src/main/java/io/runtime/mcumgr/ble/McuMgrBleTransport.java#L667-L674"&gt;here&lt;/a&gt;. &lt;br /&gt;Well, you get the jist, Im just reading the comments from that file.&lt;/p&gt;
&lt;p&gt;That is all I can find on this, but I will ask a colleague who is more experienced with BLE to see if they have any suggestions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Speeding up DFU OTA on Linux</title><link>https://devzone.nordicsemi.com/thread/464160?ContentTypeID=1</link><pubDate>Mon, 15 Jan 2024 12:07:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a592c068-8223-416a-8669-8caea8d5270c</guid><dc:creator>Paskin</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Well - kind of. We had an IOT hub, collecting data from and managing sensors. It is written in Python. as all our software -and running on Linux computers located at the remote sites (where sensors are deployed).&lt;br /&gt;&lt;br /&gt;This IOT hub already&amp;nbsp;contained&amp;nbsp;BLE advertisements processing and GATT characteristics read/wrtite/notify functionality - so implementing SMP client on top of it was more or less a matter of adding CBOR library to the project and writing a functions for serialization/deserialization of&amp;nbsp;the SMP payload. And I had NRF Connect Android app - logs of it helped me to see that I am doing the right thing (or not). So I managed to implement the sequential chunk-by-chunk upload, confirmation and reset - so from the fucntional perspective everyhting is ok.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Unfortunately - the whole block of image upload in the app doesn&amp;#39;t have a detailed logs, neither&amp;nbsp;performance aspect of SMP is documented well in general. I understood that the performance has to do with &amp;quot;SMP reassembly&amp;quot; and three numbers - MTU (which is reported to be 495), SMP buffer size (2475) and number of buffers (4).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have tried to tweak the chunk size, so&amp;nbsp;SMP write command will fit into one packet, MTU or SMP buffer size (latter requires multiple &amp;quot;write&amp;quot; commands in a sequence, as BlueZ cannot write more than MTU). At 2475 bytes - It takes to a device 400-500 ms to respond with the notiifcaton (confirm the new offset), so I can proceed with the next chunk. With&amp;nbsp;any combination - the speed hardly goes above 2 kB/s, when with Android application it is quite stable on 11.3 kB/s.&lt;br /&gt;&lt;br /&gt;Could you advise regarding the algorithm - how to divide the image into a SMP commands/BLE packets so the reassembly will be at least as effective as with the mobile app as a client?&lt;br /&gt;&lt;br /&gt;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Speeding up DFU OTA on Linux</title><link>https://devzone.nordicsemi.com/thread/464098?ContentTypeID=1</link><pubDate>Mon, 15 Jan 2024 08:36:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98cf6911-dc24-4032-bf94-00db94f5d8eb</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]The device is set to use Coded PHY, so there is no possibility to use&amp;nbsp;McuMgr - but with Bluez 5.64 and Bleak 0.21.1. The application is compiled using NRF Connect 2.4.2 SDK.&amp;nbsp;[/quote]
&lt;p&gt;Do I understand it correctly that you implement your own DFU program using Bluez and Bleak?&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>