Reputation: 509
I have an Arduino Uno with a 3g shield and am using a Software Serial port on pin 6, 7 and the usb port for debug. After doing well for days, now my program seems to start over and over again (I see that thanks to a println in the setup function) - I added some code, to be honest. Any suggestion about possible reasons?
Upvotes: 4
Views: 21263
Reputation: 2299
Because you are using pin 6 and 7 with SoftwareSerial, the autoreset on serial connection start does not apply. It would if you use the "standard" 0 and 1 pin which are connected on the USB.
This kind of bug happens in many cases, normally is HW related (attached hardware use too much current, are you using an external charger or power by usb?) or because you are out of ram. Check if you have enough Available Memory
What code did you add? You say you are experienced in C#, so did you remember to clean your garbage? C/C++ does not have a garbage collector that does that for you.
Upvotes: 3
Reputation: 2058
When I had this problem I found out that it had something to do with the Sony software for my phone. Turning the software On my computer solved it, and my Arduino has been happy ever since.
The solution was found here
The culprit in my case was Sony Ericsson software trying to identify if the USB device was a mobile phone. Disabling this cured the problem. The moral of the story is don’t run any software which uses the USB whilst you are doing Arduino development. You can disable the reset function after you’ve finished developing if you want.
Upvotes: 0
Reputation: 1
Power regulator might be overheating and it's turning off. Putting a small piece of metal on top of it as a heatsink might fix the problem.
Upvotes: 0
Reputation: 11
I had the same problem, and my issue was have 10 sensors on arduino 5v output. I changed 5 of them to a separeted power with a 5v regulator and all works great.
Upvotes: 0
Reputation: 1362
The Arduino has much less memory then you are probably used to, so if are recursively calling a function intentionally or indirectly you could run out of memory.
If you are using a lot of strings it could also use all of your memory.
Can you divide and conquer to determine specifically what routine is causing the reset?
I would start by commenting out half of the main loop and see if it still resets?
Upvotes: 2
Reputation: 55
Use watchdog timer Solve above issue.And while Debug using Serial monitor keep in mind whenever you start the controller get reinitialize
Upvotes: 0
Reputation: 331
An Arduino will reset when the usb port is reinitialized (read: usb cable replugged), and that could be due to the host computer sleeping, rebooting, or something else such as the whole usb controller restarting because another usb device was plugged in.
Upvotes: 1