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

nrf52832 flash erase

HI,All

Before I erase flash ,I must do memcpy().  I do not know why.

As follow,  after i delete the function memcpy( (uint8_t*)&data_buff[0], pdata, len),  when i write data[8]={0x01,02,03,04,05,06,07,08} to flash, I see the memory is 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 by debug.

Can you tell me why i must do memcpy();

I use sdk 12.3 ,  fs to do the flash reading and writing.

Thanks.

void my_fs_update(uint8_t * pdata, uint16_t len)
{
	fs_ret_t ret;
	
	len = len>8?8:len;
	
	memcpy( (uint8_t*)&data_buff[0], pdata, len);
	
	ret = fs_erase(&fs_config, fs_config.p_start_addr, 1, NULL);
	
	if ( FS_SUCCESS != ret )
	{
		printf("fs erase err\r\n");
	}
}

Amy

Parents Reply Children
No Data
Related