This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Getting FatFS to work with Keil toolchain and MCB2300 card

I've taken the code from the FatFS project ffsample/lcp23xx folder and ported the code to build using the Keil toolchain for the MCB2300.

Whatever I try it always seems to timeout in the send_cmd function in mmc_lpc23xx_mci.c

This is my code to initialise the MCI interface.

Has anyone "been there, done that, fixed the problems?"

My code to initialise the MCI "stuff" is here:

static void power_on (void)
{
    /* Enable MCI and GPDMA power */
    __set_PCONP(PCSDC|PCGPDMA);

    /* Enable GPDMA controller with little-endian */
    GPDMA_CH0_CFG &= 0xFFF80000;    /* Disable DMA ch-0 */
    GPDMA_CONFIG = 0x01;

    /* Select PCLK for MCI, CCLK/1 = 72MHz */
    PCLKSEL1 |= (PCLKDIV_1 << PCLK_MCI);

    /* Attach MCI to I/O pad */
    PINSEL0 |= (2<<19);        /* MCICLK -> P0.19 */
    PINSEL0 |= (2<<20);        /* MCICMD -> P0.20 */
    PINSEL0 |= (2<<21);        /* MCIPWR -> P0.21 */
    PINSEL0 |= (2<22);        /* MCIDAT0 -> P0.22 */
    PINSEL2 |= (2<<11);        /* MCIDAT1 -> P2.11 */
    PINSEL2 |= (2<<12);        /* MCIDAT2 -> P2.12 */
    PINSEL2 |= (2<<13);        /* MCIDAT3 -> P2.13 */

    MCI_MASK0 = 0;
    MCI_COMMAND = 0;
    MCI_DATA_CTRL = 0;

    /* Register interrupt handlers for MCI,DMA event */
    RegisterIrq(MCI_IRQn, Isr_MCI, PRI_LOWEST-1);
    RegisterIrq(GPDMA_IRQn, Isr_GPDMA, PRI_LOWEST-1);

    /* Power-on (VCC is always tied to the socket on this board) */
    MCI_POWER = 0x01;                    /* Socket power on */
    for (Timer1 = 10; Timer1; ) ;    /* 10ms */
    MCI_POWER = 0x03;                    /* Enable signals */
}


Thanks, David

Parents Reply Children
No data