Arduino pro mini send garbage to serial output

Hello,

I started with arduino yesterday and it is an amazing device! But i am trying now for more than a day in configuring the serial output of an arduino pro mini. While all programms are compiled, loaded and runs on the mini, when i try to write something on the serial output, it writes garbage. It seems that the serial speed is not the cause, when i change serial speed, it writes nothing when wrong Baud rate is configured. The arduino and the serial line, connected to Rx/Tx on the arduino pro mini are receiving/sending only when they have the same baud rate. But the are sending/receiving garbage.

I connected minicom on Mac OSX and ran arduino, but the result is the same, so i can eliminate that is has something to do with the OS. Many hints are in the net, but there was no result.

regards

Post your code. Might be as simple as changing from Serial.print to Serial.write or something along those lines.

Hello CrossRoads,

it is just the code from the example writing an ASCII Table to serial output via Serial.println. (I´ve tried it with Serial.write, but that wasn´t successful either…)

/*
  ASCII table
 
 Prints out byte values in all possible formats:  
 * as raw binary values
 * as ASCII-encoded decimal, hex, octal, and binary values
 
 For more on ASCII, see http://www.asciitable.com and http://en.wikipedia.org/wiki/ASCII
 
 The circuit:  No external hardware needed.
 
 created 2006
 by Nicholas Zambetti 
 modified 9 Apr 2012
 by Tom Igoe
 
 This example code is in the public domain.

 <http://www.zambetti.com> 
 
 */
void setup() { 
 //Initialize serial and wait for port to open:
  Serial.begin(9600); 
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  
  // prints title with ending line break 
  Serial.println("ASCII Table ~ Character Map"); 
} 

// first visible ASCIIcharacter '!' is number 33:
int thisByte = 33; 
// you can also write ASCII characters in single quotes.
// for example. '!' is the same as 33, so you could also use this:
//int thisByte = '!';  

void loop() { 
  // prints value unaltered, i.e. the raw binary version of the 
  // byte. The serial monitor interprets all bytes as 
  // ASCII, so 33, the first number,  will show up as '!' 
  Serial.write(thisByte);    

  Serial.print(", dec: "); 
  // prints value as string as an ASCII-encoded decimal (base 10).
  // Decimal is the  default format for Serial.print() and Serial.println(),
  // so no modifier is needed:
  Serial.print(thisByte);      
  // But you can declare the modifier for decimal if you want to.
  //this also works if you uncomment it:

  // Serial.print(thisByte, DEC);  


  Serial.print(", hex: "); 
  // prints value as string in hexadecimal (base 16):
  Serial.print(thisByte, HEX);     

  Serial.print(", oct: "); 
  // prints value as string in octal (base 8);
  Serial.print(thisByte, OCT);     

  Serial.print(", bin: "); 
  // prints value as string in binary (base 2) 
  // also prints ending line break:
  Serial.println(thisByte, BIN);   

  // if printed last visible character '~' or 126, stop: 
  if(thisByte == 126) {     // you could also use if (thisByte == '~') {
    // This loop loops forever and does nothing
    while(true) { 
      continue; 
    } 
  } 
  // go on to the next character
  thisByte++;  
}

regards

Moderator edit: quote tags replaced with code tags. Smileys removed, harmony and balance restored to the Universe.

Okay, well this out to start as you say you're on a Promini:

while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only }

I tried it on an Uno, which is the same 328P processor, I get this out:

!, dec: 33, hex: 21, oct: 41, bin: 100001
", dec: 34, hex: 22, oct: 42, bin: 100010
#, dec: 35, hex: 23, oct: 43, bin: 100011
$, dec: 36, hex: 24, oct: 44, bin: 100100
%, dec: 37, hex: 25, oct: 45, bin: 100101
&, dec: 38, hex: 26, oct: 46, bin: 100110
', dec: 39, hex: 27, oct: 47, bin: 100111
(, dec: 40, hex: 28, oct: 50, bin: 101000

Is your promini running at 16 MHz? Or at 8 MHz? If 8 MHz, try setting the datarate in the code to 19200 with the serial monitor at 9600. If that solves it, then the wrong clock speed was entered for the bootloader.

Thanks you, CrossRoads,

but no one of your advices worked for me. I changed baud rate to 19200, changed the bootloader to Duomilanove/AT328, nothing worked. But it seems, that the baud rate is already correct, when the baud rate is different from the one of the program, then very less output is produced. When Nano and Hyperterminal have the same baud rate then a lot of signs are shown. It even seems to me, that the arduino is working correct, but that the interpretation of the chars is wrong. Very mysterious...

regards

Do you see the correct results if you use the IDE's Serial Monitor vs another program (Hyperterminal)? That would support your idea of incorrect interpretation, which is likely just a setting change in the monitor program.

No, the same if i use the IDE´s serial monitor....

(Btw, it seems to be the same symptoms like the one in posting http://forum.arduino.cc/index.php?topic=181684.0)

regards

If you can upload code into the promini, that takes back & forth communication thru the USB/Serial adapter and with the board. I don't see how you can upload and then not receive a message correctly.

Did you take these lines out of void setup?

while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only }

As I showed above, the does work. Do you have anything else connected to the Tx pin while you are doing this test?

If you select File:Preferences, and click the Verbose check boxes, do you see any error messages while loading the code? You can grab the horizontal line that seperates the IDE top/bottom section and make the bottom section bigger so you can see more of what is going on.

Hello,

i must have overseen something. Yes, i commented out the "wait" for the Leonardo. Maybe i forgot to explain the setup correct: while i programm with the usbasp over the ISP connections on the pro mini (MOSI, MISO, RST, ...) , i connected a serial cable to the RX/TX pins on the board to a rs232 (pins 2,3, and 5, TX, RX and GND) and on that port the pro mini writes those characters. Perhaps the tx/rx lines are not working with the Prolific USB-to-serial-adapter, maybe i have to configure this, i must investigate these things. But rx and tx are correct connected, i tested that.

If i write the numbers from 0 to 4, i get the following sequence:

0: 9F 1: 9D 2: 9B 3: 99 4: 97 00

I still suppose that there is something with the char conversion, somewhere from nano to the tx pin on that board. Maybe it is defect... ?

regards

I don't see those as good data here http://www.asciitable.com/

Yes, maybe something with your prolific driver.

Hmm,

i´ve found an usb-serial converter from digitus, installed the driver and tested it with the assci-program. Result is exatly the same as with the previous one, athough it is an other model from a different producer. My theory now is, that either i made a mistake with the setup (but there are not so much sources for mistakes left to connect rx/tx…) or that i have a defect Pro Mini. Since i am now on business trip, i have no pissibility to solder, i will try it when i am back this weekend.

Thanks anyway for your suggestions, i appreciate that very much!

Regards

So, i´ve got a new Pro Mini, soldered it, connected it, and it produces the same output as my first one. So, i can state that i have a correct soldering and assembling and that the problem must lie maybe in some misconfigurating or something else. It would be helpful to know, if anyone has successfully ran the ASCII-Testprogram on the serial output. Or if the serial output on the arduino pro mini is fundamently working, which i assume.

But i think, that the configuration or the fundamental setup is wrong. But i can´t figure out until yet and i found nothing on the net.

regards

What kind of "garbage" is it outputting?

An arrow in the dark, but try adding a sleep call between conversions, the problem may be the serial buffers being over-written before the output is printed.

Hello. I know that this post is too old, but I think that I found the solution. CrossRoads said something that makes a sense, the speed of serial data. My nano pro mini threw the same garbage, the speed on setup was configured to 9600. When open de Serial Monitor only seen garbage but changed the speed of Serial Monitor (corner right down) appear the asccii characters!. But is not the problem solution, the solution is in correct configuration of the microprocessor when we select the arduino. I hope this helps somebody.

Good bye Charly

hi can you pl. help to resolve the error.

in pro mini i am getting serial print output as øxxxøxøxøx€øøxøx€xøx€xø for hello world.

used 5V 16MHz, 9600 rate

thanks ram