Hello,
I am trying to interface a micro SD card (8 gb) with a TMS320f28377d experimenter kit. I am trying to use the micro SD slot which is provided in the kit. I am using the fatfs library. I tried to create a file in the SD card but I am not successful in it. Any help would be appreciable.
The following is my main file code
/*
* main.c
* Priti Chakraborty
* date: 8/3/'16
*/
#include "F28x_Project.h"
#include <string.h>
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/interrupt.h"
#include "driverlib/sysctl.h"
#include "driverlib/systick.h"
#include "third_party/fatfs/src/ff.h"
#include "third_party/fatfs/src/diskio.h"
//*****************************************************************************
// This is the handler for this SysTick interrupt. FatFs requires a
// timer tick every 10 ms for internal timing purposes.
//*****************************************************************************
__interrupt void
SysTickHandler(void)
{
// Call the FatFs tick timer.
disk_timerproc();
PieCtrlRegs.PIEACK.all |= 1;
}
void main(void) {
static FATFS g_sFatFs;
FIL fil;
FRESULT fresult1, fresult2, fresult3;
// INITIALIZING SYSTEM CONTROL
InitSysCtrl();
//DISABLING SYSTEM INTERRUPTS
//DINT;
// Set the clocking to run from the PLL at 50MHz
//
SysCtlClockSet(SYSCTL_OSCSRC_OSC2 | SYSCTL_PLL_ENABLE | SYSCTL_IMULT(10) | SYSCTL_SYSDIV(2));
SysCtlAuxClockSet(SYSCTL_OSCSRC_OSC2 | SYSCTL_PLL_ENABLE | SYSCTL_IMULT(12) | SYSCTL_SYSDIV(2)); //60 MHz
#ifdef _FLASH
// Copy time critical code and Flash setup code to RAM
// This includes the following functions: InitFlash();
// The RamfuncsLoadStart, RamfuncsLoadSize, and RamfuncsRunStart
// symbols are created by the linker. Refer to the device .cmd file.
memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);
// Call Flash Initialization to setup flash waitstates
// This function must reside in RAM
InitFlash();
#endif
//
// Initialize interrupt controller and vector table
//
InitPieCtrl();
InitPieVectTable();
//
// Set the system tick to fire 100 times per second.
//
SysTickInit();
SysTickPeriodSet(SysCtlClockGet(SYSTEM_CLOCK_SPEED) / 100);
SysTickIntRegister(SysTickHandler);
SysTickIntEnable();
SysTickEnable();
// Enable Interrupts
IntMasterEnable();
// Creating a file
// Mount the file system, using logical disk 0.
fresult1 = f_mount(0, &g_sFatFs);
fresult2 = f_open(&fil,"message.txt", FA_CREATE_NEW);
/* Close the file */
fresult3= f_close(&fil);
}
Thanks