This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP430FR2355: Problems with writing to a SD card on a MSP430fr2355

Part Number: MSP430FR2355

Tool/software: Code Composer Studio

Hi all,

I trying to log data to a sd card with a msp430fr2355. i used a combination of a few examples because there wasnt any for my microcontroller. the libary i am using now is FATfs for making files and HAL_SDCard use SPI. Te following code is my main:

#include <string.h>
#include "FatFs/ff.h"
#include "FatFs/diskio.h"

#include <stdio.h>
#include "driverlib.h"
#include "Board.h"
#include <msp430.h>

int fat_init();
int SDCard_init();

FIL file; /* Opened file object */
FATFS fatfs; /* File system object */
FRESULT errCode; /* Error code object */
FRESULT res; /* Result object */
uint8_t bytesRead; /* Bytes read object */
uint8_t read; /* Read bytes object */

DIR dir; /* Directory object */
DIR dir2;

FATFS test_for_new; // to check if a new file can be written
FIL test_file;

int result=1;


int main(void)
{
//initCLK();
WDTCTL = WDTPW+WDTHOLD;

__enable_interrupt();

f_mount(0, 0);

//volatile int i;
SDCard_init();
fat_init();

//f_mount(0, 0);

while(1)
{
unsigned int bytesWritten;
f_write(&file, "abcdefg \r\n", 32, &bytesWritten);
//for(i=50000; i>0; i--);
}
}

int fat_init()
{
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, "TEST.txt", FA_CREATE_ALWAYS | FA_WRITE);
if(errCode != FR_OK)
result=0; //used as a debugging flag
}
return 0;
}

When i run the script it seems te get stuck at FATinit. its probably lays within SPI because i could t see anything with a logic analyzer. But more than this i dant figure out. does anybody know where the problem can be? all the examples i have seen at this point doesnt support my microcontroller or is to deep in the code to get it working.