Hi folks,
I am working on ble_app_uart example program nRF52 SDK 15.2 Verion , in this case i am writing the data in flash for future use , Now i am to get the specific data from flash, how to do that?
guide me
Hi folks,
I am working on ble_app_uart example program nRF52 SDK 15.2 Verion , in this case i am writing the data in flash for future use , Now i am to get the specific data from flash, how to do that?
guide me
Hi
That would be the function below. Then you can add a few lines to print the data using I.E. NRF_LOG_INFO to print the data you've just read.
static uint32_t number;
ret_code_t rc = nrf_fstorage_read(
&my_instance, /* The instance to use. */
FLASH_ADDR, /* The address in flash where to read data from. */
&number, /* A buffer to copy the data into. */
sizeof(number) /* Lenght of the data, in bytes. */
);
if (rc == NRF_SUCCESS)
{
/* The operation was accepted. */
}
else
{
/* Handle error.*/
}
Best regards,
Simon
Hi
That would be the function below. Then you can add a few lines to print the data using I.E. NRF_LOG_INFO to print the data you've just read.
static uint32_t number;
ret_code_t rc = nrf_fstorage_read(
&my_instance, /* The instance to use. */
FLASH_ADDR, /* The address in flash where to read data from. */
&number, /* A buffer to copy the data into. */
sizeof(number) /* Lenght of the data, in bytes. */
);
if (rc == NRF_SUCCESS)
{
/* The operation was accepted. */
}
else
{
/* Handle error.*/
}
Best regards,
Simon
char *name[80]="hello";
char newname[80];
rc = nrf_fstorage_write(&fstorage, 0x3f000, name, sizeof(name), NULL);
APP_ERROR_CHECK(rc);
printf("Write data \"%s\" to flash.\n", name);
rc = nrf_fstorage_read(&fstorage, 0x3f000,&newname, sizeof(newname));
APP_ERROR_CHECK(rc);
printf("read data \"%s\" to flash.\n", &newname);
wait_for_flash_ready(&fstorage);
In this above case, i can't able to print the read data , tell me if i have done any mistake. my code is correct or not