[En-Nut-Discussion] PHAT + mmc on Ethernut 1.3g

Joe Pepe jpepe3 at comcast.net
Sat Nov 17 19:25:39 CET 2007


Per Eklund has working code to read/write an MMC card using version 
4.1.9-rc7 (Nut/OS  assumed).

I'm trying to read / write to an SD card using Nut/OS version but
I've read on an ethernut web page ( 
http://www.ethernut.de/en/documents/phat.html )
that version 4.2.1 or higher is required.

I presently can write and read a file on the card but subsequent to that my
program crashes.

Some of my code follows:

u_short *cReaderName = NULL;
int rrr, iResult;
int saved_memory_amount;

MMC_stream = fopen("PHAT0:/simple.txt", "w");            // Open file in 
write mode
fprintf(MMC_stream, "JCP: -- First line in this file\n");      // Write one 
line of text to file

MMC_stream = fopen("PHAT0:/simple.txt", "rb");
cReaderName = NutHeapAlloc(ftell(MMC_stream)/1000);

while (1)
     if ( (iResult = fgetc(MMC_stream)) == -1)
        if ( (iResult == 0x0D) || (iResult == 0x0A) || (iResult == 0) )
              cReaderName[rrr++] = iResult;

I get through this code once, then, on second call, program crashes.
I've spent many hours on this and trying to upgrade to Nut/OS 4.4.0 using 
configurator, both with no success.

Can PHAT work on ?
Is Per Eklund's code available anywhere ?
Any other insight is much appreciated.


Joe Pepe
MSL Electronics 

More information about the En-Nut-Discussion mailing list