Write a file to littlefs using mcumgr and return The system cannot find the path specified

I tried to use mcumgr to write and read files to the littlefs of 9160. According to the instructions, I will enter mcumgr conn add acm0 type="serial" connstring="dev=/dev/ttyACM0,baud=115200,mtu=512" first, then enter mcumgr -c acm0 fs upload foo.txt /lfs/foo.txt, will get this error

I have also set CONFIG_MCUMGR_GRP_FS to y

How should I solve this problem?

  • Hi llly,

    The error seems to be because the command line cannot find foo.txt on your system rather than a problem with the device.

    I am not sure where mcumgr expect foo.txt to be without any path, but can you try using an absolute path? Also avoid using any non-ASCII character in the path. Preferably only use alphanumeric character and maybe underscore "_".


  • Hi Hieu

    Can you help me check this question when you have time?

  • Hi llly,

    Sorry for the long absence. I have not forgot your question here, but I still haven't figured it out yet.

    I will try to keep you regularly updated.

  • Hi Hieu

    It's okay, but I want to know if your mcumgr is also in the same situation? Or can you read and write normally on your end? If you haven't encountered this problem, could it be a problem with my driver or something else?

  • Hi llly,

    My results have been different, but things are still not working in either cases.

    PS C:\_w\c\c329113_littlefs_mcuboot\mcuboot_smp_uart> mcumgr -c com14 fs download /lfs/pattern.bin a2.bin
    Error: 5
    PS C:\_w\c\c329113_littlefs_mcuboot\mcuboot_smp_uart> mcumgr -c com14 fs upload hi.txt /lfs/hi.txt
    Error: 5

    Assuming this is error from mcumgr, error 5 is MGMT_ERR_ENOENT, which is also no such file.

    This was going to resemble your initial issue somewhat. However, if I understand you correctly, you had some issue with your mcumgr connstring; and after fixing that, you get NMP Timeout errors instead. Is that right?

    That would make sense because after looking closely at your second screenshot, the stat commands are also failing with the same "cannot find the path specified" error. This means it is unlikely that the device's file system is the root cause.

    I am now also at the same point. A few stack and heap config changes get me to:


    C:\_w\c\c329113_littlefs_mcuboot\mcuboot_smp_uart>mcumgr -c com14 fs upload ./hi.txt /lfs/hi.txt
    Error: NMP timeout
    C:\_w\c\c329113_littlefs_mcuboot\mcuboot_smp_uart>mcumgr -c com14 fs download /lfs/pattern.bin abc.bin
    Error: NMP timeout
    C:\_w\c\c329113_littlefs_mcuboot\mcuboot_smp_uart>mcumgr -c com14 fs download /lfs/pattern.bin abc.bin -t 300
    Error: NMP timeout

    (I switched from Windows PowerShell to Windows CMD in the second log there, but that should not be an issue.)

    I have been looking into the mcumgr Golang CLI too but haven't fully figured out what is going on yet. It would be very helpful if I can add logging as if it is a Python script, but it doesn't seem to be the same here. 

    I will try a few things more and pull in some help.

  • Hi Hieu

    Yes, the problem I am currently facing is NMP timeout, which looks the same as yours.

    Thank you for your efforts. I will continue to wait for your good news.

Reply Children
  • Hi llly,

    I return with mixed good-bad news.

    After thinking about my test results, I realized that my NMP timeout state is a worse state than my initial "Error 5" state.

    The reason is because in this the NMP timeout error state, I cannot even run image list, while in the "Error 5" state, I can run image list.

    However, I still cannot figure out why the fs commands don't work. 

    As for restarting from a fresh start, I tried using the File system shell but it would not work at all, NMP Timeout no matter what I tried...

    Unfortunately, I will now have to be out of office for a few weeks and cannot further investigate either of the issues. I will leave some notes now, and one of my colleagues will further support you.

    For the record, I reached the "Error 5" state by doing the following:

    From my other tests, I would expect that starting with the littlefs sample and then adding MCUmgr with the FS commands would yield the same results.

    Attached is my project. 
    The "Error 5" state can be reproduce with building by default, or with heap_stack_size.conf overlay.
    The "NMP Timeout" state cane be reproduced with building with the fs_shell.conf overlay.


    P.s: I also see that I uploaded the wrong log for this "Error 5" state last time, so I have reproduced it and updated my last reply.

  • Hi Hieu

    Thank you for testing. I was able to reproduce error 5 using your project, but it still did not succeed.