Serial on duemilanove broken?

hey,

my duemilanove sends random data through the serial port when i try reading or writing something.
it is like the data gets morphed along the way.

when i try a standard analogreadserial example sketch it will still give me nothing but giberisch..
yes, i have the monitor on the correct baud rate. eventhough it doesn't look like it..

æ???æ???æ???æ???æ???æ???~fæ???~æ???~æ???~æ???~fæ???~æ???~æ???~æ???~æ???~æ???~
this should represent a sting with analog value's. you can see repetition, so there is data.. but it isnt in the right form really.

hopefully some people can help me with this. thanks :slight_smile:

Have you verified the line speed in your sketch matches the serial monitor's?

line speed in your sketch matches the serial monitor's?

That's most probably the problem, especially if you can upload OK..

REMEMBER that the IDE REMEMBERS the baud rate you last used in the serial monitor, and you may have to change it back to agree with you sketch.

Let us know...

diamantmatch:
yes, i have the monitor on the correct baud rate. eventhough it doesn't look like it..

i apreciate the help guys but really, i have set the baud rate in the monitor to the baud rate i stated in the code.

yes, it is really wierd that i can upload my sketches normally.
my thoughts there woulkd be something wrong with encoding/decoding messages..? eventough it should just be ASCII right?

ok, apearantly my arduino is comunnicating at half the speed i told it to in the code.

Serial.begin(9600);

that would mean it should communicate at a baud rate of 9600. but when my monitor is at 4800 it displays the information correctly.

i guess my atmega328-pu is using the internal 8Mhz occilator to run.
i tested this with a blink sketch, it turns out delay(1000); means a delay of 2000 ms..
i will now google how to tell the arduino to use the crystal connected.

Simple test: using the below serial code, type something into the serial monitor text box (serial monitor set for default 9600 baud) and depress the enter key to send. If what you sent to the arduino is returned to the serial monitor, then there is probably nothing wrong with your duemilanove (I've got a duemilanove arduino).

// zoomkat 7-30-11 serial I/O string test
// type a string in serial monitor. then send or enter
// for IDE 0019 and later

String readString;

void setup() {
  Serial.begin(9600);
  Serial.println("serial test 0021"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    delay(2);  //delay to allow byte to arrive in input buffer
    char c = Serial.read();
    readString += c;
  }

  if (readString.length() >0) {
    Serial.println(readString);

    readString="";
  } 
}

diamantmatch:
I guess my atmega328-pu is using the internal 8Mhz oscillator to run.
I tested this with a blink sketch, it turns out delay(1000); means a delay of 2000 ms..
I will now google how to tell the Arduino to use the crystal connected.

But the fact that the bootloader works and actually loads the sketches implies that it knows the correct crystal frequency - unless it autobauds - I haven't delved into the workings of this.

Seems to me that this is not a "stock" duemilanove and has somehow been loaded with an odd bootloader with odd fuse settings into the bargain.

You will need an ISP (another Arduino can do this) and some research to set up the correct bootloader and fuses.