µTasker Forum

µTasker Forum => Luminary Micro TM LM3SXXXX => Topic started by: Adrian on May 11, 2010, 12:07:01 PM

Title: Erase internal Flash
Post by: Adrian on May 11, 2010, 12:07:01 PM
Hi Mark
I saw that sometimes when some file is open, and device has been reseted, after that , this file is full of '.' and the size of this file is about 0.5 Mb.
I am wondering, is there any procedure in uTasker to erase all internal Flash memory?
Title: Re: Erase internal Flash
Post by: mhoneywill on May 11, 2010, 02:13:48 PM
If you are talking about the simulator just delete the file "FLASH_LM3SXXXX.ini" and this will erase the simulators copy of the chips Flash memory.

Hope this helps

Martin
Title: Re: Erase internal Flash
Post by: Adrian on May 11, 2010, 05:16:23 PM
no i am thinking about my personal device, i saw that sometimes on the flash are creating files like ~?.??? or ".???, i just wanna erase all, because the is no way to remove file with name like ~?.???
Title: Re: Erase internal Flash
Post by: mark on May 11, 2010, 06:37:35 PM
Hi

Data in the file system area (non-0xff) is being seen as files and content - this is not normal and so you will need to also work out why it can occur.

You can delete the complete content by erasing the chip (full erase). When working with the project and using FTP you can also use the FTP command FTP *.*. This is used a bit differently to a normal wild-card delete; instead it performs an erase of the complete file system area. This will ensure that all of the internal memory in this area is then blank (0xff).

Regards

Mark
Title: Re: Erase internal Flash
Post by: Adrian on May 11, 2010, 07:47:10 PM
right, but there is no any procedure to erase internal flash when device is working? like if  device sends to my server some post and i respond to delete all conten, i am wondering , how to eraase all content including all files and sites and each files on interanl flash?
Title: Re: Erase internal Flash
Post by: mark on May 11, 2010, 09:27:30 PM
Hi Adrian

If you can get the application to recognise a command to delete the file system you can use the following call to do it:

uFileErase(uFILE_SYSTEM_START, (MAX_FILE_LENGTH)FILE_SYSTEM_SIZE);

Regards

Mark

Title: Re: Erase internal Flash
Post by: Adrian on May 12, 2010, 11:33:35 AM
Hi Mark, to be honest , this function does not remove all files. I mean, all with known names and extensions are removed, but if i copy to device this specific file which screen i atatched below, this single file will not be deleted. Is there any other option to remove all under application? i can remove this file using ftp.

(http://imgur.com/6ba84.jpg)
Title: Re: Erase internal Flash
Post by: mark on May 12, 2010, 07:52:39 PM
Hi Adrian

The command doesn't work with files. It works with a memory area beginning with a defined address and with a defined size. Therefore it should delete all file system content.

If you are seeing other files there must be another reason for this, although I can't explain it at the moment. However check carefully the file system definition to ensure that it is not overlapping with code (for example). Also check that these are not somehow being displayed from the user file system (note that user files are marked as read only when viewed via FTP so can be quite easily distinguished).

1) Can you run the same program with the simulator and do you get the same or different results?
2) Could you tell me which part you are using and send me your binary file so that I can test this (I have most of the Luminary Micro boards to test on) - tell me also how I should test it to reproduce the problem.

Regards

Mark

Title: Re: Erase internal Flash
Post by: Adrian on May 13, 2010, 07:40:50 AM
Hi Mark
1.) I am not using symulator at all.
2.) there is no way to send you this strange file or bin, couse this file has 138 kb and bin has 144 kb, and you allow to attach files only under 128 sieze, is there any other option to send it to you?
Title: Re: Erase internal Flash
Post by: mark on May 13, 2010, 01:28:07 PM
Hi Adrian

If you zip them it should be OK.
Else please send it to my email address.

Regards

Mark
Title: Re: Erase internal Flash
Post by: Adrian on May 13, 2010, 05:56:01 PM
I atached this strage file, when you copy this file using ftp to flash memory, there is no way to remove it under application. This file has been created when application was working, so there is bug on my site, but it shoud be way to remove it, i cant find the way:(, maby in the future it will be create again so strange file, so i am looking method to remove all files in flash including those strange i attached.
Title: Re: Erase internal Flash
Post by: Adrian on May 14, 2010, 05:21:46 PM
Ok Mark , i checked a lot of things, and this are my conclusion:

first i need to claryfi that i need to clean exteranl SPI flash but as u told me uFileErase(uFILE_SYSTEM_START, (MAX_FILE_LENGTH)FILE_SYSTEM_SIZE); should do excatly what i want, cos:
uFILE_SYSTEM_START is
#define uFILE_SYSTEM_START (MEMORY_RANGE_POINTER)(uFILE_START)
and uFILE_START is #define uFILE_START (SPI_FLASH_START)

FILE_SYSTEM_SIZE is  #define FILE_SYSTEM_SIZE (128*SINGLE_FILE_SIZE)
and SINGLE_FILE_SIZE is  #define SINGLE_FILE_SIZE (FILE_GRANULARITY)
and FILE_GRANULARITY is #define FILE_GRANULARITY (2*SPI_FLASH_BLOCK_LENGTH)      // (2 x 4096 byte blocks)

it shoud remove all files on external SPI flash, but i doesn't. This line uFileErase(uFILE_SYSTEM_START, (MAX_FILE_LENGTH)FILE_SYSTEM_SIZE); removes only some part of data and then device is reseting. i Know that in fnEraseFlashSector is WDTICR = 0; but it seems that it is in wrong place. My SPI flash is 1MB big. When i copy to device some files which size is more than 200 kB, not all will be removed and watchdog will reset device. BUT when i turn off watchdog (i use contruction like belove):
            WDTLOCK = WD_ACCESS;
            WDTCTL &= ~(WD_RESEN | WD_INTEN);                                      // disable watchdog and interru
            uFileErase(uFILE_SYSTEM_START, (MAX_FILE_LENGTH)FILE_SYSTEM_SIZE);
            WDTCTL = (WD_RESEN | WD_INTEN);                                        // enable watchdog and interrupt
            WDTLOCK = 0;
removing files takes like 7 second, but all filles will be removed then, i am wondering , why i need to turn off watchdog, if there is WDTICR = 0; in a loop.

device is not reseting then but is strange problem , that it lose connection but as i sad then delete all files.