I have been asked to write an application to be able to change some variables during runtime and be able to store them in non-volatile memory (flash). I read the C8051f507 datasheet and the process to erase and write to flash looks really straightforward. My question is: How do I know which page to erase?
Thanks for your time,
Fer
... waiting for erase complete before writing?
I tried putting different delays in between function calls but I'm still seeing the same problem. I am suspecting that I am getting an undesirable reset right after the erase but I haven't been able to figure out why this is happening.
UPDATE
I used an oscilloscope to trace how far my code was getting an I found out that the processor resets right after
*pwrite = 0; // Initiate page erase
.
Does anybody has an idea why this is happening?
Thanks
Does anybody has an idea why this is happening? yes, your puppy bites, disable the watchdog - unless you can set the timeout long enough.
I tried putting different delays in between function calls does the chip you have not seen fit to reveale not have an "erase complete" flag. doing it with delays is not a good idea.
Since you have not revealed your chip, if it does not allow disabling the WD and you can not set a long enough time, you will need to run without it.
Erik