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.

UART interfacing with M95

Other Parts Discussed in Thread: ENERGIA

HII

     This below code is used by me when i was working with Arduino and i was success at that time for SMS sending but this same approach is applied by me for Energia then i got error perhaps below code  contains "#include <SoftwareSerial.h>" library to support serial communication. is Energia have such type of library to make serial communication simple and easy???  if yes then plz share it.

#include <SoftwareSerial.h>

#define rx 10
#define tx 11
SoftwareSerial gsm(rx, tx);
int a=0;
void setup()  
{
   Serial.begin(9600);
   gsm.begin(9600);
 
}

void loop()
{
   Serial.write("START");       

  gsm.print("AT+CMGF=1\r");    //Because we want to send the SMS in text mode
  delay(1000);
  ShowSerialData();
  gsm.println("AT + CMGS = \"+919981359849\"");//send sms message, be careful need to add a country code before the cellphone number
  delay(1000);
  ShowSerialData();
 S
 
  gsm.println("A test message!:"+sensor1);//the content of the message
  delay(1000);
  ShowSerialData();
  gsm.println((char)26);//the ASCII code of the ctrl+z is 26
  delay(1000);
  gsm.println();
 
   
}
void ShowSerialData()
{
  while(gsm.available()!=0)
    Serial.write(gsm.read());

  • Hi Vaibhav,

    I don't think the software library is available, at least in the core instalation.
    Why? You have no reason to use it. You have 8 UARTs! You have 8 hardware serials!

    To use from 1 to 7, instead of using the class Serial, use
    Serial1, Serial2, ... , Serial7.
    For example, begining the UART1 at 9600 baudrate use:
    Serial1.begin(9600);

    If you check the pin out available on the paper that came with your launchpad you can check which pins are for each UART (serial). I find actually easier to find them in a user friendly table on the datasheet but maybe you should keep for now with that pin out diagram.


    Normally this is not the best place to get Energia libraries support. Although I will have no problems answering you.
    For better support on Energia check out http://forum.43oh.com/

    I hope I was able to clear your doubts
  • THANK YOU SIR FOR YOUR KIND REPLY!!
    Actually i want to interface M95 GPRS modem for sms task but i am unable to communicate it with 1294XL(via serial port 7) M95 has auto bauding capability (115200) so i have to initialize serial port 7 with 115200 but still i am not able to communicate. i dont know why???
  • Well, let's check some steps.

    How did you initialize the UART at 115200 baudrate?
    How did you connect the device to your launchpad? Which UART (0, 1, ..., 7) you used and which pins?
    What is your test code?
    Can you check with a probe the TX and RX to check if what you are sending/receiving is correct?
  • "AT+IPR=115200" is used to fix the baud rate.
    UART 7 is used by me for communication(PC_4=RX_7 and PC_5=TX_7).
    Here is my code...

    void setup()
    {
    // put your setup code here, to run once:
    Serial.begin(9600); Serial7.begin(115200);
    delay(10000);
    Serial7.println("AT"); delay(1000); serialEvent();
    Serial7.println("AT+IPR=115200"); delay(1000); serialEvent();
    Serial7.println("ATE0"); delay(1000); serialEvent();
    Serial7.println("AT+CMGF=1"); delay(1000); serialEvent();
    }

    void loop()
    {

    // put your main code here, to run repeatedly:

    Serial7.println("AT+CSMP=17,167,0,0"); delay(1000); serialEvent();
    Serial7.println("AT+CSCS=\"GSM\""); delay(1000); serialEvent();
    Serial7.println("AT+CSCS=\"+918871910761\""); delay(1000); serialEvent();
    delay(1000); Serial7.println("This is M95!!!"); Serial7.println((char)0x1A);
    }
    void serialEvent()
    {
    while (Serial7.available()>0)
    {
    char inChar = (char)Serial7.read();
    Serial.println(inChar);

    }
    }