- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It seems that I can not read the data is stored in NVRAM before the last power off.
// Create device
void application_create(void)
{
extern UINT8 bleprofile_adv_num;
extern UINT8 bleprofile_scanrsp_num;
bleprofile_adv_num = 0x0;
bleprofile_scanrsp_num = 0x0;
bleprofile_Init(bleprofile_p_cfg);
bleprofile_GPIOInit(bleprofile_gpio_p_cfg);
blebat_Init();
readbyte = bleprofile_ReadNVRAM(VS_BLE_HOST_LIST, sizeof(homedoor_hostinfo), (UINT8 *)&homedoor_hostinfo);
ble_trace1("\nNVRAM read:%04d\n", readbyte);
// I hope to read NVRAM data that is stored in the last power off
// but I get that trace data is "NVRAM read:0000"
bleprofile_WriteNVRAM(VS_BLE_HOST_LIST, sizeof(homedoor_hostinfo), (UINT8 *)&homedoor_hostinfo);
readbyte = bleprofile_ReadNVRAM(VS_BLE_HOST_LIST, sizeof(homedoor_hostinfo), (UINT8 *)&homedoor_hostinfo);
ble_trace1("\nNVRAM read:%04d\n", readbyte);
// I can get that trace data is "NVRAM read:0033".
// It is right for 33
// But, the data has been overwrite.
Could you tell how to get the data is stored in NVRAM the last powe off ?
Solved! Go to Solution.
- Labels:
-
FlashEEPROM
-
SDK 2.X
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Tsung-Yu,
1. You should only need to write NVRAM once
2. When you wrote to 0x42, what was the result?
3. If you are going to sleep immediately after writing, you can try inserting a 5mS delay after the write command and before entering Deep Sleep.
Sincerely,
JT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
the below thread dwells specifically into the access of the nvram...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My issus is
if I have not used bleprofile_WriteNVRAM yet, bleprofile_ReadNVRAM will be error?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please check within Hello_sensor.c - Settings for Write Protection
GPIO_PIN_WP, // This need to be used to enable/disable NVRAM write protect
#define GPIO_PIN_WP 1
#define GPIO_SETTINGS_WP (GPIO_OUTPUT | GPIO_INIT_LOW | GPIO_WP)
Thanks
JT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My GPIO configure is set as below
const BLE_PROFILE_GPIO_CFG homedoor_gpio_cfg =
{
{
GPIO_PIN_WP, // This need to be used to enable/disable NVRAM write protect
GPIO_PIN_BATTERY, GPIO_PIN_BUTTON, GPIO_PIN_LED, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // Other GPIOs are not used
},
/*.gpio_flag =*/
{
GPIO_SETTINGS_WP,
GPIO_SETTINGS_BATTERY, GPIO_SETTINGS_BUTTON, GPIO_SETTINGS_LED, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Tsung-Yu,
Try a different NV ID (use something other than VS_BLE_HOST_LIST – say 0x42).
Also trace I2C/SPI lines to make sure that it was written correctly and that nothing is read on start up
Thanks
JT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For some NV ID , you should wirte NVRAM more than once before you Read NVRAM.
I think but not sure :
"If it is not, it will not know what is the size for the ID."
?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Tsung-Yu,
1. You should only need to write NVRAM once
2. When you wrote to 0x42, what was the result?
3. If you are going to sleep immediately after writing, you can try inserting a 5mS delay after the write command and before entering Deep Sleep.
Sincerely,
JT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, when I download my program to the chip(737) it will erase the NVRAM.
after I wrote NVRAM(id=0x42) once, then Read and write NVRAM(id = 0x42) is OK.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Great!
Thanks,
JT