I want to write a value to the internal non-volatile memory of the uC, so it can be retrieved after a subsequent startup. I don't see a library function to do this in the quick reference guide for the pyboard.
For example, suppose I read a value from the ADC, and I use that value to set a volume control register in an external device using the I2C bus. I would like to recall that volume control setting after reset. I'm looking for a function to allow me to write the value to internal memory, so I can later read it back, to accomplish this.
Regards
Andy
Read/Write uC internal memory
Re: Read/Write uC internal memory
AFAIK, such a function exists only in the form of writing the data to a file.
-
- Posts: 20
- Joined: Sat Oct 16, 2021 3:58 pm
Re: Read/Write uC internal memory
Thanks very much. I'll look into that idea further. Also my example doesn't make too much sense, since I can just read the ADC again on power-up. But the general question remains (if for example I used a pair of GPIOs to implement up-down buttons, and I want to recall the final volume setting). Another thought is I could have an external memory and read/write to it via I2C or SPI. But my preference would be to use the uC memory to avoid the extra IC.
Regards
Andy
Regards
Andy
Re: Read/Write uC internal memory
You didn't mention which board you're using.
There are functions available on some ports to make the RTC non-volatile memory accessible.
You'll need to add a backup battery in order for the memory to be retained across power cycles.
For the pyboard, see this post: viewtopic.php?f=6&t=7064&p=40196#p40196
Some ports have RTC.memory() (ESP8266 and ESP32) viewtopic.php?f=2&t=7013
There are functions available on some ports to make the RTC non-volatile memory accessible.
You'll need to add a backup battery in order for the memory to be retained across power cycles.
For the pyboard, see this post: viewtopic.php?f=6&t=7064&p=40196#p40196
Some ports have RTC.memory() (ESP8266 and ESP32) viewtopic.php?f=2&t=7013