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

FSD Flash device information

Hi Team

Can I change the program_unit in below code? If Yes, what is the rule for this variable? Can I set it to 1? Thank you.

/* Flash device information. */
static nrf_fstorage_info_t m_flash_info =
{
#if   defined(NRF51)
    .erase_unit   = 1024,
#elif defined(NRF52_SERIES)
    .erase_unit   = 4096,
#endif
    .program_unit = 4,
    .rmap         = true,
    .wmap         = false,
};

Regards

Victor

  • Hi Victor, 

    program_unit is the Size of the smallest programmable unit (in bytes).

    I think you can set it to 1, but Please be aware that When you modify program_unit value, it will affect the length passed to nrf_fstorage_write(), so the size must be a multiple of program_unit (default valuse is 4), the  NRF_FSTORAGE_PARAM_CHECK(!(len % p_fs->p_flash_info->program_unit), NRF_ERROR_INVALID_LENGTH); check will fail otherwise.

    /* Length must be a multiple of the program unit. */
        NRF_FSTORAGE_PARAM_CHECK(!(len % p_fs->p_flash_info->program_unit), NRF_ERROR_INVALID_LENGTH);

    Please note that due to the Easter holiday, we're low on staff, so somewhat lower response times must be expected until April 6th. Sorry about the inconvenience.

    -Amanda H.

Related