Other Parts Discussed in Thread: EK-TM4C123GXL
I am trying to interface SD Card with my Tiva Launchpad (EK-TM4C123GXL). I am using CCSv6 and the latest version of Tivaware. I have looked into your forums and have tried importing the DK_TM4C123G sdc_card program from Tivaware examples without any success.
I have commented out the display part and my basic program looks like this:
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "inc/hw_memmap.h"
#include "driverlib/fpu.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
#include "driverlib/uart.h"
#include "utils/cmdline.h"
#include "utils/uartstdio.h"
#include "fatfs/src/ff.h"
#include "fatfs/src/diskio.h"
#include "fatfs/port/mmc-dk-tm4c123g.c"
static FATFS g_sFatFs;
static FIL g_sFileObject;
void
SysTickHandler(void)
{
disk_timerproc();
}
void
ConfigureUART(void)
{
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);
UARTStdioConfig(0, 9600, 16000000);
UARTStdioConfig(0, 9600, 16000000);
}
int main(void)
{
int nStatus;
FRESULT iFResult;
ROM_FPULazyStackingEnable();
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
power_on();
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / 100);
ROM_SysTickEnable();
ROM_SysTickIntEnable();
ROM_IntMasterEnable();
ConfigureUART();
UARTprintf("\n\nSD Card Example Program\n");
iFResult = f_mount(0, &g_sFatFs);
if(iFResult == FR_INVALID_DRIVE)
{
UARTprintf("f_mount error\n");
return(1);
}
else if(iFResult == FR_OK)
{
UARTprintf("SD card found\n");
return(1);
}
else
{
UARTprintf("nothing\n");
return(1);
}
}
While building, it gives me errors like:
Description Resource Path Location Type
#10056 symbol "disk_initialize" redefined: first defined in "./main_1.obj"; redefined in "./third_party/fatfs/port/mmc-dk-tm4c123g.obj" sd_card C/C++ Problem
and similar errors for disk_read, disk_ioctl, etc.
Please tell me what I should do to make it work.
Thanks.