Arduino 328 Serial Problem

I'm having some difficulties with scrambled text over the serial port when using my 328 version of the Arduino Pro. It was working before, so this issue is a fairly new development.

Since my code stopped working (Serial-wise, at least), I loaded up the ASCII text example to see what the problem was. Strangely, none of my 328's will run it (I get a screen full of garbage), but my 168's all run it just fine. I get the same result running at every conceivable baud rate. I checked and rechecked that I've selected the right board when uploading.

My original thought was that the first 328 I had simply fried, so I ordered two new ones. Each of the new ones has the same problem right out of the box, so I don't necessarily think I've killed them in any way.

Has anybody else had similar problems?

What are you sending to? Have you tried sending to the Arduino IDEs serial monitor which needs to have it's baud rate set to match your sketch setting?

The fact that you can upload a new sketch to your board says the serial link should be working fine.

Lefty

Yeah, I found that to be strange as well. Here's where it gets stranger.

I've been watching the output in the IDE serial monitor, and when the baud rate I select matches the Serial.begin() argument, I get garbage. However, when I set the IDE's serial monitor to 2x the rate specified in my code, it works just fine. I at a bit of a loss as to what this means.

Example:

code contains: Serial.begin(57600);

Set IDE Serial monitor to 57600: garbage Set IDE Serial monitor to 115200: works!

Sounds like you are running your 328 at 8mhz instead of the default 16mhz that the Arduino's IDE assumes for that board selection. Are you using a external crystal or resonator or the internal clock?

Lefty

PS: I just checked the board selection menu on my newly installed version 16 of the Arduino IDE and there are board selections for 328 boards running at both 16 and 8 mhz. Why don't you try that.

I'm using the external resonator located on the pro board. It's the 3.3V, 8MHz version (according to the label).

Wouldn't this problem arise if my clock speed was 2x what the board is labeled as? If the code assumes that the master clock is 8MHz, but the board is really clocked at 16MHz, wouldn't I be seeing what I am now due to the code running twice as fast? I'm going to scope this and see what the clock is up to..

Try both board selections of 328 @ 8 mhz and 328 @ 16mhz, one or the other should work, your board may be mismarked.

Lefty

I selected the Duemilanove w/ ATMega328 option and it worked just fine. Which clock frequency does this one assume?

Scoping the board showed an 8MHz clock. So, is the board definition in my IDE (0016) wrong?

"I selected the Duemilanove w/ ATMega328 option and it worked just fine. Which clock frequency does this one assume?"

The Duemilanove runs at 16mhz.

Lefty

I believe you will find the solution in this thread.

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1245508129