ÿÿ printed when RS232 shield is connected to the PC

Hi there,
Do you have any explanation on what I found as described in the subject title?
The 'ÿÿ' is printed regardless of what program is used. As long as Arduino is powered, a connection between RS232 shield and PC will have ÿÿ sent to the PC. But I do not want any messages from Arduino side.

I have checked the source code for serial communication but could not locate the cause. The fact that this problem persists when serial communication is not used further propels me to think that there might be other reason for this. Any advice on how this occurs and how to get this avoided is greatly acknowledged. Thanks.

without posting your code, you knows?

Read the sticky posts at the top of the forum about how to post your code using code tags and do so, then we can take a look.

If you have read my post, you will know that the code does not matter.

With any code once you make the connection between Arduino and the pc, ÿÿ will be seen printed on the terminal.

Have you thought about disabling the auto reset functionality?

I wonder if the hardware serial pins not being set up as serial pins means they idle low (or HiZ if inputs) and when connected, the level and/or noise is seen by the PC as a start-bit & character.

Can you try adding "Serial.begin(9600);" to your setup?

Even if you do nothing else serial related in the program, having the pins setup may prevent what you're seeing.

Wenx:
If you have read my post, you will know that the code does not matter.

With any code once you make the connection between Arduino and the pc, ÿÿ will be seen printed on the terminal.

I did read your post. No code... No help. How about a minimal example?

Thanks a lot for all your help, here is what I did:

  1. a complete code, which I will not go through here. I found the problem. then, I tried
  2. a simple code, which goes like this:
#include <SPI.h>
#include <SoftwareSerial.h>
#include <stdio.h>

// setting the serial communication ports
const int RxPin = 3;
const int TxPin = 2;
SoftwareSerial mySerial(RxPin,TxPin);
void setup() {
  pinMode(RxPin,INPUT);
  pinMode(TxPin,OUTPUT);
  Serial.begin(9600);
  mySerial.begin(9600);
//  Serial.print("Initializing SD card...");
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
}
void loop() {
}

Now I got the same problem.
I thought there may be something wrong with the Serial.begin(9600) function. I then went to inspect the source code HardwareSerial.cpp, where I did not see anything relevant in the begin() function but in the end() function, there is a sentence:

// clear any received data
  _rx_buffer_head = _rx_buffer_tail;

which will trigger a return of -1 i.e. ÿ in the following available() function.
I tried to comment it out which is not proper of course. This did not work.
3) I then tried to comment out the

Serial.begin(9600);
mySerial.begin(9600);

However, this did not stop from the ÿÿ messages from printing out when the serial communication is established, i.e. even though no serial communication is used.
4) afterwards, I tried the example codes, under file->examples,where serial communication is not used at all. But this problem persisted.
5) finally I come to the forum to seek advice.

PS: I used a small serial communication software to build the connection with the RS232 shield. The printing out of messages ‘ÿÿ’ occurs when I click ‘Connect’ button. After connection is built, ‘Connect’ will become ‘Disconnect’. Whenever I click the button as long as the connection can be built, the same messages will be printed.

I have no problem to get this serial communication built and messages exchanged between PC and Arduino but I do not want the messages at the initial stage to be sent from Arduino to the PC or I want to control the behavior if I cannot stop it.

What Arduino are you using? What RS232 shield are you using? If the examples are showing this problem, maybe the problem is with your program running on the PC since if you use the Serial Monitor within the IDE, the examples work fine.

blh64:
What Arduino are you using?

Uno.

blh64:
What RS232 shield are you using?

RS232 shield v1.

blh64:
If the examples are showing this problem, maybe the problem is with your program running on the PC since if you use the Serial Monitor within the IDE, the examples work fine.

I never said in my post there is any problem with the example except that any code regardless of what it is including the examples provided by the IDE which are not using serial communication will have the same problem, i.e. ÿÿ will be printed on the screen when connection is built. It seems you misunderstood me each time. Hopefully this can clear things up a little bit?

I guess I'd try the exact sample shown http://wiki.seeedstudio.com/RS232_Shield/ to see if that works or does not and if you see the problem on the serial monitor and/or your custom program on the PC