Hello ARMmbed,
I’m not sure this is the right place to ask this question but I don’t know where to start otherwise.
So if anyone can guide me to the right resource, that would be great.
I’m using Mbed OS on the Lora-E5 from Seeed. All works great but I can’t get non volatile memory to work.
I want to store 1 integer variable even after a power-cycle.
I tried adapting the KVstore examples into my code. And they work as long as the power is on. But after a power cycle the data is gone.
Below are the two functions I’m testing with.
void kv_store_get(char* key) {
/* Start by getting key's information */
res = kv_get_info(key, &info);
char *kv_first_value_out = new char[info.size + 1];
memset(kv_first_value_out, 0, info.size + 1);
res = kv_get(key, kv_first_value_out, info.size, &actual_size);
printf("kv_get -> %d\n", err_code(res));
printf("kv_get key: %s\n", key);
printf("kv_get value: %s\n", kv_first_value_out);
delete[] kv_first_value_out;
}
void kv_store_set(char* key, char* value) {
res = kv_set(key, value, strlen(value), 0);
printf("kv_set -> %d\n", err_code(res));
}
And I’ve set the following configurations in mbed_app.json:
"LORA_E5_MINI": {
"stm32wl-lora-driver.rf_switch_config": 2,
"lora.duty-cycle-on": false,
"target.features_add": ["STORAGE"],
"target.components_add": ["FLASHIAP"],
"storage.storage_type": "TDB_INTERNAL",
"storage_tdb_internal.internal_size": "(4*1024)"
}
If anyone can point me into a direction of getting this to work that would be very much appreciated.
Thanks in advance