FATFS bogus Directory

From: Johannes Heusel (development_at_NO.narda-sts.SPAM.de)
Date: 04/28/04


Date: Wed, 28 Apr 2004 19:20:33 +0200

Hello,
We are using WinCE 4.2 and having problems with the flash file system. We use stratad.dll, mspart.dll to get a FATFS file system running. It still runs but sometimes we got a bogus directory after startup. We still work on, but if I try to save a dataset the CreateFile function does not give a invalid handle. So the dataset is not saved on disk but Create file returned with a valid handle. (see example below)
Also we use ScanVolumeEx and DefragVolumeEx functions from Fatutil.dll to check our file system. Those function tells no problem. But we still have. Also is the return value from DefragVolumeEx (DEFRAG_RESULTS including only SCAN_RESULTS)not actual. The values from dr.sr are the same as from a scan before doing defrag. So what could I do with that result? Is there any example code how to use the FATUTIL functions?
Before we power off the system we dismount all flash partitions and dismount the flash volume.
Then we do a hard power off, because we start our system always new(no changing registry)

Now my questions:
What went wrong that I get bogus directories?
How could I detect the bogus directory problem and how could I repair my files?
Why could ScanVolume not detect the bogus directories?
What happens if power fall down without dismounting all the Flash stuff and what could I do to prevent that?
Must I use the TFAT format, and when yes could I use the "old" formatted Volume without data lost?
Is it enough to dismount all flash stuff or must I do more than this?

A lot of question with the hope for a helpful answer
Johannes Heusel
Thanks!!

Debug trace:

906317 PID:edbb6efe TID:edbb62c2 0x8dbb7000: +SetMeasData (tsDATA_PARAM)
906320 PID:cdfe35a2 TID:edbb62c2 0x8dbb7000: FATFS!FindNext: bogus directory!
906320 PID:cdfe35a2 TID:edbb62c2 0x8dbb7000: FATFS!FAT_GetFileAttributesW(\000\040422142439-01.dat) returned 0xffffffff (13)
906321 PID:cdfe35a2 TID:edbb62c2 0x8dbb7000: FATFS!FindNext: bogus directory!
906356 PID:edbb6efe TID:edbb62c2 0x8dbb7000: -SetMeasData:eNO_ERR

Source code example:

  // create a new file.
  hFile = CreateFile(strFilePath, GENERIC_WRITE, 0,NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);

  if (hFile == INVALID_HANDLE_VALUE)
  {
    nErr = GetLastError();
    if (nErr != ERROR_FILE_EXISTS)
    {
      RETAILMSG(DEBUG_MEAS_API, (_T("-SetMeasData:eERR_ACCESS %d=GetLastError()\n"),nErr));
      return eERR_ACCESS;
    }
  }
//...rest of code



Relevant Pages

  • Re: New ARM Cortex Microcontroller Product Family from STMicroelectronics
    ... the bandwidth of the Flash memory. ... power to the peripherals, although since they are not performing work ... but only at higher frequencies when waitstates are used. ... benchmarks go twice as fast just because of hardware divide). ...
    (comp.arch.embedded)
  • Re: BIOS Flashing Fears....
    ... This failed flash rendered the ... Knowledge is power, which you appear to be short on. ... bed, taking a shower, installing a program, or flashing a BIOS. ... will not work again without replacing the chip that you were flashing. ...
    (microsoft.public.windowsxp.general)
  • Need Help - Computer Only Operatres (limited too!) in Safe Mode
    ... Computer and pointer froze so I held the power button down until it ... and flash the BIOS. ... control panel and use another computer here to research this error message ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: New ARM Cortex Microcontroller Product Family from STMicroelectronics
    ... and so the Flash requires wait states while taking advantage of the Harvard ... The power consumption is not great either, ... does not have a 0.5 mA/MHz slope. ... I think the lower mA/MHz at higher clock speeds reflects the ...
    (comp.arch.embedded)
  • Re: bargain 32-bit dsp shopping guide?
    ... The definition of "insane power consumption" is open for interpretation. ... It is nothing hard about it except you have to wait somewhat 1 minute for flash erase and the same time for flash program. ... DSP performance of the TMS28xx is comparable to that of a real DSP running at about 1/4 of its clock rate. ...
    (comp.dsp)