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

Write in flash nrf52832 sdk 11s132 softdevice

Hi all,

i need to write in flash, and i try to use the example flash write of sdk. It works correctly but when i put it in my code, the writing register ( NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos);) failed.

The difference is that in my code i'm using the softdevice, how i can perform the write function in flash?

thanks, -Anna

Parents
  • You can't use those registers when the SoftDevice is present and enabled. I suggest you have a look at the fstorage and fds libraries.

  • This my code, and would use one page of flash to write a flag. I try to configuration for my application as:

    // Our fstorage configuration.
    FS_REGISTER_CFG(fs_config_t flashConfig) =
    {
        .p_start_addr = (uint32_t *)0x2FE00,
        .p_end_addr   = (uint32_t *)0x2FE10,
        .callback  = DRV_FLASH_Callback,
        .num_pages = 1,
        
        // We register with the highest priority in order to be assigned
        // the pages with the highest memory address (closest to the bootloader).
        .priority  = 0xFE
    };
    

    but when the fs_init is called the start and stop address is different how i expect, and the reason is that in fs_init the end address is end of flash and consider the page allocated calculated the start address...

Reply
  • This my code, and would use one page of flash to write a flag. I try to configuration for my application as:

    // Our fstorage configuration.
    FS_REGISTER_CFG(fs_config_t flashConfig) =
    {
        .p_start_addr = (uint32_t *)0x2FE00,
        .p_end_addr   = (uint32_t *)0x2FE10,
        .callback  = DRV_FLASH_Callback,
        .num_pages = 1,
        
        // We register with the highest priority in order to be assigned
        // the pages with the highest memory address (closest to the bootloader).
        .priority  = 0xFE
    };
    

    but when the fs_init is called the start and stop address is different how i expect, and the reason is that in fs_init the end address is end of flash and consider the page allocated calculated the start address...

Children
No Data
Related