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

Piotr Szlachta pszlachta at supermedia.pl
Sun Nov 18 13:18:50 CET 2007


Hi.

A little around your qiery. 

http://usbdip.de/en/nutmmc/index.html

FAT16 on MMC for Ethernut1.

Regards
Piotr.

> -----Original Message-----
> From: en-nut-discussion-bounces at egnite.de [mailto:en-nut-discussion-
> bounces at egnite.de] On Behalf Of Joe Pepe
> Sent: Saturday, November 17, 2007 7:26 PM
> To: en-nut-discussion at egnite.de
> Subject: [En-Nut-Discussion] PHAT + mmc on Ethernut 1.3g
> 
> Hello.
> 
> 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 4.1.1.99 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
> fclose(MMC_stream);
> 
> MMC_stream = fopen("PHAT0:/simple.txt", "rb");
> cReaderName = NutHeapAlloc(ftell(MMC_stream)/1000);
> 
> 
> while (1)
> {
>      if ( (iResult = fgetc(MMC_stream)) == -1)
>     {
>         break;
>     }
>     else
>     {
>         if ( (iResult == 0x0D) || (iResult == 0x0A) || (iResult == 0) )
>     {
>     break;
>     }
>         else
>         {
>               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
> the
> configurator, both with no success.
> 
> Can PHAT work on 4.1.9.99 ?
> Is Per Eklund's code available anywhere ?
> Any other insight is much appreciated.
> 
> Thanks
> 
> Joe Pepe
> MSL Electronics
> 
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion




More information about the En-Nut-Discussion mailing list