This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP432E401Y: NVS: FlashErase fails with -1

Part Number: MSP432E401Y
Other Parts Discussed in Thread: SYSCONFIG,

My objective is to reserve the last part of MSP432E401Y's internal flash memory to store some data. In sysconfig, I have set:

  • Region type: Pointer
  • Region base: 0x1FFC000
  • Region size: 0x4000
  • Sector size: 0x4000

NVS_open provides a pointer and the NVS_Attrs correspond to the settings from sysconfig. However, I receive "-1" for any erase or write operation. The debugger shows that the problem is the "FlashErase" function using 0x1FFC000 as sector base and returning -1 which is then passed to either NVS_erase or NVS_write (with erase and write flag set).

Am I missing anything? Do I need to unlock the memory area somehow?

I am attaching below the cmd file in case it may be useful.

Thank you and regards
Peter

#define APP_BASE 0x00000000 // 0
//#define APP_BASE 0x0000A000 // Low
//#define APP_BASE 0x00080000 // High

MEMORY
{
    FLASH (RX) : origin = APP_BASE, length = 0x000FC000
    SRAM (RWX) : origin = 0x20000000, length = 0x00040000
}

/* Section allocation in memory */

SECTIONS
{
    .text   :   > FLASH
    .const  :   > FLASH
    .rodata :   > FLASH
    .cinit  :   > FLASH
    .pinit  :   > FLASH
    .init_array : > FLASH

    .TI.ramfunc : {} load=FLASH, run=SRAM, table(BINIT)
    .data   :   > SRAM
    .bss    :   > SRAM
    .sysmem :   > SRAM

    /* Heap buffer used by HeapMem */
    .priheap   : {
        __primary_heap_start__ = .;
        . += HEAPSIZE;
        __primary_heap_end__ = .;
    } > SRAM align 8

    .stack  :   > SRAM (HIGH)
}