This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

page_erase() problem

I need to store my boards network ID into nonvolatile memory. I have been using the page_erase() and write_flash_chk():


page_erase(PAGE_START, 0xFF, FDM);
write_flash_chk(PAGE_START, NewAddr, FDM);


where
 PAGE_START = 0x0400 
and my timing is set up as

//FLASH WRITE CONFIGURATION
USEC = 0x0C;	//tFWT = 32.5 us
MSECH = 0x4E;	//MSEC for tFET = 10 ms
MSECL = 0x20;	// @32 MHz
FTCON = 0xFF;	//FWR = 0x0F & FER = 0x0F

That worked fine until I changed my Serial ISR to implement a ring buffer, which has nothing to do with my memory writing function.

I know it is diffucult to debug a problem without seeing the code, but can anyone suggest things to look out for or a better way to store variables in flash memory?

Thanks

Parents
  • Yes, if there's a region of CODE memory space that isn't available for running code out of it, somebody has to tell the linker about that. If the tools aren't doing it by themselves (--> check out the "use memory layout from target dialog button), you have to do it yourself.

    Are you sure the CODE space memory hole has to be at 0x0400? Can't you configure it to be at a more sensible place like, say, at the end of those 32 KiB, from 0x7c00 to 0x7fff?

Reply
  • Yes, if there's a region of CODE memory space that isn't available for running code out of it, somebody has to tell the linker about that. If the tools aren't doing it by themselves (--> check out the "use memory layout from target dialog button), you have to do it yourself.

    Are you sure the CODE space memory hole has to be at 0x0400? Can't you configure it to be at a more sensible place like, say, at the end of those 32 KiB, from 0x7c00 to 0x7fff?

Children