Open ChrisAtSamraksh opened 8 years ago
but when run from within Visual Studios it will not actually erase the NOR.
Just a minor thing, but in the code bool eraseDataStore = false
is set to false. Did you set it to true when running from Visual Studio?
I tested a number of combinations of: DataStore.Instance(StorageType.NOR, eraseDataStore); and dStore.DeleteAllData();
I never could get the NOR to erase under VS even if I set (eraseDataStore = true) and I used dStore.DeleteAllData().
If I stopped debugging under VS and connected MFDeploy and hit the reset button on the .NOW then the NOR would be erased every time and only experimentIndex records written. Or if I stopped debugging and hit the reset on the .NOW and then started debugging under VS, then the NOR would have 2*experimentIndex records written (the experimentIndex records from after the reset button and the experimentIndex records from running VS).
If I run code that is supposed to erase the NOR initially and then writes and reads data to the NOR it seems to behave fine when run from MFDeploy but when run from within Visual Studios it will not actually erase the NOR. The new data will be appended to the end of the previous data and everything can be read out after that. There are probably other issues when running from within Visual Studios in relation to the DataStore because often my code will fail again and again and then later seem to work fine. I think what was happening is that I was running from within VS and at some point I ran a test from the TestRig which seems to fix the problem, so the next time I run under VS the code works.
My guess is that NOR corruption also can't be fixed until the code is run outside VS, but hopefully fixing the inability to erase the NOR from within VS fixes the possible corruption problem.
The code I used to test is: using System; using Microsoft.SPOT; using Samraksh.eMote.NonVolatileMemory;
namespace test { public class Program { public static void Main() { try { UInt16 experimentIndex; UInt16 size; DataStore dStore; byte[] writeBuffer; byte[] readBuffer; DataReference[] data; DataReference[] dataObj; int errorCounter = 0, errorLimit = 10; DataStoreReturnStatus _retVal;
}