2013-10-28 07:31 AM
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:
/* Here I used a lot of convinations such as:
for(i = 0; i <
512
; i++)
Buffer[i] = (char *)(p->payload + i);
strncpy(Buffer,(char *)p->payload, BUFFERSIZE);
With the debugger I could see that the data was succesfully copied into the Buffer array
*/
memcpy(Buffer,(char *)p->payload,BLOCKSIZE);
Status = SD_WriteBlock(Buffer,0x00,BLOCKSIZE);
Status = SD_WaitWriteOperation(); // At this point the SDIO_ISR return CRC FAIL.
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,
Bruno
#discovery #stm32 #wait-for-you--clive1-!-!-!
2013-10-28 10:50 AM
The most current release is here
https://drive.google.com/file/d/0B7OY5pub_GfIY01DaHY4OVp4NUk/edit?usp=sharing
This has the Card Select pin as used by the board. I would use SD_WriteMultiBlocksFIXED()