Hi
I’m developping with a Digi Connect ME DevKit (Connect ME JTAG).
I’m trying to write a simple char array into the last sector of flash (NVRAM), after the DevBoardParams. NAFlashWrite(…) returns me 0 (successful) and when I’m reading with NAFlashRead(…) the data is available. But when I reboot the device, the data is no longer there.
First I thought that the JTAG programmer erases the memory every download but then I flashed it (via FTP) and nothing changed.
What do I wrong?
In my application I poll for my switches on the GPIOs and depending on them I can read or write…
My simple testapplication:
int success;
unsigned long sectorNumber, sectorOffset;
char buffer[20];
…
//Write
sectorNumber = (NAFlashSectors() - 1); //last sector (34)
sectorOffset = sizeof (devBoardParamsType); //0x1038
memset ( (void*)buffer, 0, sizeof (buffer) );
strcpy (buffer, “Hello Flash-Test”);
success = NAFlashWrite (sectorNumber, sectorOffset, (sizeof (buffer) - 1), buffer, ALWAYS_ERASE);
printf ("Writing flash-data on sector %d, offset 0x%X : %d (0 = successful, -1 = unknown flash, -3 = write failed, -4 = verify failed)
", sectorNumber, sectorOffset, success);
printf ("Data: %s
", buffer);
…
//Read
sectorNumber = (NAFlashSectors() - 1); //last sector (34)
sectorOffset = sizeof (devBoardParamsType); //0x1038
memset ( (void*)buffer, 0, sizeof (buffer) );
success = NAFlashRead (sectorNumber, sectorOffset, (sizeof (buffer) - 1), buffer);
printf ("Reading flash-data from sector %d, offset 0x%X : %d (0 = successful, -1 = unknown flash, -5 = sectornr invalid, -6 = mem out of bound, -7 = sectoroffset invalid)
", sectorNumber, sectorOffset, success);
printf ("Data: %s
", buffer);
…