Hello,
As our product developement goes I have a question regarding RAK4030 internal flash.
We need to save on internal flash multiple data (schedulers and config bits) In order to help our development I’ve done a quick and dirty custom AT command in order to check via terminal specific flash offset with both save and read operations.
I’ve noticed that after subsequent firmware flashes the area gets written with random characters, at least on offsets 0X00000 and 0x00016.
Why is this happening? Is it safe to erase them?
Maybe we can move to a superior offset (0x1000) in order to check if this offset gets erased or written with random bytes.
We know RAK4630 offsets go from 0x00000 to 0x20000. What about RAK11720?
Many thanks in advance!
For example purposes, this is my write to flash dirty code. Beware, it doesn’t do size checks and so on…
bool set_flash(uint32_t offset, uint32_t value)
{
uint8_t flash_value[16] = {0};
flash_value[0] = (uint8_t)(value >> 0);
flash_value[1] = (uint8_t)(value >> 8);
flash_value[2] = (uint8_t)(value >> 16);
flash_value[3] = (uint8_t)(value >> 24);
flash_value[4] = (uint8_t)(value >> 32);
flash_value[5] = (uint8_t)(value >> 40);
flash_value[6] = (uint8_t)(value >> 48);
flash_value[7] = (uint8_t)(value >> 56);
flash_value[8] = (uint8_t)(value >> 64);
flash_value[9] = (uint8_t)(value >> 72);
flash_value[10] = (uint8_t)(value >> 80);
flash_value[11] = (uint8_t)(value >> 88);
flash_value[12] = (uint8_t)(value >> 96);
flash_value[13] = (uint8_t)(value >> 104);
flash_value[14] = (uint8_t)(value >> 112);
flash_value[15] = (uint8_t)(value >> 120);
if (!api.system.flash.set(offset, flash_value, sizeof(value)))
{
MYLOG("AT_CMD", "Failed to write Flash");
return false;
}
MYLOG("AT_CMD", "Write flash result: 0X%02X 0X%02X 0X%02X 0X%02X 0X%02X 0X%02X 0X%02X 0X%02X 0X%02X 0X%02X 0X%02X 0X%02X 0X%02X 0X%02X 0X%02X 0X%02X",
flash_value[0], flash_value[1],flash_value[2], flash_value[3], flash_value[4], flash_value[5], flash_value[6], flash_value[7], flash_value[8],
flash_value[9], flash_value[10], flash_value[11], flash_value[12], flash_value[13], flash_value[14], flash_value[15]);
return true;
}