Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

MSP430f5529 launchpad interface with SD card

$
0
0

Hi,
I am a novice to MSP430 so my prior apologies for asking basic or stupid questions. I am trying to interface SD Card with msp430f5529 launchpad using FatFS file system of elm-chen. Luckily I found some of the files on the github via google which included mmc.c, mmc.h, HAL_SDCard.c and \HAL_SDCard.h .

 

I wrote the main file and somehow my SD card is being mounted but root directory is not being opened and I am always getting SD Card not ready message. I tried changing the card but it did no benefit. Can someone guide where is it going wrong and whats the way to resolve it. Let me know if I should attach some other stuff like files and stuff or a sample code where I can somehow compare to find out where am I going wrong.

 

Below is the code for fat_init

 

void fat_init(void){

    errCode = -1;

    while (errCode != FR_OK){                               //go until f_open returns FR_OK (function successful)
        errCode = f_mount(0, &fatfs);                       //mount drive number 0
        errCode = f_opendir(&dir, "/");                        //root directory

        errCode = f_open(&file, "/Data.csv", FA_CREATE_ALWAYS | FA_WRITE);
        if(errCode != FR_OK)
            result=0;                                       //used as a debugging flag
    }
}
 

 


Viewing all articles
Browse latest Browse all 2077

Trending Articles