Mini 5v 16Mhz ATmega168 Serial problem

Hello.

I am having problems with Serial communication on my Mini. I have a Duemilanove 16Mhz and ATmega168 and running my code perfectly but when I switch to my Mini 5v 16Mhz ATmega168 i receive corrupted response.

The Code is:

int incomingByte = Serial.read();
Serial.print(incomingByte,BYTE);

When I run this code on my Duemilanove and send “test” on the Serial line I get “test” back.
But when I do the same on my Mini I get “tecd”. And if I send my name “Daniel” I get “dDab`ellþ” in response.

I have spend many hours on this problem… :-/

Regard
//Daniel

I have been testing a litle bit more and I think it has to do with the receiving (RX) on the Mini.

When I send characters Serial.print("Daniel"); from the Mini to the pc it works good. I can read on the Serial monitor "Daniel".

When I send Serial.println(Serial.available(),DEC) from the Mini to the pc it is sending me random numbers. If I send "Daniel" from pc to Mini it returns 11 up to 127 and then it resets. Strange.

//Daniel

The problem is solved. I am using a USB BUB from moderndevice.com and I had set the device in 3.3v mode. It supposed to be in 5v mode for the Mini.

//Danne