This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

pstorage_store problem

Hi, I'm using nrf51822 board with SDK 10 and S110 softdevice. My application is based on uart over ble. It take 20 bytes data from a android device using nus, store that data and send a reply to the android that data is stored. First time when I store some data using pstorage_store(), It is stored successfully. Now second time I want to clear that data and store some new in place of that, so I first call pstorage_clear() and then again pstorage_store(). Now the problem arrived here, second time first 4 bytes becomes 0x0 and then remaining is my data. for example if my data is 12345678, it becomes like 00005678. I dont know what is going here. I'm using pstorage function like this and my function is defined in a pstorage_lock.c which is attached here. Please help me in this.

if(!pstorage_erase(0, 32))
{
	if(!pstorage_write(my_data, 0, 32))
	{
	 // some operation to do here
	}
}

my_data is an 20 bytes array in which data comes from android using nus.

Thanks. Amit

pstorage_lock.c

Related