Jump to content
43oh

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. 

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...