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

Able to write only one time in NVMC

Hi ,

Here is my code used to write in to non volatile memory.

#include "nrf.h" //#include "uicr_config.h" #include <stdint.h> #include <stdbool.h> #include "nrf_nvmc.h"

int main(void) {

			uint32_t     address   =  0x10001088;
			uint32_t     value       =  0x13345652;
			uint32_t     b            =   0;
			nrf_nvmc_write_word(address,	value);

			b = *(uint32_t *)address;
			
			//nrf_nvmc_write_word(address+12,	b);
			while (true)
			{
						/* Do nothing */
			}

}

But for first time i able to see the data whatever i have written in memory.

But if i change the value, i cant see the changed data. it remains as old data.

means i am not able to write one more time.

i check by reset the device also , but not able to write.

but if increase address value to 4 more bytes, i am able to write data in new address.

Kindly suggest me, where i am wrong.

Regards Balaji

Parents
  • Hi Ole,

    I tried by erasing also but not yet worked.

    Here is my code :

    #include "nrf.h" //#include "uicr_config.h" #include <stdint.h> #include <stdbool.h> #include "nrf_nvmc.h"

    int main(void) {

    			uint32_t address = 0x1000108C;
    			uint32_t value   = 0x13345653;
    			uint32_t b=0;
    			
    			nrf_nvmc_page_erase(address);
    			nrf_nvmc_write_word(address,	value);
    
    			b = *(uint32_t *)address;
    			
    			//nrf_nvmc_write_word(address+12,	b);
    			while (true)
    			{
    						/* Do nothing */
    			}
    

    }

    Regards Balaji

Reply
  • Hi Ole,

    I tried by erasing also but not yet worked.

    Here is my code :

    #include "nrf.h" //#include "uicr_config.h" #include <stdint.h> #include <stdbool.h> #include "nrf_nvmc.h"

    int main(void) {

    			uint32_t address = 0x1000108C;
    			uint32_t value   = 0x13345653;
    			uint32_t b=0;
    			
    			nrf_nvmc_page_erase(address);
    			nrf_nvmc_write_word(address,	value);
    
    			b = *(uint32_t *)address;
    			
    			//nrf_nvmc_write_word(address+12,	b);
    			while (true)
    			{
    						/* Do nothing */
    			}
    

    }

    Regards Balaji

Children
Related