AnsweredAssumed Answered

RTOS SDCard USB and local access

Question asked by David Kaplan on Feb 25, 2019
Latest reply on Jun 3, 2019 by larry wei

I need to create a LPC54xxx project with FreeRTOS that in addition to serial USB, exposes its SDCard through USB after the user pushes a button. I also need the capability to locally read and write the SDCard. I saw the SDK example lpcxpresso54018_dev_composite_cdc_msc_sdcard_freertos but did not see any local write or read functionality. Can I somehow use the USB calls locally? When I tried just adding the fatfs files (may have not added all of them) the it takes a ton of ram - SRAMX:190540B 192KB 96.91%.  Is there a low ram RTOS example with fatfs that I could add the USB stuff? The project must use a lot of other resources including several non USB serial channels , ADC, PWM.




OK I ran the lpcxpresso54018_fatfs_sdcard () project on the LPCXpresso54018 board with a SDCard and it works fine.

I wanted to integrate this demo into my FreeRTOS code in a task for accessing the SDCard.

I copied the fatfs and sdmmc folders and compiled and saw that the sdmmc port was not for FreeRTOS so I copied the sdmmc port from the lpcxpresso54018_dev_composite_cdc_msc_sdcard_freertos() project.

I copied the pin initializations and run my test function ami_sdcard_Int().

It gets stuck in the SDMMC_GoIdle() function.


 if (f_mkfs(driverNumberBuffer, FM_ANY, 0U, work, sizeof work))
    if (kStatus_Success != SD_CardInit(&g_sd))
      if (SD_ProbeBusVoltage(card) == kStatus_SDMMC_SwitchVoltageFail)
        /* card go idle */
        if (kStatus_Success != SD_GoIdle(card))
        return SDMMC_GoIdle(card->host.base, card->host.transfer);
            if (kStatus_Success != transfer(base, &content))
            if ((error != kStatus_Success) ||
                (false == SDMMCEVENT_Wait(kSDMMCEVENT_TransferComplete, SDMMCHOST_TRANSFER_COMPLETE_TIMEOUT)) ||

It never returns from the SDMMCEVENT_Wait() function.


Could anyone please help me?


Both demo projects work separately lpcxpresso54018_fatfs_sdcard () & lpcxpresso54018_dev_composite_cdc_msc_sdcard_freertos()


Thank you