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.
Thanks
=============================================================================
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.
ami_sdcard_Int()
--------------------------------
if (f_mkfs(driverNumberBuffer, FM_ANY, 0U, work, sizeof work))
sd_disk_initialize()
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)) ||
(!s_sdifTransferSuccessFlag))
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
David
解決済! 解決策の投稿を見る。
I finally found my problem. In the FreeRTOS converted version, you need to set the SD_HOST_IRQ Interrupt priority or the vPortValidateInterruptPriority() function will throw an assertion.
So I just added in the demo code's sdcardWaitCardInsert() function the following snippet before calling SD_HostInit():
#define SDCARD_DEVICE_INTERRUPT_PRIORITY 3
#if defined(__GIC_PRIO_BITS)
GIC_SetPriority(SD_HOST_IRQ, (SDCARD_DEVICE_INTERRUPT_PRIORITY - 1U));
#else
NVIC_SetPriority(SD_HOST_IRQ, (SDCARD_DEVICE_INTERRUPT_PRIORITY - 1U));
#endif
I finally found my problem. In the FreeRTOS converted version, you need to set the SD_HOST_IRQ Interrupt priority or the vPortValidateInterruptPriority() function will throw an assertion.
So I just added in the demo code's sdcardWaitCardInsert() function the following snippet before calling SD_HostInit():
#define SDCARD_DEVICE_INTERRUPT_PRIORITY 3
#if defined(__GIC_PRIO_BITS)
GIC_SetPriority(SD_HOST_IRQ, (SDCARD_DEVICE_INTERRUPT_PRIORITY - 1U));
#else
NVIC_SetPriority(SD_HOST_IRQ, (SDCARD_DEVICE_INTERRUPT_PRIORITY - 1U));
#endif
Hi David !
I have the same issues , but i add SD_HOST_IRQ Interrupt in my main function, but it still error,
I found this problem,
SD_CardInit() -> SD_ProbeBusVoltage() -> SD_SendInterfaceCondition() caused keep in this function "SD_ApplicationSendOperationCondition()" ,then sd_Init will error until timeout
Can you give me more information, Thx !!
Thank you for your input
Regards
Sol