AnsweredAssumed Answered

Reading wave file from SD card using FRDM k64F in MQX

Question asked by OLIVIA CHRISTY VARGHESE on Feb 7, 2017
Latest reply on Feb 9, 2017 by soledad

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

Outcomes