Hello All,
I am trying to use the fatfs third party library with my launchpad. My code compiles without errors but I cannot seem to write anything to the sd card (which is unlocked). My pin connections are as follow:
PORT A PIN 2 -- SD CARD SCK
PORT A PIN 3 -- SD CARD CS
PORT A PIN 4 -- SD CARD MISO
PORT A PIN 5 -- SD CARD MOSI
( I am using this adapter: http://www.lctech-inc.com/Hardware/Detail.aspx?id=0c3b6f7a-d101-4a60-8b56-3abfb7fd818d )
Here is my main code:
int main(void)
{
/*
* ...More code here...
*/
//SDCardInit();
power_on();
BOOL a=wait_ready();
DSTATUS errd;
if (a) {
send_initial_clock_train();
errd = disk_initialize(0);
UARTprintf("\nInitialising disk 0. Status = %i\n",errd);
}
unsigned int val=65;
char filename[40];
while(val < 68)
{
// Led on
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2);
// Create a new file and write to sd card
usprintf(filename,"File%i.txt\n",val);
UARTprintf(filename);
f_open(&Fil, filename, FA_WRITE | FA_CREATE_NEW);
SysCtlDelay(SysCtlClockGet()/3);
f_close(&Fil);
// Led off
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);
// Small 1 second delay
SysCtlDelay(SysCtlClockGet()/3);
val++;
}
power_off();
}
I have include the third_party/fatfs/port/mmc-dk-tm4c123g.c file.
The code compiles without errors, but I can not see any files created on the sd card.
What am I doing wrong?
I would appreciate any help.
Thanks,
Mike