AnsweredAssumed Answered

Help with SDIO please

Question asked by B3rsui on Oct 28, 2013
Latest reply on Oct 28, 2013 by Clive One
Hi guys, first of all sorry if my english isn't good, lol.

I've been working with a stm32f407vg + ethernet + lwip + sd card (using the stm32f4_discovery_sdio_sd.c) for my degree final proyect. I was able to use the modules separately, I mean stm32f4 + ethernet +lwip and stm32f4 + SDIO.

The thing is that now I want to store the data which comes from the server program, which runs in my laptop, into the SD Card. As I told you I was able to store information in the SD (I am not using a file system I only need a memory to store the data as fast as posible). 

The problem is that when I copy the data pointed for the pointer (void *) payload that LWIP use, the SDIO interrupt gives me a SD_DATA_CRC_FAIL result and no data is transfered to the SD.

Here is a piece of code where I make the storage:

01./* Here I used a lot of convinations such as:
02.for(i = 0; i < 512; i++)
03.    Buffer[i] = (char *)(p->payload + i);
04.strncpy(Buffer,(char *)p->payload, BUFFERSIZE);
05.With the debugger I could see that the data was succesfully copied into the Buffer array
07.    memcpy(Buffer,(char *)p->payload,BLOCKSIZE);
08.    Status = SD_WriteBlock(Buffer,0x00,BLOCKSIZE);
09.    Status = SD_WaitWriteOperation();       // At this point the SDIO_ISR return CRC FAIL.
10.    while(SD_GetStatus() != SD_TRANSFER_OK);       

Searching in the forum and google I read that the SDIO port has a problem with the CRC. So I've downloaded the errata sheet but I don't understand if the problem I'm having is related with that.

The strange thing is that if I use a buffer filled with data of the program, the transfer goes well, but whenever I fill the Buffer with the data pointer by payload (which comes from the server) the SDIO gives me that error. Even if I only fill one element of the Buffer array.

Does anybody can help me? Im desesperated.

Thank you very much!

Best regards,