Jump to content

minet

Members
  • Content Count

    3
  • Joined

  • Last visited

About minet

  • Rank
    Noob Class

Profile Information

  • Gender
    Not Telling
  1. minet

    msp430fr5994

    thank you for an answer I forget to add notification, so I just saw the response. I actually give up on energia. am trying the example I saw.Since I don't know much.Here is the issue I have: how else should I define FIL (SD card, SDHC 16GB, using FATFS Lib)
  2. hello, I need help, sorry for my lack of knowledge, just started with MSP430, I saw an example which I try to reproduce, writing on the micro SD card (SDHC 16GB). Upload is the code. how else am I suppose to define "FIL", am using the FATFS lib. . thank you for helping
  3. minet

    msp430fr5994

    am actually using an example code to write on SD card. on my MSP430FR5994 and its not working. can t someone please help me. the code looks like: #include "SPI.h" #include "pfatfs.h" #define read_buffer 400 // size (in bytes) of read buffer #define LOG_DELAY 3600 #define detect_pin 25 // sd_detect pin (P7.2) (P7.2/UCB2CLK ) #define cs_pin 31 // chip select pin (P4.0) (P4.0/A8) unsigned short int bw, br ,c ; //char buffer[1]; char buffer[read_buffer]; int result; DIR dir; FILINFO fno; // file information int count = 0; void setup () { pinMode(cs_pin, OUTPUT); pinMode(detect_pin, INPUT_PULLUP); Serial.begin (9600); // initialisation FatFs.begin(cs_pin); // initialisation PFatFs lib Serial.println (); Serial.println ("welcome to SD logging"); Serial.println (""); result = FatFs.opendir (&dir, ""); if (result) { Serial.println("I cannot find the SD card. Please check the connections."); // sd nicht gefunden return; } Serial.println(" SD inhalt: "); count = 0; for (;;) { result = FatFs.readdir(&dir, &fno); // if (result || !fno.fname[0]) break; // if (fno.fattrib & AM_DIR) { // Serial.print("<dir>\t"); Serial.println(fno.fname); // } else { Serial.print(fno.fsize); // file size Serial.print("\t"); //tabulation Serial.println(fno.fname); // file name if (!strcmp (fno.fname, "demo.txt")){ count = 1; } } } if (result) { Serial.println("Error of card contents."); return; } Serial.println(""); if (count){ Serial.println("demo.TXT file is present on the card"); } else{ Serial.println("demo.TXT file is present not on the card."); return; } Serial.println(); for (;;) { result = FatFs.read(buffer, sizeof(buffer), &br); /* Read a chunk of file */ if (result || !br) break; /* Error or end of file */ for (uint16_t i = 0; i < br; i++) /* Type the data */ Serial.print(buffer); } delay(LOG_DELAY); Serial.println(); result = FatFs.open("demo.TXT"); if (result) { Serial.println("Unable to open file"); return; } Serial.println(); Serial.println("file is being edited."); bw=1; result = FatFs.write(buffer, sizeof(buffer), &bw); if (result) { Serial.println("Error while writing ..."); return; } result = FatFs.write(0, 0, &bw); //writting (?) if (result) { Serial.println("Error while writing file.."); pf_write(&c, 1, &bw); return ; /* (bw == 1) ? 1 : EOF; */ } result = FatFs.close(); // close file if (result) { Serial.println("Error closing file."); return; } }
×
×
  • Create New...