ATmega644p reboots on serial input

I have an atmega644p on a breadboard. Minimal setup, just a 16Mhz resonator, 10K pull-up on the reset pin and a LED on a digital IO pin. Power (3.3v) is provided by an FTDI adapter and its RX/TX lines are connected to the 644p on Serial0.

The problem I have is after every few bytes of data received on the serial RX pin, the 644p will reboot. This occurs even if I don't initialise or read the serial port. ie. It will reboot even with a blank sketch!

I'm using IDE v 1.5.6r2 but have also tried 1.0.5. I'm using the Arduino core with a variant (arduino_pins.h) from the mighty1284p project GitHub - maniacbug/mighty-1284p: Mighty 1284P Platform for Arduino. I've also tried the mighty1284p core. I've tried both the Arduino IDE serial monitor and an external serial terminal app.

Anyone got any ideas what's going on?

Here's the sketch I'm using - just enough to detect a reboot.

void setup() 
{
  pinMode(1,OUTPUT); // pin 1 is a digital IO on the 644p
  digitalWrite(1,HIGH);
  delay(100);
  digitalWrite(1,LOW);
}

void loop() 
{
}

Your code has nothing to do with Serial so I don't see how it relates to your comments.

What is sending data to the device? And why is it doing so if the the device is not expecting any?

Have you been able to get any code to work properly?

It may be useful if you draw a diagram for how everything is connected and post a photo of that.

...R

I am using the IDE's serial monitor to send data to the device.
The minimal code I posted was just to show that even without any serial code, the processor reboots on receiving serial data.

Apart from the reboots, sketches seem to work properly and even processing serial code works (e.g. echoing back the character received).

There's not much to show with a diagram. It's an ATmega644p connected via TX & RX to an FTDI board connected via USB to a PC. I'll post a diagram as soon as I can.

Breadboard diagram attached

644.tiff (137 KB)

It could have something to do with the DTR signal. How do you have that connected on your breadboarded circuit ?

Place some 100nF capacitors from the pins connected to VCC to GND. Ex pin 10 to GND, 32 and 30.

Can you confirm the power from the FTDI is not dipping?

what do you have the FTDI DTR signal connected to ?

Clearly the first thing to do is to isolate the DTR connection to reset and then see if the reboot occurs.

This immediately distinguishes between a PC and an Arduino problem.

  1. You are running out of spec. The Speed Grades graph shows that 3.78V is needed to run & be fully within spec at 16 MHz.
  2. 0.1uF caps at each Vcc and Avcc pin are needed.
  3. DTR is not connected - reset is pulled high. That only comes into play if software created Reset was needed, like during a serial download. Bit of a red herring in this discussion. More than likely the lack of decoupling caps and running overspeed are more the issue.

Was there some discussion a while back about issues caused by the proximity of the RXD0 pin and the XTAL1 pin? Was there anything to that? If so, was a solution found? (Not to take anything away from Crossroads' reply -- all good points there.)

Some have reported better results with Low fuse set to 0xf7 vs 0xff I think. Not 100% sure on the values. I have not seen any problems reported with my boards using 0xff. I pay careful attention to grounding & traces around the crystal.

• Speed Grades
– ATmega164P/324P/644PV: 0 - 4 MHz @ 1.8V - 5.5V, 0 - 10 MHz @ 2.7V - 5.5V
– ATmega164P/324P/644P: 0 - 10 MHz @ 2.7V - 5.5V, 0 - 20 MHz @ 4.5V - 5.5V

I agree with Crossroads. You've already violated the manufacturers rules . The datasheet is like a bible of sorts in that it is a sin to violate what is written in the datasheet. You should expect to continue to have problems as long as you do that and you should not expect to find a solution that does not involve lower the clock speed or raising the supply voltage. One or the other will have to happen before you can rule out overclocking as the cause of your issues. Once you raise the voltage, and continue to see the same issue , then you can proceed with troubleshooting the issue with the knowledge that it is not related to clock speed. You really can't cheat when it comes to uC specs.They are what they are and thousand of man hours and $ have gone into ensuring that the information is reliable. the GAMERS who "cheat" resort to special cooling techniques that keep the temp down. They still obey the laws of physics.

Thanks all for the great responses. I didn't realise I was running out of spec at 3.3v/16Mhz, so after trying at 5V, the problem went away! I need to pay more attention to data sheets :slight_smile:

Cool.

CrossRoads:
Some have reported better results with Low fuse set to 0xf7 vs 0xff I think.

That'd be using the full swing XO rather than the low power XO?

I think that's what it is.

@Crossroads,
:wink:

? raschemmel ?

  1. You are running out of spec. The Speed Grades graph shows that 3.78V is needed to run & be fully within spec at 16 MHz.

You solved the OP's problem, that's all .