Platform : MQX 4.0.2
controller : K60
USing the example code of SD card drom path /mfs/examples/sd card .
dev_handle1 = fopen("sdcard:", 0);
if ( dev_handle1 == NULL ) {
printf("\nUnable to open SD card device");
_task_block();
}
/* Install MFS: */
error_code = _io_mfs_install(dev_handle1, "a:", 0);
if ((error_code != MFS_NO_ERROR) &&
(error_code != MFS_NOT_A_DOS_DISK)) {
printf("FATAL error while initializing: \n");
_mqx_exit(1);
} else {
printf("Initialized MFS1%s\n");
}
//open filse system
file_handle=fopen("a:",NULL);
The task is getting a error of MFS READ fault , checked the user guide of MFS which means low level driver is not respondin properly . so please let me know anybody faced same issue how to resolve it
is they any CLOCK issue which is going on SDHC CLK pin .
have you solved this problem? I met the same issue as you.
Hi,
Are you using a Freescale board (twrk60d100m, twrk60f120m or twrk60n512) ?
Could you please attach the complete code that you modified?
Have a great day,
Regards
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi soledad
We are using twrk60d100m tower kit , also we are trying on customised board using K60 with SD card support
if (last != inserted)
{
last = inserted;
if (inserted)
{
_time_delay (200);
/* Open the device which MFS will be installed on */
sdcard_handle = fopen("sdcard:", 0);
if (sdcard_handle == NULL) {
printf("Unable to open SD card device.\n");
continue;
}
/* Set read only flag as needed */
param = 0;
if (readonly)
{
param = IO_O_RDONLY;
}
if (IO_OK != ioctl(sdcard_handle, IO_IOCTL_SET_FLAGS, (char_ptr) ¶m))
{
printf("Setting device read only failed.\n");
continue;
}
/* Install partition manager over SD card driver */
error_code = _io_part_mgr_install(sdcard_handle, partman_name, 0);
if (error_code != MFS_NO_ERROR)
{
printf("Error installing partition manager: %s\n", MFS_Error_text((uint_32)error_code));
continue;
}
/* Open partition */
partition_handle = fopen(partition_name, NULL);
if (partition_handle != NULL)
{
printf("Installing MFS over partition...\n");
/* Validate partition */
error_code = _io_ioctl(partition_handle, IO_IOCTL_VAL_PART, NULL);
if (error_code != MFS_NO_ERROR)
{
printf("Error validating partition: %s\n", MFS_Error_text((uint_32)error_code));
printf("Not installing MFS.\n");
continue;
}
/* Install MFS over partition */
error_code = _io_mfs_install(partition_handle, filesystem_name, 0);
if (error_code != MFS_NO_ERROR)
{
printf("Error initializing MFS over partition: %s\n", MFS_Error_text((uint_32)error_code));
}
} else {
printf("Installing MFS over SD card driver...\n");
/* Install MFS over SD card driver */
error_code = _io_mfs_install(sdcard_handle, filesystem_name, (_file_size)0);
if (error_code != MFS_NO_ERROR)
{
printf("Error initializing MFS: %s\n", MFS_Error_text((uint_32)error_code));
}
}
/* Open file system */
if (error_code == MFS_NO_ERROR) {
filesystem_handle = fopen(filesystem_name, NULL);
error_code = ferror(filesystem_handle);
if (error_code == MFS_NOT_A_DOS_DISK)
{
printf("NOT A DOS DISK! You must format to continue.\n");
}
else if (error_code != MFS_NO_ERROR)
{
printf("Error opening filesystem: %s\n", MFS_Error_text((uint_32)error_code));
continue;
}
printf ("SD card installed to %s\n", filesystem_name);
if (readonly)
{
printf ("SD card is locked (read only).\n");
}
}
}
else
{
/* Close the filesystem */
if ((filesystem_handle != NULL) && (MQX_OK != fclose(filesystem_handle)))
{
printf("Error closing filesystem.\n");
}
filesystem_handle = NULL;
/* Uninstall MFS */
error_code = _io_dev_uninstall(filesystem_name);
if (error_code != MFS_NO_ERROR)
{
printf("Error uninstalling filesystem.\n");
Actually disabled partion manager code part and tried installing the MFS on SD card driver . when we opeen the filesystem getting an error " MFS read fault"
please let us know what need to be debugged.
please suggest further