bluehash 1,581 Posted September 13, 2014 Author Share Posted September 13, 2014 What do you mean by nothing happens? Could you elaborate a little. Thanks! Quote Link to post Share on other sites
biza 0 Posted September 13, 2014 Share Posted September 13, 2014 Blue Hash, I proceed to some modification to write in SDcard , i will share my code hoping someone can help me. I connect the msp430g2553, with a sdcard and a LCD, he can mount the card and recognize the disk, but do not write in the file. Quote Link to post Share on other sites
biza 0 Posted September 26, 2014 Share Posted September 26, 2014 Friends I need some help,using the petitFAT library, I managed to do the implementation in my application, but I need your help to get write to the memory card thing that I am not able to do. Can anyone help me? config.h diskio.c diskio.h integer.h lcd.c lcd.h main.c main.h pff.c pff.h softserial.c softserial.h spi.c spi.h Quote Link to post Share on other sites
bluehash 1,581 Posted September 28, 2014 Author Share Posted September 28, 2014 Friends I need some help,using the petitFAT library, I managed to do the implementation in my application, but I need your help to get write to the memory card thing that I am not able to do. Can anyone help me? Did you follow the tutorial here. You need to create the file on the card first. Quote Link to post Share on other sites
biza 0 Posted September 28, 2014 Share Posted September 28, 2014 Hello Bluehash, I follow the tutorial, and everything seems to be ok, the file was created earlier on the card. The problem is that does not write on the card, I shared all my file and picture of what happens to me, hoping to get some help, that would allow me to solve the problem. Quote Link to post Share on other sites
bluehash 1,581 Posted September 30, 2014 Author Share Posted September 30, 2014 Can you load up the tutorial code and unit test the card via the terminal? Quote Link to post Share on other sites
MrBaman 0 Posted December 25, 2014 Share Posted December 25, 2014 @@bluehash I try to write my data into SD-card, but i have a problem. It overwrite the old-data in sd card, i try to using "pf_lseek(ofs);" function, but nothhing change and i can't control the pointer where i start to write the first data. And further, i can read- write data correctly without control the first byte location. Where is the mistake? Please help me! And my project in the attach file. Thank you! test sd card 3.rar Quote Link to post Share on other sites
MrBaman 0 Posted January 12, 2015 Share Posted January 12, 2015 @@bluehash I try to write my data into SD-card, but i have a problem. It overwrite the old-data in sd card, i try to using "pf_lseek(ofs);" function, but nothhing change and i can't control the pointer where i start to write the first data. And further, i can read- write data correctly without control the first byte location. Where is the mistake? Please help me! And my project in the attach file. Thank you! Help me, please! Quote Link to post Share on other sites
shaolinkhoa 0 Posted March 28, 2015 Share Posted March 28, 2015 hi @@bluehash , do you have example project ccs about testing mini sdcard for msp430g2553 ? . I use pf_opendir in ccs but nothing happen. i want to know how to use pf_opendir ? regard Quote Link to post Share on other sites
kamalesh 0 Posted May 12, 2018 Share Posted May 12, 2018 Hi ,I testing this library with the MSP430FR4133 LP and my own code.. the Read and Write function is working fine, But the Thing is while writing to a file only Five characters is getting written to the file i.e if I write KAMALESH only KAMAL is written to the file. Can you Help me with this issue.. Source Code #include <SPI.h> #include <pfatfs.h> #include <pffconf.h> #define cs_pin 8 // chip select pin #define read_buffer 128 // size (in bytes) of read buffer #define LOG_DELAY 5000 // 5000ms -> 5sec unsigned long int bw, br;//, i; char buffer[read_buffer]; int rc; DIR dir; /* Directory object */ FILINFO fno; /* File information object */ uint32_t ui32_ReadTemp = 0; uint8_t StringLength = 0; char buf[30]; uint32_t counter = 0; uint32_t AccStringLength = 0; void setup() { Serial.begin(9600); // initialize the serial terminal analogReference(INTERNAL1V5); FatFs.begin(cs_pin); // initialize FatFS library calls Serial.print("\n\n\nMSP430 Logger \n\r"); Serial.println("Type the String"); } /* Stop with dying message */ void die ( int pff_err ) { Serial.println(); Serial.print("Failed with rc="); Serial.print(pff_err,DEC); for (;;) ; } void printDec(uint32_t ui) { Serial.print(ui/10, DEC); Serial.print("."); Serial.print(ui%10, DEC); } /*-----------------------------------------------------------------------*/ /* Program Main */ /*-----------------------------------------------------------------------*/ void loop() { if(Serial.available()) { String src = Serial.readString(); if(src.indexOf("R") != -1) { rc = FatFs.open("datalog.txt"); if (rc) die(rc); delay(100); for (;;) { rc = FatFs.read(buffer, sizeof(buffer), &br); /* Read a chunk of file */ if (rc || !br) break; /* Error or end of file */ Serial.println(buffer); rc = FatFs.close(); //Close file if (rc) die(rc); } } else { rc = FatFs.open("datalog.txt"); if (rc) die(rc); delay(100); char* msg = string2char(src); StringLength = strlen(msg); Serial.println(msg); Serial.print("Size:"); Serial.println(StringLength); rc = FatFs.write(msg, StringLength,&bw); if (rc) die(rc); // rc = FatFs.write(0, 0, &bw); //Finalize write // if (rc) die(rc); rc = FatFs.close(); //Close file if (rc) die(rc); Serial.println("ADDED"); } } } char* string2char(String command) { if(command.length()!=0) { char *p = const_cast<char*>(command.c_str()); return p; } } Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.