Jump to content
Sign in to follow this  
BigG

MSP430G2 (G2553) Noisy UART RX through SoftwareSerial

Recommended Posts

I am trying to get the SoftwareSerial library to work on my MSP430G2 (using M30G2553) but with limited success.

 

First I tried attaching my trusty RF device but got no communication either end. To resolve I started troubleshooting and was a little surprise by results.

 

First I hooked up an Arduino Mega to the MSP430G2 through Arduino Mega Serial 1 RX/TX which talked to MSP430G2 pins P1_4, P1_3 through SoftwareSerial. I included a loop command in both Arduino code and MSP430 code.

 

Arduino: set up with 9600 baud

unsigned int i = 0;
void loop() // run over and over
{
  if (Serial1.available())
    Serial.write(Serial1.read());
  if (Serial.available())
    Serial1.write(Serial.read());
  if (i>50000) {
    Serial1.println("Hello, Launchpad?");
    i = 0;
  }
  i++;
}

MSP430G2: set up with 9600

unsigned int i = 0;
void loop() // run over and over
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
  if (i>50000) {
    mySerial.println("Hello, Arduino?");
    i = 0;
  }
  i++;
}

I received communication between the two no problem. Arduino received message cleanly everytime but with MSP430 it received the message but regularly and periodically it also seemed to receive some garbage bytes through its RX line.

 

I then attached the RX and TX lines to pins 3 & 4 on Arduino Mega also using the SoftwareSerial library. This time I received no communication at all between the two MCU's suggesting a timing issue (even though baud rate is slow enough at 9600).

 

I then detached the Arduino altogether and just monitored MSP430 through serial monitor. I was surprised by what I saw. I merely touched/wobbled the wires and garbage bytes started to appear through its RX line. I then detached the wires altogether from MSP430. Of course nothing but as soon as I touched the pins garbage started appearing.

 

How does one resolve this noise.

 

 

 

 

 

Share this post


Link to post
Share on other sites

Also, in general the UART lines should have a pullup resistor enabled on the RX side port, and it looks like SoftwareSerial does not do this; it only enables INPUT mode but doesn't enable the PxREN register.

 

For complete giggles, try doing this before the SoftwareSerial object's .begin() statement:

pinMode(<rxpin>, INPUT_PULLUP); where <rxpin> is replaced with whichever pin you're using for receive-mode.

Share this post


Link to post
Share on other sites

Mega outputs are 5v, are they not?

True. I was actually using an old Seeeduino Mega 1280 which you can manually set at 3V3 logic. Hence was able to communicate when talking to its other hardware driven UART ports (in my case RX1/TX1).

Share this post


Link to post
Share on other sites

Why are you using SoftwareSerial?  G2553 has a hardware UART.  Use it and be happy! ;)

edit: Nevermind, looks like you are trying to communicate with more than one device?

Yes can confirm little RF device works well through hardware UART but as you identified I need to communicate with more than one device. Hence need to use SoftwareSerial library.

Share this post


Link to post
Share on other sites

Depending on what you interface to, if you add a little time between characters sent to a Software Serial emulator, you can get more reliable communications at higher baud rates. Long bursts of continuous data can cause differences in the clock rates of the two devices (especially using RC oscillators) to get the software UART out of sync with the data. At low baud rates, the problem is not very significant, but at higher rates it comes into play. Simply using 2 stop bits in the communications setup instead of 1 stop bit can make a lot of difference.

Share this post


Link to post
Share on other sites

Hey,

Sorry I'm coming a little late to the party.

I have the exact same problem as @@BigG. Using SoftwareSerial, transmitting works flawlessly, but on the receiving end, some random bytes are constanly generated.

Did you somehow managed to resolve this noise problem ?

 

And yeah, sadly using Hardware UART is not an option for me :(

Share this post


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.

Sign in to follow this  

×
×
  • Create New...