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

    View contents of SD Card

    Scheduled Pinned Locked Moved Discussion
    sd cardfilezilla
    6 Posts 2 Posters 2.1k Views 2 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.
    • J Offline
      JimT
      last edited by

      I have a Lopy and expansion board. I'm using FileZilla to view/edit contents of the flash and want to know if I can also view/edit contents of the expansion board's SD card with FileZilla.

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

        @JimT Once you have mounted the SD card from within the LoPy, you can see it's content by ftp under the name you used for mounting. You can add the statements for mounting to your boot.py script, like:

        import os
        import machine
        
        sd = machine.SD()
        os.mount(sd, '/sd')
        

        In that case, the SD cards content would appear under /sd.

        1 Reply Last reply Reply Quote 0
        • J Offline
          JimT
          last edited by

          Thank you for your response. I will add these statements to the boot.py file. Where is the documentation which discusses this? I was able to write to the sd card without these statements but it will be great to see the results using fileZilla.

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

            @JimT The SD card has to be mounted before you can access internally and externally. If you could write to it, that only means that somewhere in the code it was mounted. That does not have to be in boot.py. But since boot.py is always executed on boot, this is a good place to perform the mounting.
            If you ask about documentation: for boot.py and main.py, look at the (very good) documentation https://docs.pycom.io/, chapter 1.5 or 2.5. The SD card set-up is documented in chapter 6.2.1.11 SD
            I wonder how you managed to write to the SD card w/o mounting it?

            1 Reply Last reply Reply Quote 0
            • J Offline
              JimT
              last edited by JimT

              Hello Robert, I used the example SD code where I see it call the mount statement.

              from machine import SD
              import os

              sd = SD()
              os.mount(sd, '/sd')
              os.listdir('/sd')
              f = open('/sd/test.txt', 'w')
              f.write('Testing SD card write operations')
              f.close()
              f = open('/sd/test.txt', 'r')
              f.readall()
              f.close()

              1 Reply Last reply Reply Quote 0
              • J Offline
                JimT
                last edited by

                This post is deleted!
                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 / 1
                • First post
                  Last post

                Pycom on Twitter

                Pycom