Jump to content
43oh

Can SoftwareSerial library work with msp430g2553


Recommended Posts

Hello everyone,

I'm new here, I have a problem when I use SoftwareSerial library to connect between MCU msp430g2553 and module GPS NEO 6M. I don't know whether this library work with MSP430 or not. When I run my code, the program stop at line while(nss.avaible()). Please help me

I need some help from you. Thanks.

 

 

#include <SoftwareSerial.h>
SoftwareSerial nss(4,3);
 
char gps[20];
int i;
void setup() {
  // initialize serial:
    Serial.begin(9600);
    nss.begin(115200);
    Serial.write("$PMTK314,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29");
    Serial.write(0x0D);
    Serial.write(0x0A);
    delay(100);
    Serial.write("$PMTK251,9600*1F");  // 115200bps
    Serial.write(0x0D);
    Serial.write(0x0A);  
    delay(100); 
    Serial.write("$PMTK300,1000,0,0,0,0*1C");  
    Serial.write(0x0D);
    Serial.write(0x0A);  
    delay(100); 
  // reserve 200 bytes for the inputString:
  
}
void loop() 
{
  // print the string when a newline arrives:
  while(nss.available())
  {
    char first = nss.read();
    if(first=='$')
    {
       gps[0]= first;
       i=1;
       while (i<20)
       {
         if (nss.available())
         {
           gps=nss.read();
           i++;
         }
       }
      for (i = 0; i < 20; i++) {
        Serial.print(gps);
      }
      Serial.println();
     }
   }
}

 

Link to post
Share on other sites

It seems there's some confusion about which device you're having your serial conversation with.  I think that nss is intended to talk to your gps, but you're directing the gps commands to the hardware Serial in your setup code?  So, when you get to the loop() code, which is looking for nss to report it has data, it has none, thus it doesn't progress. HTH

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...