KSDK 1.3 SDHC with FreeRTOS Heap1

cancel
Showing results for 
Search instead for 
Did you mean: 

KSDK 1.3 SDHC with FreeRTOS Heap1

374 Views
kyati
Contributor II

Hello all,

 

I am working with KDS 3.0 and Processor Expert linked to KSDK 1.3 to program a FRDM-K64F board. I am also using the FreeRTOS 8.2 and ChaN FATFS included with the KSDK 1.3. In my application, I plan to do long term datalogging and would prefer to use the heap_1 implementation (does not allow memory to be freed) from FreeRTOS to prevent fragmentation over time.

 

When running an SD card write example with the FATFS, the function "SDHC_DRV_IssueRequestBlocking()" is called from the SDHC driver (fsl_sdhc_driver.c) which allocates and frees memory for semaphores, which prevents the heap_1 implementation from being used. Is there any workaround to enable a non-blocking approach or a method to statically allocate the semaphore memory without changing the KSDK files and using FreeRTOS as the OS? If possible, I want to know if anything can work with the Processor Expert and KSDK.

 

Thanks,

 

Jared

Labels (1)
0 Kudos
1 Reply

151 Views
isaacavila
NXP Employee
NXP Employee

Hello Jared,

I've made a quick review on SDHC driver and it seems that you should modify SDHC driver in order to implement memory allocation scheme 1. There are semaphores that need to be freed so, in order to use scheme 1, you will need to change these semaphores and/or logic.

One possible workaround to use memory scheme 1 is to comment the BSP_FSL_SDHC_USING_IRQ and implement the polling logic in SDHC driver. This definition is located at: fsl_sdhc_driver.h in ksdk_freertos_lib_<MCU>.

Comment BSP_FSL_SDHC_USING_IRQ.jpg

I've tested this implementation on dev_msd_disk_freertos_frdmk64f project and it worked well.

I hope this can help you,

Best Regards,

Isaac

----------------------------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

----------------------------------------------------------------------------------------------------------------------------------------

0 Kudos