[En-Nut-Discussion] Problems with PHAT on MMC with ethernut 3, NutOS 4.4.0

Ole Reinhardt ole.reinhardt at embedded-it.de
Tue Feb 12 01:59:59 CET 2008

Hi all,

I experienced several problems with the phat implementation of NutOS
4.4.0 on my ethernut 3 board.

This problem is realy quite urgent as I need a working phat fs for a
current customers project that needs to be finished in a few days.

I use the following setup:

NutOS 4.4.0
32 MB SD Card
Formated with vfat on a linux computer.
One partition.

Mounting the device is done like this:

mmc_volume = _open("MMC0:1/PHAT0", _O_RDWR | _O_BINARY);

later closed with:


1. Problem:

Reading the root directory seem to work, reading a just created
directory only shows:

Mounting mmc volume0, partition0 as PHAT filesystem... ok.
Filename: .
Filename: ..
Entry == NULL

Which meens that I only get the . and .. entry even if the directory is
full with files.

Here is the code:

    do {
        /* Read filenames and skip invalid filenames */

        entry = readdir(directory);
        if (entry != NULL) {
            INFO("Filename: %s\r\n", entry->d_name);
            if (entry->d_type != 0) continue;
    } while (entry != NULL);
    INFO("Entry == NULL\r\n");

2. Problem:

Trying to create a new directory corrupts the filesystem. Here is my code:

    if (mkdir(dirname, 0755) != 0) {
        ERROR("Could not create directory %s : error %d\r\n", dirname, errno);

I'll always get errno=17 independently if the directory just exists or
not. If it just exists, it will even exists after the call, but I can't
see any entries. If it does not exists in advance it will not be
created but corrupt the filesystem as well. A chkdsk (fsck.vfat on
linux) shows fixes several problems.

I found the following just closed bug in the tracker:


Anybody experienced similar problems?

Complete test code can be provided!

Thanks for any help,

Ole Reinhardt

|                                                             |
| Embedded-IT          Hard- und Softwarelösungen             |
|                                                             |
| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
| Germany              Web:         http://www.embedded-it.de |
|                      UstID / VAT:       DE198944716         |

More information about the En-Nut-Discussion mailing list