Dear all:
I have a problem when I use SD card. I attached my code before. I found the return value is error when I use fopen = ("a:",NULL); the return value is 0x000000.
I dont know why?
void main(void)
{
(void) temp; /* suppress 'unused variable' warning */
boolean inserted = TRUE, readonly = FALSE, last = FALSE;
_mqx_int error_code;
_mqx_uint param;
MQX_FILE_PTR com_handle, sdcard_handle, filesystem_handle, partition_handle;
char filesystem_name[] = "MFS:";
char partman_name[] = "pm:";
char partition_name[] = "pm:1";
com_handle = fopen(BSP_SDCARD_ESDHC_CHANNEL, (void *)(SPI_FLAG_FULL_DUPLEX));
error_code = _io_sdcard_install("sdcard:", (void *)&_bsp_sdcard0_init, com_handle);
sdcard_handle = fopen("sdcard:", 0);
/* Install MFS over SD card driver */
error_code = _io_mfs_install(sdcard_handle, filesystem_name,0);
(The return value is all correct above)
filesystem_handle = fopen(filesystem_name, NULL); (filesystem_handle is equal to 0x00000000) and mention "Error open filesystemname" But I think I can open the sdcard device. Therefore, there is not problem in hardware? right ?
error_code = ferror(filesystem_handle);
}
Any one can help me .thankyou
I use the demo board that design by myself. I realize this function before. Due to my issue, I lost my program. so I did again. the version of MQX is 4.0. I try the sdcard example , but I found the program would be dead when it execute (filesystem_handle = fopen(filesystem_name, NULL); ). I use debuger to debug step by step.
In addition ,I have try 2G sd card and 16G sd card.
Thx sol.
Hi,
Are you using a Freescale board?
Which MQX version are you using?
Could you please try using the sdcard example in order to discard a software or hardware issue? This example is located at the path: C:\Freescale\Freescale_MQX_4_2\mfs\examples\sdcard
Could you please try using different sd card brands and capacities?
If you are using a Freescale board, could you please double check the jumper settings?
Have a great day,
Sol
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Besides ,I also found I can read and write the block in SD card . But I can not install a mfs filesystem inside.