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

flashwrite function not working in ble_app_uart

Hi, I am new to nrf.

 l am using nRF5_SDK_15.3.0_59ac345

I am working on the ble_app_uart example and want to write the data in the flash of nrf52832.

 I included flashwrite example in this also required libraries.

I made a below function for flashwrite

void add_flash_test()
{

  uint32_t f_addr = 0x0007f000; // Last page start address 127
  
  // Create a pointer to that address
  uint32_t * p_addr = (uint32_t *)f_addr; 

  // Create an array which will hold multiple words of data 
  //const uint32_t k[5] = {2342, 23423, 456, 457457, 7834};

  const uint8_t k[5] = {0x01, 0x02, 0x03, 0x04, 0x05};
  
  nrf_nvmc_page_erase(f_addr); // erase the page
  


  nrf_nvmc_write_bytes(f_addr,k, 5);

  // Read the flash word by word and display the data over log
  //for(int i = 0; i<5; i++)
  //{
  //  NRF_LOG_INFO("The Data read from flash is: %d", *(p_addr + i));

  //}

}

But i am not able to write into the flash.

Please help.

Thank you in advance.

Regards

Rajbir

Parents Reply Children
No Data
Related