Reading wave file from SD card using FRDM k64F in MQX

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reading wave file from SD card using FRDM k64F in MQX

2,127 Views
oliviachristyva
Contributor III

Hi guys,

I want to read a wave file from the SD card . I am using MFS and my installation was successful I was able to detect the SD card . But now I want to write a code to open it and read a wave file. I have the USB code with me. But i dont know how to find the file path for sd card .

I have this code to read from USB

int error_code = MFS_NO_ERROR;
MFS_SEARCH_DATA search_data;
MFS_SEARCH_PARAM search;
char filepath [6] = "*.*";
MQX_FILE_PTR fs_ptr = NULL;
fs_ptr = _io_get_fs_by_name("a:");
search.ATTRIBUTE = MFS_SEARCH_ANY;
search.WILDCARD = (char *)&filepath;
search.SEARCH_DATA_PTR = &search_data;
//error_code = _io_ioctl(fs_ptr, IO_IOCTL_FIND_FIRST_FILE,(uint_32*)&search);
//while (error_code == MFS_NO_ERROR)
//{
/**********************File List in the USB*************************

printf ("%-12.12s %6lu %02lu-%02lu-%04lu %02lu:%02lu:%02lu\n",
search_data.NAME,
search_data.FILE_SIZE,
(uint_32)(search_data.DATE & MFS_MASK_MONTH) >>MFS_SHIFT_MONTH,
(uint_32)(search_data.DATE & MFS_MASK_DAY) >>MFS_SHIFT_DAY,
(uint_32)((search_data.DATE & MFS_MASK_YEAR) >>MFS_SHIFT_YEAR) + 1980,
(uint_32)(search_data.TIME & MFS_MASK_HOURS) >>MFS_SHIFT_HOURS,
(uint_32)(search_data.TIME & MFS_MASK_MINUTES) >>MFS_SHIFT_MINUTES,
(uint_32)(search_data.TIME & MFS_MASK_SECONDS) << 1);
error_code = _io_ioctl(fs_ptr, IO_IOCTL_FIND_NEXT_FILE,(uint_32*)&search_data);

**********************************************************************/
// }

Please help

Thanks and Regards

Olivia

0 Kudos
1 Reply

533 Views
soledad
NXP Employee
NXP Employee

Hi Olivia,

You can use as reference the sai_dma_demo example located at the path ...Freescale_MQX_4_2\mqx\examples\sai_dma_demo\

In addition please check the below thread: https://community.nxp.com/thread/335532 

I hope this helps,

Have a great day,
Sol

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

0 Kudos