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, Eagle, 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 and Eagle boards - 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” (ECO Power, Eagle and LongRa) 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, Eagle, LongRa, and Turtle boards.
Property | ID | Type | Default |
---|---|---|---|
RTC_AGING_CAL | 1 | T_8BIT | preset |
ADC_VREF | 2 | T_8BIT | preset |
HARDWARE_REV | 3 | T_8BIT | 0 |
LORA_DEVICE_ID | 10 | T_32BIT | preset |
LORA_CODE_ID | 11 | T_32BIT | preset |
LORA_REMOTE_ID | 12 | T_32BIT | not set |
LORA_REMOTE_ID_ALT | 13 | T_32BIT | not set |
LORA_RADIO_TYPE | 14 | T_32BIT | not set |
LORA_FREQUENCY | 15 | T_32BIT | not set |
LORA_BANDWIDTH | 16 | T_32BIT | not set |
LORA_SPREADING_FACTOR | 17 | T_8BIT | not set |
LORA_TXPOWER | 18 | T_8BIT | not set |
LORA_FREQUENCY_OFFSET | 19 | T_32BIT | not set |
LORA_APP_PWD | 20 | T_STR | not set |
LORA_APP_PWD_ALT | 21 | T_STR | not set |
LOC_LONGITUDE | 25 | T_STR | not set |
LOC_LATITUDE | 26 | T_STR | not set |
LOC_NAME | 27 | T_STR | not set |
HOSTNAME | 28 | T_STR | not set |
WIFI_SSID | 30 | T_STR | not set |
WIFI_PASSWORD | 31 | T_STR | not set |
WIFI_SSID_ALT | 32 | T_STR | not set |
WIFI_PASSWORD_ALT | 33 | T_STR | not set |
USE_DHCP | 34 | T_STR | not set |
MAC_ADDR | 35 | T_BIT | not set |
NET_IP_ADDR | 36 | T_STR | not set |
NET_IP_ROUTER | 37 | T_STR | not set |
NET_IP_DNS_SERVER | 38 | T_STR | not set |
NET_IP_DNS_SERVER_ALT | 39 | T_STR | not set |
NET_NTP_SERVER | 50 | T_32BIT | not set |
NET_NTP_SERVER_ALT | 51 | T_32BIT | not set |
NET_NTP_GMTOFFSET | 52 | T_32BIT | not set |
NET_NTP_DAYLIGHTOFFSET | 53 | T_32BIT | not set |
MQTT_SERVER | 40 | T_STR | not set |
MQTT_SERVER_ALT | 41 | T_STR | not set |
MQTT_TOPIC_INFO | 42 | T_STR | not set |
MQTT_TOPIC_ALARM | 43 | T_STR | not set |
MQTT_TOPIC_CONTROL | 44 | T_STR | not set |
MQTT_TOPIC_GATEWAY | 45 | T_STR | not set |
MQTT_TOPIC_5 | 46 | T_STR | not set |
ALARM_STATUS | 60 | T_32BIT | not set |
VOIP_SERVER | 70 | T_STR | not set |
VOIP_USER | 71 | T_STR | not set |
VOIP_PASSWORD | 72 | T_STR | not set |
VOIP_DEVNAME | 73 | T_STR | not set |
VOIP_DIALNO | 74 | T_32BIT | not set |
VOIP_DIALNO_ALT | 75 | T_32BIT | not set |
PROG_CMDLINE | 80 | T_STR | not set |
MY_CITY | 129 | T_STR | not set |
Examples
RTC_AGING_CAL = -10
ADC_VREF = 1121
NET_IP_ADDR = 192.168.1.1
MQTT_SERVER = “mqtt://username:password@domain:port”