Jump to content
pedrostu

UART communication results in garbled values on Serial Monitor

Recommended Posts

Hello.

I have been trying to create a serial link between the Launchpad (based on tm4c123gh6pm) and my cellphone. The code is very simple for testing purpose. Here is it:

/* This is a demo code for testing Bluetooth functionality
->The peripheral used here was a smartphone; and to obtain the values of 'i' on the terminal of the device, the "display mode" setting must be changed to ' HEX'
->The code doesn't work properly on when the pin 10 and 11 are used as RX and TX
->It has been successfully tested to send the values of i to the Rx terminal and receive the characters sent from there. */
 
int i=0;
void setup()
{
 Serial.begin(9600);
 Serial.print("Welcome ");
}
 
 char data_from_Blue=0;
 //String rx_str = "";
 
void loop()
{
   for(i=0;i<10;i++)
   {
        if(Serial.available()>0)
        
           data_from_Blue = Serial.read();    // reading the data received from the bluetooth module/the peripheral (phone here)         
           Serial.println("I received: ");
           Serial.println(data_from_Blue);
           //Serial.println(rx_str);   //display it on serial monitor  i.e,the reading has been received here!!              
        }
  
      Serial.write(i);                //Print incrementing value of 'i' across the other terminal(i.e, my cellphone)
      delay(1000);
   }  
}

The code works fine for Arduino+HC05 and MSP430G2 Lauchpad Kit+HC05.

But for TIVA Launchpad mentioned above, the serial monitor simply displays garbled values with '?' within boxes. I have tried almost everything.

Please help me. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×