There is a memory in which settings that are to be preserved on the board after a new sketch installation can be permanently stored. It is, for example, useful to save settings such as WiFi access data or similar.
The “PropertyEditor” example from the “Arduino-mbed-APIs” library is a small program which can edit these properties. The “PropertyTest” example explains how to use these properties. Properties can be strings or numbers. Several included example programs already use properties.
Some properties such as the LoRa device ID, the ADC reference voltage and the RTC calibration are already permanently stored in the ECO Power, LongRa (starting with rev. 7.5) and Turtle board during production.
There are three locations where properties are stored:
- OTP memory – can only be programmed once
Usually the OTP memory is very small, so only a small amount of data can be stored here. Often this type of memory is only used by the hardware manufacturers. The OTP is currently only available for the ECO Power board
- Flash memory – stores data that are to be preserved (non-volatile)
The flash memory is also limited in size; usually only a few kilobytes are reserved; 16 kB with the ESP32, 1-64 kB with the D21 (default 16 kB). The flash memory may not be written to as often as desired. However, several thousands of write accesses are possible
- RAM memory – allows storing property values while the program is being executed
Property values stored in the RAM memory are not preserved after restarting the application
When a property is loaded, it is searched in RAM memory first, then in flash memory, and finally in OTP memory. Hence, a flash property can override the OTP property or the flash property is found first.
There are properties that are already internally reserved by the system and others which can be added by the user.
Already reserved properties
Many reserved properties are not yet set and can be set by a program or by use of “PropertyEditor”, if required.
You may also define and use your own properties (starting with #128). How this works is shown in the “PropertyEditor” example. All properties are internally listed as “enum” and are comprised of number and name.
A description of the API can be found in the “NVProperty.h” file, in the “Arduino-mbed-APIs” (LongRa and “ECO Power”) and “Turtle_RadioShuttle/NVProperty” (Turtle) library. The “PropertyTest” example may be helpful for learning how to set properties.
Currently, the Property APIs are available for the ECO Power, LongRa, and Turtle boards.
RTC_AGING_CAL = -10
ADC_VREF = 1121
NET_IP_ADDR = 192.168.1.1
MQTT_SERVER = “mqtt://username:password@domain:port”