Hi,
You can refer to the SMP server sample.
I use this command
west build -p -b nrf52840dk_nrf52840 zephyr/samples/subsys/mgmt/mcumgr/smp_svr -- -DOVERLAY_CONFIG='overlay-fs.conf;overlay-serial.conf' && west flash --recover
and get
Regards,
Amanda H.
Hi Amanda,
Thank you for your reply!
I could be able to run the smp server, that you cited and able to transfer small files.
My use case is to transfer 300kB of file to Filesystem, but It did not succeed. Even I tried low sized file, 108kB of file size, but it also failed with timeout.
Here
mu.txt file size is 1kB
mu108_kb.txt file size is108kB
C:\Users\MK\Downloads\serial_upgrade>mcumgr --conntype serial --connstring "COM10,baud=115200" fs upload mu.txt /lfs1/mu.txt
12
Done
C:\Users\MK\Downloads\serial_upgrade>mcumgr --conntype serial --connstring "COM10,baud=115200" fs upload mu108_kb.txt /lfs1/mu108_kb.txt
Error: NMP timeout
Any suggestion?
Thanks,
MK V
++++
In this exercise, i tried to determine the least number of characters in the file that I can transfer.
Here the number of characters included in the file is 35, also same it showed it written 35 bytes in the console.
C:\Users\MK\Downloads\serial_upgrade>mcumgr --conntype serial --connstring "COM10,baud=115200" fs upload mu108_kb.txt /lfs1/mu108_kb.txt
35
Done
Here after added extra one character to the mu108_kb.txt for successive cases.
C:\Users\MK\Downloads\serial_upgrade>mcumgr --conntype serial --connstring "COM10,baud=115200" fs upload mu108_kb.txt /lfs1/mu108_kb.txt
36
Done
C:\Users\MK\Downloads\serial_upgrade>mcumgr --conntype serial --connstring "COM10,baud=115200" fs upload mu108_kb.txt /lfs1/mu108_kb.txt
37
Done
C:\Users\MK\Downloads\serial_upgrade>mcumgr --conntype serial --connstring "COM10,baud=115200" fs upload mu108_kb.txt /lfs1/mu108_kb.txt
38
Done
C:\Users\MK\Downloads\serial_upgrade>mcumgr --conntype serial --connstring "COM10,baud=115200" fs upload mu108_kb.txt /lfs1/mu108_kb.txt
Error: NMP timeout
Maximum character I could transfer using mcumgr over UART is 38 bytes.
Could you elaborate me on this transfer limitation and What is the possibilities to transfers 500kB of file over uart using mcumgr on application?
Thanks,
MK V
Hi Amanda,
Any config changes help to break this limitation?
Could you able to upload 500kb of file using mcumgr over UART?
Thanks,
MK V
Hi,
500KiB uploads work fine, but you need to have a flash device that you can store it on. For our DKs, that would mean having to move the fatfs/lfs partition to QSPI/SPI flash with CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL. You can execute "ninja partition_manager_report" command under the build folder to check the memory layout and size large enough for the upload file:
My test project for nRF52840DK with spi external flash: smp_svr.7z
-Amanda H.
Hi,
500KiB uploads work fine, but you need to have a flash device that you can store it on. For our DKs, that would mean having to move the fatfs/lfs partition to QSPI/SPI flash with CONFIG_PM_PARTITION_REGION_LITTLEFS_EXTERNAL. You can execute "ninja partition_manager_report" command under the build folder to check the memory layout and size large enough for the upload file:
My test project for nRF52840DK with spi external flash: smp_svr.7z
-Amanda H.
Hi Amanda,
Thank you for providing the test project.
I have incorporated some of the configuration settings from your code into my custom board's source code. Setting CONFIG_MCUMGR_BUF_SIZE=2475
resolved the UART issue for mcumgr in the application.
Now I could be able to successfully transfer my complete file to the External Flash.
However, I have noticed that transferring a 137 KB file takes approximately 1 minute and 10 seconds. Is there any potential to reduce this transfer time?
I have attempted to increase CONFIG_MCUMGR_BUF_SIZE
and utilize MTU values of 512 and 1024 as arguments for mcumgr, but these adjustments have not yielded any improvement.
I would appreciate any insights or suggestions on how to optimize this transfer process.
Thanks,
MK V
Hi,
MK_V said:Is there any potential to reduce this transfer time?
Check out this post. Maybe you can try the latest version of NCS v2.8.0.
MK_V said:I have attempted to increaseCONFIG_MCUMGR_BUF_SIZE
and utilize MTU values of 512 and 1024 as arguments for mcumgr, but these adjustments have not yielded any improvement.
I can increase CONFIG_MCUMGR_BUF_SIZE and CONFIG_MCUMGR_SMP_UART_MTU to 2475 without issue by using the following command with my test project.
west build -p -b nrf52840dk_nrf52840 zephyr/samples/subsys/mgmt/mcumgr/smp_svr -- -DOVERLAY_CONFIG='overlay-fs.conf;overlay-serial.conf' -DCONFIG_MCUMGR_BUF_SIZE=2475 -DCONFIG_MCUMGR_SMP_UART_MTU=2475 && west flash --recover
-Amanda H.
I can increase CONFIG_MCUMGR_BUF_SIZE and CONFIG_MCUMGR_SMP_UART_MTU to 2475 without issue by using the following command with my test project.
After this change, could you able to observe improvement in file transfer speed and overall upload time?
Check out this post. Maybe you can try the latest version of NCS v2.8.0.
Thanks! I will check it out!
As this post indicated mcumgr is known to be quite slow.
For now, see MCUBOOT slow with nRF52840 / Zephyr / USB CDC_ACM protocol for how to speed up mcumgr or use other alternatives than mcumgr-native-cli. See https://docs.zephyrproject.org/latest/services/device_mgmt/mcumgr.html for a list. Most of these will be faster than the old tool.
Sure, Thanks!