Save data on power down

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.
Philosophix
Posts: 24
Joined: Wed Jan 02, 2019 11:45 am

Re: Save data on power down

Post by Philosophix » Fri Jan 04, 2019 3:25 pm

I was accidentally looking at the PYB1.0 picture in the quick reference where there is no VBACK. I have PYB1.1 so after getting the correct picture I added a CR2032 to VBACK and which is working fine with the code you provided. I still can't find any documentation on the stm-module.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Save data on power down

Post by Roberthh » Fri Jan 04, 2019 4:59 pm

I was sure it existed in the docs. But it is in the Wiki: http://wiki.micropython.org/platforms/b ... ard/modstm

Philosophix
Posts: 24
Joined: Wed Jan 02, 2019 11:45 am

Re: Save data on power down

Post by Philosophix » Thu Jan 10, 2019 7:10 am

Saving a number to stm.mem32[stm.RTC+stm.RTC_BKP9R] on power down is working fine, but I need to save another number too which can fit in 16 bits. Is there room for another number and if so, what is the address?

The Wiki: http://wiki.micropython.org/platforms/b ... ard/modstm won't let me access http://wiki.micropython.org/platforms/b ... -const-rtc. It's asking me to sign in so I could not check the documentation.

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

Re: Save data on power down

Post by pythoncoder » Thu Jan 10, 2019 9:20 am

The battery backed RAM is 4KiB of contiguous space. You'll find some tips on accessing it here.
Peter Hinch
Index to my micropython libraries.

chuckbook
Posts: 135
Joined: Fri Oct 30, 2015 11:55 pm

Re: Save data on power down

Post by chuckbook » Thu Jan 10, 2019 10:53 am

So far MicroPython uses only two of the RTC 32-bit backup registers available (20 on Pyboard, 32 on PYBD).
On a PYBV11 BKP1R..BKB18R are available for general usage.Keeping data inside RTC avoids powering backup RAM.

Post Reply