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

    Flash encryption and JSON files

    Scheduled Pinned Locked Moved Discussion
    2 Posts 2 Posters 27 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.
    • Marco Moraes 0M Offline
      Marco Moraes 0
      last edited by

      Hello everyone.

      First of all, I've been looking for a while for a related topic but I couldn't find. So, I'm sorry if this is a duplicate topic.

      I could find a lot about the flash encryption, but I could not find if the application can write/modify a JSON file stored in the flash. I'll use BLE to change some configurations with the device in place and I need these changes to be permanent, so I chose the JSON file.

      My question: can an encrypted flash on a LoPy (dev board and/or OEM) board have a JSON file that can be modified over BLE? More specifically, is it possible to use something like this:

      with open('/flash/node_config.json','w') as fp:
          fp.write(json.dumps(self._cfg_file))
      

      Thanks for your support.

      1 Reply Last reply Reply Quote 0
      • P Offline
        Pete Allen 0 Global Moderator
        last edited by Pete Allen 0

        Hi Marco,

        Normal file operations should work:

        f = open('node_config.json', 'w')
        f.write('some data')
        f.close()
        

        and

        import os
        

        for more.

        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