Electronics > Microcontrollers

[SAM] "EEPROM" dealings

<< < (8/9) > >>

ataradov:
This is just a typo. You can at least download the vendor header files that have all those things enumerated. In most cases if there is a discrepancy between the datasheet and a header file, the header file is correct.

But also, what stops you from trying a few things and checking which one works? Even based on the info with a typo, there is only one reasonable assumption here. All you need is test it.

I don't understand the question about interrupt stuff. If the write completes in time before the power dies, then the data will be retained. If the write does not have enough time to complete, then it will not be preserved. The write takes time, it is not an instant process.

Simon:
i can't do a write from an interrupt routine. So I use the non maskable interrupt to do housekeeping when power is pulled and using capacitance it saves the data. But if I call my data saving from the interrupt routine it will not work. It does work if I set a flag instead and return to the main program where I see the flag and do a data save.

I have found that not always all values are written out in the header files. the files of the atmel start stuff I downloaded did but not the files called by including samc21.h, these tend to be a bit more minimal.

ataradov:
There is nothing special about running from the interrupt, so something is wrong with your code. Hard to tell what without looking at the code.

Simon:
Well same code, I can post something tomorrow, the same function to write to the NWM will run from the main program but not from the interrupt routine, so it is not the problem and everything else in the interrupt routine works so it does fire. I am writing to the main memory space not RWWEE, maybe that was partly the point of the RWWEE ?

ataradov:
Interrupt code is the same code. Nothing in the MCU state changes significantly when an interrupt is executed.

Writing main flash array by the code running from that flash will block execution for the duration of a write. But it should not cause any issues directly, all it will do is make the loop that waits for the flash ready bit run only once - it will block immediately after the command, and execution will unblock when the flash is ready.

Run it under the debugger and step though the code. What is the memory contents before and after the flash command is executed?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version