3

I have an Arduino Mega 2560 that is resetting every 32 seconds if the serial monitor is not attached. Just before it resets, there is a flash of TX, then it goes. If ther serial monitor is attached it runs forever. Clearly I can't use the serial monitor to debug this so am clutching at straws as to what is happening.

Update:

Having eliminated all code and uploaded an empty sketch, no includes etc., the board still exhibits the reset. However, I have an Adafruit Ultimate GPS attached to the GND, 5V, TX1 and RX1 pins. When I remove it the resets stop. But with it attached and the serial monitor attached to the board, the resets also stop, even with an empty sketch. Spooky.

So, is it possible the GPS unit is filling a receive buffer, even if the serial port isn't set up to receive? I still have a problem that while I'm clearing and logging the GPS data, the resets are still at a regular 32 seconds, thus the reason I'm working on it still.

Note: The flash of TX no longer shows up with the empty sketch.

  • 2
    Show us your code. – Mazaryk May 9 '17 at 20:22
  • 1
    When you detach the serial monitor do you also remove the USB cable and power it from a different power source, or does it remain connected to the computer? – Majenko May 9 '17 at 21:14
  • It remains attached to the USB power of the computer, though in service it is designed to run on the Vin pin or 9V DC jack – J Collins May 9 '17 at 23:34
  • What is the power consumption of the additional GPS module? It may be off limits for arduino power supp. – Mert Gülsoy May 10 '17 at 11:09
  • 1
    Not that it turned out to be relevant, but the answer to the original question is that Arduino serial output calls block until there is room in the buffer. – Chris Stratton May 12 '17 at 19:07
0

It turns out this problem had a very different cause, once I was able to eliminate the other variables. Having disconnected literally every component from the board and uploaded an empty sketch:

void setup() {}

void loop() {}

the board would still periodically reset itself.

I eliminated:

  • flushing the receive buffers,
  • eliminating all receives by disconnecting pins,
  • speeding up/slowing down the serial port/s,
  • speeding up/slowing down the GPS reporting rate,
  • auxiliary hardware,
  • code,
  • includes,
  • defines,
  • laptop power supply noise,
  • board revision in Arduino IDE,
  • Arduino IDE version,
  • USB port on laptop,
  • trying this hack to prevent the RESET pin from going low,
  • another Mega 2560 and a Due

None of the above influenced the issue.

The thing I did not think to check was whether the board would work with another power supply alone. This was a result of hunting for another power fault in service and with the laptop plugged in, finding a periodic, random reset.

Ultimately, I plugged the board into a monitor USB output, then a car charger power supply and finally found the issue was eliminated. Even plugging into another computer solved the issue. It appears that either the Arduino driver in Windows or the Arduino IDE software itself, would periodically poll the port, causing the board to reset. While the serial monitor was running, I assume the driver or IDE felt no need to poll the port, thereby leaving the board un-reset.

  • 1
    It is probably not the Arduino IDE but some other rogue piece of software, like a GSM modem manager (a modern Arduino sort of looks like one) or a driver for old serial mice. Having the Serial monitor open likely means that the serial device is claimed and unavailable to the undesired program. – Chris Stratton May 12 '17 at 19:00
  • Is that in any way an indicator of nefarious software running, or just annoying? I imagine something in the HP Workstation special tools could be trying to do that. – J Collins May 12 '17 at 19:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.