Jump to content

kamalesh

Members
  • Content Count

    14
  • Joined

  • Last visited

About kamalesh

  • Rank
    Member

Contact Methods

  • Website URL
    www.auckam.com/

Profile Information

  • Location
    chennai , Tamil Nadu , India
  • Interests
    Robotics , Automation , IOT
  1. kamalesh

    PetiteFS FATfs SDCard USCI code

    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; } }
  2. 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; } }
  3. kamalesh

    MSP430FR4133 - Can LCD pins be configured as GPIO

    Thank You so much . Its working.
  4. Hi , I am using MSP430FR4133LP , in energia the GPIO pins are predefined in the pins_energia.h for MSP430FR4133 LP based on the silkscreen on the board. I using this MSP430FR4133 chip for another project and in that i am not using a LCD so i thought that i can also use LCD pins as GPIO. For this purpose i need to add the pins in the pins_energia.h but i am not able to crack it. Can anyone help me with this ....? if i try to use any other pins other than the defined ones (say P2_2) ... it throws an error as " P2_2 not defined in the scope" // Pin names based on the silkscreen // static const uint8_t P1_0 = 4; static const uint8_t P1_1 = 3; static const uint8_t P1_2 = 24; static const uint8_t P1_3 = 13; static const uint8_t P1_4 = 12; static const uint8_t P1_5 = 11; static const uint8_t P1_6 = 18; static const uint8_t P1_7 = 19; //static const uint8_t P2_0 = ; //static const uint8_t P2_1 = ; //static const uint8_t P2_2 = ; <------ What should i do in order to add this pin static const uint8_t P2_3 = 22; static const uint8_t P2_4 = 21; static const uint8_t P2_5 = 8; static const uint8_t P2_6 = 25; static const uint8_t P2_7 = 5; //static const uint8_t P3_0 = ; //static const uint8_t P3_1 = ; //static const uint8_t P3_2 = ; //static const uint8_t P3_3 = ; //static const uint8_t P3_4 = ; //static const uint8_t P3_5 = ; //static const uint8_t P3_6 = ; //static const uint8_t P3_7 = ; static const uint8_t P4_0 = 23; //static const uint8_t P4_1 = ; //static const uint8_t P4_2 = ; //static const uint8_t P4_3 = ; //static const uint8_t P4_4 = ; //static const uint8_t P4_5 = ; //static const uint8_t P4_6 = ; //static const uint8_t P4_7 = ; static const uint8_t P5_0 = 17; static const uint8_t P5_1 = 7; static const uint8_t P5_2 = 15; static const uint8_t P5_3 = 14; //static const uint8_t P5_4 = ; //static const uint8_t P5_5 = ; //static const uint8_t P5_6 = ; //static const uint8_t P5_7 = ; static const uint8_t P8_0 = 6; static const uint8_t P8_1 = 2; static const uint8_t P8_2 = 9; static const uint8_t P8_3 = 10; //static const uint8_t P8_4 = ; //static const uint8_t P8_5 = ; //static const uint8_t P8_6 = ; //static const uint8_t P8_7 = ; //static const uint8_t PJ_0 = ; //static const uint8_t PJ_1 = ; //static const uint8_t PJ_2 = ; //static const uint8_t PJ_3 = ; //static const uint8_t PJ_4 = ; //static const uint8_t PJ_5 = ; //static const uint8_t PJ_6 = ; //static const uint8_t PJ_7 = ; These are the pin definitions that are already in the pins_energia.h based on the silkscreen. If i want to use a pin (say P2.2) what must i do in order to define that pin in the pins_energia.h file ?? thank you in advance.....
  5. conversions i had tried .. The above code i had sent only contains a type cast version just before the For statement. 1. type cast - String buf = String (FloatVal); 2 .snprintf(buffer, sizeof buffer, "%f", myFloat); //// in this type of float to string conversion if i use %f simply the "%f" is getting printed or transmitted. if i use %d the conversion is not proper. 3 . dtostrf(FloatVal, 4, 3, Buff);
  6. The Minimal code Which i Use for the task. void loop() { duration = pulseIn(pin1, HIGH); { //conditions and statement for calculating sensor value. } String src = Sim800l.readSms(1); // if(Serial.available()) // { // String src = Serial.readString(); if(src.indexOf("Flow") != -1) { String buf = String(sensor_val); for(int i = 0; i < buf.length()+1;i++) { text = buf; } Sim800l.sendSms(number,text); delay(1000); Sim800l.delAllSms(); //Serial.print("Flow:"); //Serial.println(text); // src = "\0"; // } } }
  7. hi, I am using a MSP430FR4133 launchpad, i am trying to get a float value and send it via sim800. for that i hve to convert the float value to char* or char array. I have tried many conversions but i am not able to get the conversion properly. Even if i get it properly while printing it on the serial. The data is not transmitted in the right format through sim800. for example if i use dtostrf( buff , "%f" , flaotVal); function in serial monitor only "%f" is getting printed. and if i try other type of convertions , while transmitting through sim800 the right side part of the float value gets added to the decimal values . have tried ( itoa(), sprintf(), etc..) for example .. float value = 1.25. and if i tried converting and printing it on serial monitor i am getting it corrrectly as "1.25" . But when i am trying to transmit through sim800 the converted float value is sent as "0.125" instead 1.25 . Can anyone help me with this?.
  8. kamalesh

    UART interface to sim900

    Is the RXD and TXD jumpers connected vertically or horizontally. ...? If its connected horizontally , you cant see anything in Serial monitor. If it is connected Vertically its like tapping the connection . You can use both Application UARt and can see using the Serial monitor.
  9. kamalesh

    UART using MSP430FR2311

    I am using a MSP430FR2311 launch pad and i am trying to send AT commands through RX and TX to SIM800 and Receive Response from the SIM800 module. But am not able to get the response and not able to use SoftwareSerial in Energia for MSP boards. Can Anyone help with this problem ? Thank you in advance. #include <String.h> void setup() { pinMode(RED_LED , OUTPUT); Serial.begin(9600); //Serial.print(F("AT\r")); while(Serial.available()==0); val1 = Serial.readString(); Serial.print(val1); Serial.print("\r"); delay(100); } void loop(){ //do nothing if(Serial.available()) { String val2 = Serial.readString(); line += String(val2); Serial.print(line); if (line.indexOf("OK") >= 0) { digitalWrite(RED_LED,HIGH); } } } Since we cant use both the Debugging UART (Serial Monitor) and Application UART (TX and RX) at the same time , I am checking the received Response for the string "OK" . and if OK is there the RED led goes high.
  10. Can we add MSP430FR2311 Launchpad to energia. The Board Manager isn't Showing this board.
×