Hello
I am using LPC2148 - 12 Mhz Crystal. I followed the instructions from Keil Website and tried to create a program to read/write to MMC/SD Memory card. I have included the required files and have written code for UART. I do have little problems when I test the code.
1. Uart works fine when I did not call fopen. If I include the code for fopen, UART never works.
2. The Card never gets initialized.
Included Files
FS_ARM_L.LIB File_Config.C
Configured File_Config.C and Enabled Memory Card Drive0
Using Uart.h as follows for Initialization: ------------------------------------- void Init_UART0(void) { unsigned short u0dl; u0dl = (15 * 1000000) / (16 * 115200);
PINSEL0 |= 0x00000005; U0LCR = 0x00000083;
U0FCR=0x07; U0DLL = u0dl & 0xFF; U0DLM = (u0dl>>8);
U0LCR = 0x00000003; U0IER = 0x00000003;
} -----------------------------------------------
Init_Card / Main ----- Function in Main.C
-------------------------------------------------
static void init_card (void) { U32 retv;
while ((retv = finit (NULL)) != 0) { /* Wait until the Card is ready*/
if (retv == 1) { putchara('?'); } else { putchara('*'); } } }
/*******************************************************/ /*****************MAIN STARTS HERE *********************/ /*******************************************************/ int main(void) { char ss; FILE *f; U32 retv;
Init_UART0(); //printf("sdf"); putchara('&'); //printf ("\nSD/MMC Init Failed"); init_card(); putchara('S');
f = fopen ("\\test1.txt","w"); if (f == NULL) { putchara('#'); } else { fclose (f); }
}
---------------------------------------------------
I dont know what I am missing here. Please advise.