cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Smart Bluetooth

user_2195381
New Contributor II

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 ?

0 Likes
1 Solution
Anonymous
Not applicable

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

View solution in original post

9 Replies
BoonT_56
Employee

the below thread dwells specifically into the access of the nvram...

WICED Smart BCM92073X NVRAM Access

0 Likes
user_2195381
New Contributor II

My issus is

if I have not  used  bleprofile_WriteNVRAM yet, bleprofile_ReadNVRAM will be error?

0 Likes
Anonymous
Not applicable

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

0 Likes
user_2195381
New Contributor II

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

    }

};

0 Likes
Anonymous
Not applicable

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

0 Likes
user_2195381
New Contributor II

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."

?

0 Likes
Anonymous
Not applicable

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

View solution in original post

user_2195381
New Contributor II

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

0 Likes
Anonymous
Not applicable

Great!

Thanks,

JT

0 Likes