Please refer to OSAL API pdf. There is a range of ID's which can be used for your applications to store data in. Others are reserved or used by the stack or ble platform.
Usable ID's are in range:
0x80 - 0xFE
When you run this code on BLE112 (or other cc2540 128kb version):
uint8 array[]={0,1,2,3,4,5,6,7,8,9};
uint8 read_array[10];
uint8_t result = osal_snv_write(0x80,6,array);
You will receive NV_OPER_FAILED in result. Same result when trying to read using osal_snv_read.
After some digging around net I found explanation. Code provided in sample applications (ie. SimpleBLEPeripheral) and HAL subsystem was designed to run on 256kb chip.
One file need to be fixed to use osal_snv read/write functions properly.
Search for hal_board_cfg.h file, look for code shown below:
// NV page definitions must coincide with segment declaration in project *.xcl file.
#if defined NON_BANKED
#define HAL_NV_PAGE_END 30
#elif defined HAL_BOARD_CC2541S
#define HAL_NV_PAGE_END 125
#else
#define HAL_NV_PAGE_END 126
#endif
change it to :
// NV page definitions must coincide with segment declaration in project *.xcl file.
#if defined NON_BANKED
#define HAL_NV_PAGE_END 30
#elif defined HAL_BOARD_CC2541S
#define HAL_NV_PAGE_END 125
#elif defined HAL_BOARD_128K
#define HAL_NV_PAGE_END 62
#else
#define HAL_NV_PAGE_END 126
#endif
and add HAL_BOARD_128K to your preprocessor settings:
1 comment:
Thank You? sebrico!
Anton Khazov
Post a Comment