Can be stored data inside non volative memory ?

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Can be stored data inside non volative memory ?

Post by pythoncoder » Mon Feb 15, 2016 6:53 am

I'm glad you found it - a slip up most of us have done at some point.

"He who never made a mistake never made anything." ;)
Peter Hinch
Index to my micropython libraries.

BOB63
Posts: 58
Joined: Sat Jul 25, 2015 8:24 pm
Location: Monza , Italy

Re: Can be stored data inside non volative memory ?

Post by BOB63 » Wed Mar 02, 2016 6:38 pm

Hi,
well ,I've completed my project.
I'm finishing to write the down the project description into a document and ready to post it with the code (MicroPython and Processing2) in the forum.
The project use the upower module from pythoncoder.

I DON'T KNOW NOTHING AT ALL ABOUT THE DIFFERENT LICENSE THAT CAN BE USED TO RELEASE A CODE. :shock:

Can someone tell me what I've to write in both codes , in terms of licence and declarations , to permit the sharing of this sw ? :?: :roll:
Thanks. Roberto

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Can be stored data inside non volative memory ?

Post by pythoncoder » Thu Mar 03, 2016 7:03 am

The best place to post code is on GitHub. When you create a new repository it invites you to choose a licence and puts a copy of the licence into your repository. Most of the MicroPython code is released under the MIT licence which means people can use it for any purpose including commercial ones. Crucially it absolves you from any responsibility if a failure of the code results in unpleasant consequences.

In the code itself I put the words

Code: Select all

# Copyright (C) Peter Hinch 2016
# Released under the MIT licence
However I'm not a lawyer nor an expert on licensing so I'd welcome any comments from anyone more knowledgeable.
Peter Hinch
Index to my micropython libraries.

Iyassou
Posts: 42
Joined: Sun Jun 26, 2016 9:15 am

Re: Can be stored data inside non volative memory ?

Post by Iyassou » Sat Jul 23, 2016 8:16 am

pythoncoder wrote:

Code: Select all

bram[0] = len(inBuffer)
ba[4: 4+len(inBuffer)] = inBuffer
# To retrieve
bt = bytes(ba[4:4+bram[0]])
 
Sorry if this is a silly question but I was reading the documentation for your micropower module because I'm interested in being able to store a few strings into the 4kb RAM and there's one thing that I didn't understand which was the presence of the number 4 in the instances of list slicing. I found this thread hoping it would shed light on my query but it seems that I'm missing something :? I'm a complete noob to all of this and I would really like to know the significance of the number 4 in all of this. Thanks.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Can be stored data inside non volative memory ?

Post by pythoncoder » Sat Jul 23, 2016 11:16 am

In that code sample I stored the length of the buffer in location 0 of the backup RAM. This is a 32 bit integer, which takes 4 bytes. Consequently the buffer contents start at location 4.

The code is merely intended as an example, and the approach of saving the length of the buffer, while necessary for binary buffers, isn't the only approach when saving data with bytes constrained to a subset of possible values. The output of the Pickle module is an example. Another way would be to append a character to the buffer which is outside of the subset, such as (in the case of Pickle) 0x00. But any routine which is to retrieve data needs some way to establish where the data ends.
Peter Hinch
Index to my micropython libraries.

Iyassou
Posts: 42
Joined: Sun Jun 26, 2016 9:15 am

Re: Can be stored data inside non volative memory ?

Post by Iyassou » Sat Jul 23, 2016 12:19 pm

Thank you very much for the explanation, it's clear now :D Also thank you for sharing your micropower module :D

Post Reply