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.