Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    External Flash lose files

    Scheduled Pinned Locked Moved WiPy 2&3
    wipy3.0flash
    93 Posts 5 Posters 525 Views 6 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • robert-hhR Offline
      robert-hh @serafimsaudade
      last edited by robert-hh

      @serafimsaudade @Lourenço-Frade Going through the various versions of lfs, it might be worth to update to the actual version 2.3. Pycom uses 2.0.3, as it seems. There were some bug fixes between 2.0.3 and 2.3, even in the wear leveling mechanism. The upgrade is easy: just replace the lfs.* and lfsutil.* files. The firmware build properly. In one case test the old file system was not readable any more. So that may have to checked more deeply.

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        serafimsaudade @robert-hh
        last edited by

        @robert-hh

        Ok, Tks Robert, I will try that.

        Best Regards,

        1 Reply Last reply Reply Quote 0
        • T Offline
          tuftec
          last edited by

          Hi Guys, Thanks for that. Some really good insight.
          I do not have experience in re-building Pycom.
          Has anyone built a very recent version 1.20.2.r3 or later that has the enhanced lfs in it. Last time I tried to use lfs, it didn't work very well for me.

          Peter.

          robert-hhR 1 Reply Last reply Reply Quote 0
          • robert-hhR Offline
            robert-hh @tuftec
            last edited by

            @tuftec For which board. And do you needPyBytes support?

            1 Reply Last reply Reply Quote 0
            • T Offline
              tuftec
              last edited by

              No Pybytes and FiPy.
              Thanks

              robert-hhR 1 Reply Last reply Reply Quote 0
              • robert-hhR Offline
                robert-hh @tuftec
                last edited by robert-hh

                @tuftec it's here: https://github.com/robert-hh/Shared-Stuff.git
                Changes to the recent Dev version:

                • use lfs 2.3 with block level wear-leveling enabled
                • support UART inverted mode
                • enforce guard time for the RGB LED
                • some minor tweaks, which may not apply for FiPy

                In addition, the frozen modules contain the upysh module (see: https://github.com/micropython/micropython-lib/tree/master/upysh) and the onboard editor pye (see: https://github.com/robert-hh/Micropython-Editor)

                Edit: LFS2.3 clears all files. So save them beforehand.

                T 2 Replies Last reply Reply Quote 0
                • T Offline
                  tuftec @robert-hh
                  last edited by

                  @robert-hh Thanks. I will give it a try.

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    tuftec @robert-hh
                    last edited by

                    @robert-hh unfortunately the LFS 2.3 build you created does not work for me.
                    It dumps core when trying to close 2 x open JSON files, as does the previous LFS build that I tried.

                    It appears to fail between the first and second file close.
                    You made a comment about LFS being slower. Is there a chance that maybe the second close interferes with the first (that has not completed)????

                    I am going to have to ultimately run LFS to get the flash life that I need.

                    Any clues further ideas.

                    I will try to add some delays to see what happens.

                    robert-hhR 1 Reply Last reply Reply Quote 0
                    • robert-hhR Offline
                      robert-hh @tuftec
                      last edited by

                      @tuftec I started on Saturday another long term test running (writing million of times a single file). The test is now at ~800_000 writes. During that test, I see regular core dumps. Not at fixed intervals. I'm on it to find a reason. Alternatively I could go back to LFS2.03 with wear leveling enabled.
                      So you have seen the same error with the previous LFS? Then going back might not solve the problem.

                      P.S.: I used to prefer FAT because it is more reliable in normal operations. However crashes during files writes have a high chance of total file system corruption.

                      T 1 Reply Last reply Reply Quote 0
                      • T Offline
                        tuftec
                        last edited by

                        @robert-hh adding 500ms delays before and during the file close sequence made no improvement.

                        It appears to fail at the second close.

                        The first file is only open for reading.
                        The second file has been open for writing.

                        There is a distinct possibility that the second file was closed at an earlier stage in the process before this close is called. But this should not cause a crash.

                        Any ideas.

                        robert-hhR 1 Reply Last reply Reply Quote 0
                        • T Offline
                          tuftec @robert-hh
                          last edited by

                          @robert-hh Yes, I have seen core dumps with previous versions of LFS. That is why I moved to FAT again. But I need the improved file system life.

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            tuftec
                            last edited by

                            @peterp do you have any thoughts on this one? Solving this one would make the system so much more reliable.

                            1 Reply Last reply Reply Quote 0
                            • robert-hhR Offline
                              robert-hh @tuftec
                              last edited by robert-hh

                              @tuftec Does your error happen every time you try?

                              T 1 Reply Last reply Reply Quote 0
                              • T Offline
                                tuftec @robert-hh
                                last edited by

                                @robert-hh Yes. Happens every single time.

                                robert-hhR 1 Reply Last reply Reply Quote 0
                                • robert-hhR Offline
                                  robert-hh @tuftec
                                  last edited by

                                  @tuftec Can you post the trace dump? Then I can loop the code with the elf file.

                                  T 1 Reply Last reply Reply Quote 0
                                  • T Offline
                                    tuftec @robert-hh
                                    last edited by

                                    @robert-hh I will try to capture this tomorrow when I have some time.

                                    robert-hhR 2 Replies Last reply Reply Quote 0
                                    • robert-hhR Offline
                                      robert-hh @tuftec
                                      last edited by robert-hh

                                      @tuftec I have looked at four trace dumps in my tests, and all happen during a file close operation. Somewhere down the line, a ISR Watchdog timer fires after entering a critical section. So it looks like a lock-up condition.
                                      At littlefs/vsf_littlefs_file.c, line 104-105 looks interesting. There, the semaphore is taken and then the close call proceeds, which finally ends up in the ISR Watchdog event. The ISR is caused by the rmt driver, which is called for the heartbeat LED!

                                      1 Reply Last reply Reply Quote 0
                                      • robert-hhR Offline
                                        robert-hh @tuftec
                                        last edited by

                                        @tuftec Could you try to run the test with heartbeat LED off?

                                        T 1 Reply Last reply Reply Quote 0
                                        • T Offline
                                          tuftec @robert-hh
                                          last edited by

                                          @robert-hh the heartbeat led is disable in my application already. I will try to capture and send the dump a little later. Thanks.

                                          robert-hhR 1 Reply Last reply Reply Quote 0
                                          • robert-hhR Offline
                                            robert-hh @tuftec
                                            last edited by robert-hh

                                            @tuftec Can you also send the shortest version of the script, that causes the bug? I have a FiPy here running w/o problems.
                                            Edit: Do you use the RGB led for anything else?

                                            T 1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 2 / 5
                                            • First post
                                              Last post

                                            Pycom on Twitter

                                            Pycom