ATMEGA644 Serial1 can't work

Hi All,
I am using atmega644 with sanguino 1.01 , we met a problem when testing serial1. atmega644 would halt after calling "Serial1.println" several times and there also did't have anything output on USART1. anyone can help us?

// the setup routine runs once when you press reset:
void setup() {                
  Serial.begin(9600);
  Serial.println("Starting...");
  Serial1.begin(9600);
  Serial1.println("Serial1 Starting...");
 
   
}

void loop() {

   Serial.println("loop");
   Serial1.println("loop1");
   delay(1000);
}

what is serial 1 connected to?

Hi All,
I am using atmega644 with sanguino 1.01 , we met a problem when testing serial1. atmega644 would halt after calling "Serial1.println" several times and there also did't have anything output on USART1. anyone can help us?

// the setup routine runs once when you press reset:
void setup() {                
  Serial.begin(9600);
  Serial.println("Starting...");
  Serial1.begin(9600);
  Serial1.println("Serial1 Starting...");
 
   
}

void loop() {

   Serial.println("loop");
   Serial1.println("loop1");
   delay(1000);
}

Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

Threads merged.

Read this before posting a programming question

Please edit your post, select the code, and put it between [code] ... [/code] tags.

You can do that by hitting the # button above the posting area.

  • Moderator

we got same result no matter serial1 pin (RXD1,TXD1) were empty or connected to RS232 driver.

Did we? But you decided not to follow my advice about the code tags did you?

we got same result no matter serial1 pin (RXD1,TXD1) were empty

Well, now, there's a surprise.

or connected to RS232 driver.

So, it must be a programming issue? Not hardly.

it should not be programming issue, The same codes run well on ATMEGA2560. There should be a bug with arduino ATMEGA644 SDK

If you have a real atmega644, and not a 644a or 644p, then I think that in fact it only has one UART!

Yup, only the larger AtMega1284 from that series has two UARTs.

No the 644p does have two serial ports, the 644 just one.

Lefty

retrolefty:
No the 644p does have two serial ports, the 644 just one.

I was counting the 'p' ones as a seperate series, but yeah the 644p has two.

catchup, do you have the Atmega644p or the atmega644?
(note that the 'p' is not the same as 'pu', for example there are AtMega644P-PU and AtMega644-PU).

thanks for your help. I am using ATMEGA644 even the signature is the same as ATMEGA644A, after changing to using ATMEGA644P, It worked.

Yes, I consider the fact that the 644 (one uart) and 644a (two uarts) have the same device signature to be a pretty big mistake on Atmel's part... Grr.

Take a look to the mapping if the ISR for the serial Port you wanna use. I have did some fixes in Arduino103 environment for m644,644p , 1284p to use the the serial port. The #defines of the
supportet ATMega variants are not complete in all purposes. Just extend them and add your MPU model to the right register definition.
Take a look to the compilers mapping file and compare the IRQ Vectors he mapped with the datasheet of the MPU you use.

catchup:
Hi All,
I am using atmega644 with sanguino 1.01 , we met a problem when testing serial1. atmega644 would halt after calling "Serial1.println" several times and there also did't have anything output on USART1. anyone can help us?

// the setup routine runs once when you press reset:

void setup() {                
 Serial.begin(9600);
 Serial.println("Starting...");
 Serial1.begin(9600);
 Serial1.println("Serial1 Starting...");

}

void loop() {

Serial.println("loop");
  Serial1.println("loop1");
  delay(1000);
}