We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi,
I wanted to test the SD-card example from keil using the native MCI interface with an SD card. It detects well an Formatted SDcard inserted but asks me forever to format the card and then , that the format failed... When a took a look into the source, it seems mci_init() return well (__TRUE value), but when I did an mci_read_sect in order to read the sector 0, it failed. I really didn't find what's wrong...
Best Regards
I found the problem here:
mci_read_sect(...) { ... for (i = 100000; i; i--) { if (GPDMA_RAW_INT_TCSTAT & 0x01) { /* Data transfer finished. */ break; } } MCI_DATA_CTRL = 0x00; if (i == 0) { printf("timeout!\n"); } else if ((mci_read_status () & 0x0F00) != 0x0900) { printf("wrong state!\n"); } ... }
The debug message returned is 'Timeout'... I increased the timeout value (100 000 instead 10 000) but without success.
I don't know if it's your case, but the DMA only works if the buffer you are reading into is in the USB/Ethernet RAM area.
Regards, Sergio.
Most likely you have changed the original SD_File example from RLARM. It is true that the DMA does not work for standard RAM and you should select IRAM2 for RTLFS.lib
Franc
Thanks for the tip, But i tried to set up my destination buffer in usb memory like this without success :
static char pom[512] __attribute__((at(0x7fd0000)))
I still got the timeout on the reading... But this keil example is supposed to work out of the box ? :).
I forget to mention that the MCB2300 is a rev3 and with a LPC2368 .
There's some progress :)
The inserted card is always detected as unformated. I can format it from the board and it seems it's working well . But the mcb2368 board always says it's not formatted... Nevertheless, the DMA ram tip solved on part of the problem :)
hyperterminal:
SD/MMC Card is Unformatted Format Flash Memory Card? [Y/N] Memory Card Formatted. Card Label is M:KEIL SD Card Detected (CID:5252797) SD/MMC Card is Unformatted Format Flash Memory Card? [Y/N]
Hello Yann Suisini,
You have to use USB RAM for DMA and the USB RAM starts at 0x7FD00000 and not at 0x7FD0000 as you mentioned before.
The best is to create a second RAM area (IRAM2) in uVision under Options for Target - Target and locate file RTLFS.lib to this area. You select IRAM2 under Options for File - Zero Initialized Data.
Best Regards, Martin Guenther
Please see also http://www.keil.com/support/docs/3357.htm
It's ok now . the ram tip was ok , I just accidently removed a line (and it returned always with __false condition...) hmm Hmm :)
Thanks all for your help !