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

nrf_nvmc_write_words seems to crash on me.

Hey, there.

I'm trying to use the NVMC to give me some persistent memory. I call init first, reads seem to work fine, but writes just don't seem to work.

So to the best of my knowledge, I have 512k of flash, so it goes from 0 to 0x80000. My image stops far below, so I thought I'd use the last 8k as my own playground.

Inside the project file, I found this setting:

linker_section_placement_macros="  ... FLASH_START=0x26000;FLASH_SIZE=0x5A000

so I reduced it to

linker_section_placement_macros=" ... FLASH_START=0x26000;FLASH_SIZE=0x58000

hoping that this would mean the image wouldn't interfere with my memory.

I use SDK15.0.0. The subroutine I'm going into is

void nrf_nvmc_write_words(uint32_t address, const uint32_t * src, uint32_t num_words)
{
    uint32_t i;

    // Enable write.
    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen;
    __ISB();
    __DSB();

    for (i = 0; i < num_words; i++)
    {
        ((uint32_t*)address)[i] = src[i];
        wait_for_flash_ready();
    }

    NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren;
    __ISB();
    __DSB();
}


in nrf_nvmc.c.

address here is 0x7E000, src is 0x20007ff7c which looks right, and num_words is 1.

From single stepping it looks as if it crashes on the __ISB() call.

What am I missing here?

Regards,

Dan
Parents Reply Children
Related