#6 LPC23x8 MCI interface support patch

open
nobody
None
5
2007-08-15
2007-08-15
No

Hi,

this patch implements the support for the dedicated MCI interface that can be found on the LPC2368, LPC2378 and also on the LPC24xx and LPC31xx. It should work with minor tweaks on all of these but it was tested only with the LPC2378.
Support for MMC cards and HCSD cards should be working, but I could only test it with SCSD cards.

Cheers,
Juri

Discussion

  • Juri Haberland

    Juri Haberland - 2007-10-03

    Logged In: YES
    user_id=105141
    Originator: YES

    I attached a patch to the lpc23x8.c file to fix the stalling writes. It was a wrong check for a timeout value and I also had to increase the timeout value to not abort on very slow writes.
    File Added: lpc23x8.patch2

     
  • hobiadami

    hobiadami - 2007-12-04

    Logged In: YES
    user_id=1951679
    Originator: NO

    hello,
    I'm also trying to implement a SD / MMC inferface on LPC2468 and looking for sample code.

    the download link doesn't seem to work.
    how can i dowload the files?
    thanks.

     
  • Nobody/Anonymous

    Logged In: NO

    Works for me. Just click on the words "download" on the right side of the page.

     
  • Nobody/Anonymous

    Logged In: NO

    Only patch and diff file is downloadable. Where is original file?
    Thx.

     
  • Juri Haberland

    Juri Haberland - 2008-03-14

    Logged In: YES
    user_id=105141
    Originator: YES

    It's on my laptop and in my non-public cvs repository. If you're not able to produce the files out of the diff and patch, then wait until Monday, as I plan to publish a new version over the weekend.

    Cheers,
    Juri

     
  • Juri Haberland

    Juri Haberland - 2008-03-30

    Logged In: YES
    user_id=105141
    Originator: YES

    File Added: efsl-0.2.8-lpc23x8.diff

     
  • Juri Haberland

    Juri Haberland - 2008-03-30

    Logged In: YES
    user_id=105141
    Originator: YES

    This new patch fixes a number of problems regarding writes. It includes some changes by Martin Thomas (see also http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/efsl_arm/index.html\).
    It furthermore includes fixes for the extraction of the card size.
    This patch to the original efsl-0.2.8 source tree supersedes all former patches that I published. It was tested with:

    SanDisk 128MB MMC
    Hama 128MB RS-MMC
    Hama 512MB MMCmobile
    noname 1GB SD
    noname 1GB microSD
    A-Data 4GB SDHC

    Have fun,
    Juri

     
  • Juri Haberland

    Juri Haberland - 2008-03-30

    revised patch for new LPC23x8 MCI support, obsoletes older patches

     
  • Juri Haberland

    Juri Haberland - 2008-03-30

    Logged In: YES
    user_id=105141
    Originator: YES

    File Added: efsl-0.2.8-lpc23x8.diff

     
  • Juri Haberland

    Juri Haberland - 2008-03-30

    LPC23x8 MCI support, stand-alone files, same as diff

     
  • Juri Haberland

    Juri Haberland - 2008-03-30

    Logged In: YES
    user_id=105141
    Originator: YES

    File Added: efsl-lpc23x8.tar.gz

     
  • Juri Haberland

    Juri Haberland - 2008-03-30

    Logged In: YES
    user_id=105141
    Originator: YES

    For all of those who want the "real files", not patches, I upload an archive with the files. It's equivalent to the patch (*.diff).

    Cheers,
    Juri

     
  • Nobody/Anonymous

    Logged In: NO

    Hey pktomo

    Thanks for your interface saved me alot of time, but I found a small bug in the mci_read_block function:

    /* read the data from the bus and store it in the buffer */
    count = 0;
    do {
    while ((MCI_STATUS & MCI_STAT_RX_DATA_AVLBL) && (count < (MMC_BLOCK_SIZE / sizeof(euint32)))) {
    ex_setb32(buf, count * 4, MCI_FIFO);
    count++;
    }
    } while (!(MCI_STATUS & (MCI_STAT_DATA_TIMEOUT | MCI_STAT_RX_OVERRUN | MCI_STAT_DATA_END | MCI_STAT_DATA_BLOCK_END)) && (count < (MMC_BLOCK_SIZE / sizeof(euint32))));

    In rare cases its posible to miss 1 read. If you exit the first loop and recives the last bytes of a block before the 2nd loop.

    A quick and dirty fix could be:

    count = 0;
    do {
    status = MCI_STATUS;
    while ((status & MCI_STAT_RX_DATA_AVLBL) && (count < (MMC_BLOCK_SIZE / sizeof(euint32)))) {
    ex_setb32(buf, count * 4, MCI_FIFO);
    count++;
    status = MCI_STATUS;
    }
    } while (!(status & (MCI_STAT_DATA_TIMEOUT | MCI_STAT_RX_OVERRUN | MCI_STAT_DATA_END | MCI_STAT_DATA_BLOCK_END)) && (count < (MMC_BLOCK_SIZE / sizeof(euint32))));

    But thank again for your interface.

    Best regards
    Jonad Christensen
    Denmark

     
  • Juri Haberland

    Juri Haberland - 2008-08-17

    Logged In: YES
    user_id=105141
    Originator: YES

    Hi Jonad,

    thanks for your comment. Yes, after looking twice at your patch I see now where the problem is and that your solution not really solves it (it might just get optimized away by the compiler).

    The right fix would be to ignore any of MCI_STAT_DATA_END or MCI_STAT_DATA_BLOCK_END if MCI_STAT_RX_DATA_AVLBL is set. I'll provide a fix for this in the next couple of weeks.

    Cheers,
    Juri

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks