- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I define one ID in stacknvram.h, during the application initialize, read this ID(1 byte) with bleprofile_ReadNVRAM(), if the value is not the dedicate value application expect, it will be initialize to the dedicated value and write back with bleprofile_WriteNVRAM(). But when the application reset and check this ID again, it seems the value is lost, any idea about this issue?
- Labels:
-
FlashEEPROM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
Are you checking to see if the read/write to NVRAM are successful after calling the methods?
bleprofile_ReadNVRAM and bleprofile_WriteNVRAM will return the number of bytes read and written to NVRAM, respectively.
So if the read/write was successful, you should get 1 since you are only using 1 byte. If you get 0, that means the attempt was a fail.
Also when you say that the application resets, do you mean you are pushing the reset button on the board?
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i checked the return value and after i write, i use the read function to get the flag value, it's the dedicated value i write into it.
But after i press the reset butter or trig the WDT, the value is missing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'll look into reading/writing to NVRAM after reset.
If you post your source code, I'd be happy to look into it, see if there are any other variables affecting the problem.
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
here is the code:
define the ID in stacknvram.h
#define | VS_BLE_USR_DEV_INFO | 0x10 | ||
#define | VS_BLE_DEV_INFOR_SERVICE | 0x11 | ||
#define | VS_BLE_ADV_DATA | 0x12 | ||
#define | VS_BLE_INIT_FLAG | 0x13 |
//Application data structure initialized
void app_init(void)
{
UINT8 i;
static UINT8 init_flag;
// Read configure information
bleprofile_ReadNVRAM(VS_BLE_INIT_FLAG, 1, &init_flag);
ble_trace1("Init flag is %x. \r\n", init_flag);
if(INIT_FLAG != init_flag) {
// Default application structure and save to NVRAM
//Save initialize flag
init_flag = INIT_FLAG;
i = bleprofile_WriteNVRAM(VS_BLE_INIT_FLAG, 1, &init_flag);
if(!i) {
ble_trace0("fail to Save init flag\r\n");
}
else {
ble_trace1("Save init flag, length is %d\r\n", i);
}
bleprofile_ReadNVRAM(VS_BLE_INIT_FLAG, 1, &init_flag);
ble_trace1("Read back init flag, value is %d\r\n", init_flag);
}
else {
// Read application structure from NVRAM
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hmm.. I've tested your code and it works perfectly fine.
The code that you gave me is bug free.
Perhaps something else in your code is overwriting or resetting the init_flag in NVRAM.
Can you send me the whole source code file?
If you are not comfortable uploading the whole file on the forum, you can email me: jamesle1@broadcom.com
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks a lot, i will check this again and see if i can find something, if not, i will send to and ask for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello.
Did everything work out for you?
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
still not, i have sent out a email to you just and attached the application files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We are really struggling to recreate this one internally dianke02
jamesle1 was somewhat able to compile the code you provided by commenting out quite a few things that he felt was unrelated to the issue, but when he runs the app, it resets by itself and calls the app_create function multiple times.
It would really help if you could recreate the specific issue using one of the sample applications/TAG3 board with a minimal number of changes (i.e. enough to re-create the issue). The internal apps team can then revisit.