bleprofile_ReadNVRAM returns different value

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

In WICED_SMART_SDK 2.1.0,

I compared 2 applications, one is cycling_speed_cadence and the other is hello_sensor.

For both case, I put the following codes at the end of application_create().

UINT8 TestReadFlag1= 0x04;

UINT8 TestReadFlag2;

UINT8 TestReadFlag3;

bleprofile_WriteNVRAM(VS_BLE_HOST_LIST, sizeof(UINT8), (UINT8 *)&TestReadFlag1);

TestReadFlag3 = bleprofile_ReadNVRAM(VS_BLE_HOST_LIST, sizeof(UINT8), (UINT8*)&TestReadFlag2);

ble_trace2("TestReadFlag2 is %d, Read result is %d", TestReadFlag2, TestReadFlag3);

In cycling_speed_cadence, it worked properly.

TestReadFlag2 is 4, Read result is 1

but In hello_sensor, NVRAM read or write seem not to work properly.

the message was

TestReadFlag2 is 0, Read result is 0

Could you recommend which points I did wrong?

0 Likes
1 Solution
VikramR_26
Employee
Employee
25 sign-ins 10 sign-ins 10 comments on KBA

I realized you might have put the following piece of code

bleprofile_WriteNVRAM(VS_BLE_HOST_LIST, sizeof(UINT8), (UINT8 *)&TestReadFlag1);

TestReadFlag3 = bleprofile_ReadNVRAM(VS_BLE_HOST_LIST, sizeof(UINT8), (UINT8*)&TestReadFlag2);

ble_trace2("TestReadFlag2 is %d, Read result is %d", TestReadFlag2, TestReadFlag3);

before

bleprofile_GPIOInit(bleprofile_gpio_p_cfg);


Reason why it needs to be after this method is since GPIOInit enables the write protect for writing data in NVRAM.

I tried it and verified and it works on both hello_sensor and cycling_speed_cadence.

View solution in original post

2 Replies
VikramR_26
Employee
Employee
25 sign-ins 10 sign-ins 10 comments on KBA

I realized you might have put the following piece of code

bleprofile_WriteNVRAM(VS_BLE_HOST_LIST, sizeof(UINT8), (UINT8 *)&TestReadFlag1);

TestReadFlag3 = bleprofile_ReadNVRAM(VS_BLE_HOST_LIST, sizeof(UINT8), (UINT8*)&TestReadFlag2);

ble_trace2("TestReadFlag2 is %d, Read result is %d", TestReadFlag2, TestReadFlag3);

before

bleprofile_GPIOInit(bleprofile_gpio_p_cfg);


Reason why it needs to be after this method is since GPIOInit enables the write protect for writing data in NVRAM.

I tried it and verified and it works on both hello_sensor and cycling_speed_cadence.

Anonymous
Not applicable

I found the reason, I changed Port1 from GPIO_PIN_WP to commented.

Thank you.

0 Likes