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

Flash memory utilization

Dear Nordic Support Team,

I am trying to write some information in the flash memory without success. In the ble_flash.h file, it is specified that the pages 0-127 are reserved to the soft device. So, I can use the next page to store my data, am I right?

Can you tell me why the following code crash ?

uint32_t page = 128;

uint8_t word_count = 1;
uint32_t data_array[2]={0};

err_code = ble_flash_page_write(page,(uint32_t *) &data_array,1);
APP_ERROR_CHECK(err_code);
														
err_code = ble_flash_page_read(page, (uint32_t *) & data_array, &word_count);
APP_ERROR_CHECK(err_code);
Parents
  • Thanks for your answer.

    I have tried this code as you suggest, but it still doesn't work. I don't get any error number, the code just crash and I don't understand why.

    Could you have a look on my codebelow? I didn't find any example which explain how to use the flash memory in the SDK.

    Best regards

    uint32_t page = NRF_FICR->CODESIZE - 4;
    
    uint8_t word_count = 1;
    uint32_t data_array[2]={0};
    
    err_code = ble_flash_page_write(page,(uint32_t *) &data_array,1);
    APP_ERROR_CHECK(err_code);
    														
    err_code = ble_flash_page_read(page, (uint32_t *) & data_array, &word_count);
    APP_ERROR_CHECK(err_code);
    
Reply
  • Thanks for your answer.

    I have tried this code as you suggest, but it still doesn't work. I don't get any error number, the code just crash and I don't understand why.

    Could you have a look on my codebelow? I didn't find any example which explain how to use the flash memory in the SDK.

    Best regards

    uint32_t page = NRF_FICR->CODESIZE - 4;
    
    uint8_t word_count = 1;
    uint32_t data_array[2]={0};
    
    err_code = ble_flash_page_write(page,(uint32_t *) &data_array,1);
    APP_ERROR_CHECK(err_code);
    														
    err_code = ble_flash_page_read(page, (uint32_t *) & data_array, &word_count);
    APP_ERROR_CHECK(err_code);
    
Children
Related