cortex-m0+ ATSAMC21 nvm bad read after init or erase

0

after an erase when I read the same adresse like 0x100 (a row) value, the 4th first values are 0x00000000 or sometimes 0x1fffffff instead of 0xffffffff. I should read these 4th word once more to have the good value.

Why?

Here is my flash nvm init

struct nvm_config nvm_cfg;

nvm_get_config_defaults(&nvm_cfg);
nvm_cfg.sleep_power_mode = NVMCTRL_CTRLB_SLEEPPRM_WAKEUPINSTANT_Val;
nvm_cfg.manual_page_write=false;
nvm_cfg.wait_states=0x8;
nvm_cfg.cache_readmode = NVM_CACHE_READMODE_DETERMINISTIC;
nvm_set_config(&nvm_cfg);



struct nvm_fusebits nvm_fuse;
nvm_get_fuses(&nvm_fuse);

if(nvm_fuse.wdt_always_on==true)
{
    nvm_fuse.wdt_always_on=false;
    nvm_fuse.wdt_enable=false;
    nvm_set_fuses(&nvm_fuse);
}

I tryed to whith the defaut value init :

static inline void nvm_get_config_defaults(
struct nvm_config *const config)
{
/* Sanity check the parameters */
Assert(config);

/* Write the default configuration for the NVM configuration */
config->sleep_power_mode  = NVM_SLEEP_POWER_MODE_WAKEONACCESS;
config->manual_page_write = true;
config->wait_states       = NVMCTRL->CTRLB.bit.RWS;
config->disable_cache     = false;
#if (SAMC20) || (SAMC21)
config->disable_rww_cache = false; //false=> disable_cache=2 et a 2 ou 3 bug errata
#endif
config->cache_readmode    = NVM_CACHE_READMODE_NO_MISS_PENALTY;
}

Is there a method to bypass this, or is there a best config? Thank you!

flash
cortex-m
errata
asked on Stack Overflow Jun 13, 2018 by TM_embbeded • edited Apr 25, 2019 by artless noise

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0