This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SNV Write Fails CC2541

Other Parts Discussed in Thread: CC2541

I am attempting to write to the flash memory of the CC2541 in the simple peripheral project. 

I am using the code below suggested in the following post: https://e2e.ti.com/support/wireless_connectivity/f/538/p/340456/1199663#1199663 

#define BLE_NVID_TEST 0x80
static uint32 iWrite = 0xcafe;
static uint32 iRead = 0x0;
uint8 w = osal_snv_write(BLE_NVID_TEST, sizeof( uint32 ), &iWrite );
uint8 s = osal_snv_read( BLE_NVID_TEST, sizeof( uint32 ), &iRead );

However the write call is failing. After a little bit of debugging it seems like the error is coming from the fact that failF is being set as true as part of the snv initailization. failsF is set as true in osal_snv.c in the function erasePage at

for (offset = 0; offset < OSAL_NV_PAGE_SIZE; offset ++)
{
HalFlashRead(pg, offset, &tmp, 1);
if (tmp != OSAL_NV_ERASED)
{
failF = TRUE;
break;
}
}

Ant advice on how to fix this issue would be greatly appreciated.