Hi Everyone,
I have been struggling with this issue for a week now. I am using the Kinetis K60 evaluation board.
I am able to successfully implement multi-block read using the SDHC controller. The multi-block write fails. I am attaching the piece of code below. The code uses MQX ESDHC driver directly. MFS is not used.
The code is written according to reference manual section "52.6.3.1.1 Normal Write". After issuing CMD25 and writing one block of data, the SD Card status has to be polled. The code fails(hangs monitoring IRQSTAT[CC] to set) when attempting to obtain the SD Card status using SEND_STATUS (CMD13).
Please help,
Thanks,
Harish
/*
* Initialization and identification code
* Setup SD Card in 4 bit mode and set BLOCK_LEN = 512
*/
/* Send CMD25 for multi-block write */
command.COMMAND = ESDHC_CMD25;
command.TYPE = ESDHC_TYPE_NORMAL;
command.ARGUMENT = sector;
command.READ = FALSE;
command.BLOCKS = BLOCK_COUNT;
error_code = ioctl (esdhc_fd, IO_IOCTL_ESDHC_SEND_COMMAND, &command);
if (ESDHC_OK != error_code) { printf("\nioctl send command failed %d", error_code); _task_block (); }
/* Write one block of data */
error_code = fwrite(data_ptr, 1, BLOCK_SIZE, esdhc_fd);
/* Check SD Card status to see if it is ready to receive more data */
command.COMMAND = ESDHC_CMD13;
command.TYPE = ESDHC_TYPE_NORMAL;
command.ARGUMENT = rca;
command.READ = FALSE;
command.BLOCKS = 0;
error_code = ioctl (esdhc_fd, IO_IOCTL_ESDHC_SEND_COMMAND, &command); // HANGS HERE
if (ESDHC_OK != error_code) { printf("ioctl failed with 0x%0x\n", error_code); _task_block (); }
Any update on this facing same issue while multi read block is reading it never come out esdhc_status_wait
i have similar issue, I added CMD12 after fwrite...the "_esdhc_status_wait" never return
Any progress from your end?
Hi,
I'm encountered with the same question.Maybe you just used cmd18, and then used cmd25.
i used cmd18 ===> read PRSSTAT ==> found CDIHB setting to '1'. It means i can't used DATA line.
PS: i tried to use cmd18,then cmd12, but it failed
Hi ,
Something relative, i used cmd18 (enable automatic cmd12) , and then queried the SD status, it was still DATA status, wasn't it normal?