Losing Sketch - Vague but True

I'm having frequent problems with the sketch getting corrupted or something. I have an Arduino connected to several multiplexers for a box of knobs and switches that control a Max/MSP patch. Here's what happens:

Normally, it works fine. If it works for the first minute or two it will continue to work.

However, several times, something has happened to make it act strange. It might work for a minute or two, but then goes kaput. To further complicate matters, the way in which it goes awry has varied:

  • nothing worked - i.e. it wasn't sending the serial data at all (in fact, this time I had trouble connecting to it at all although eventually I managed to get the IDE to re-upload the sketch)

  • it sent data, but the knobs were all mixed up (mapped to the wrong value)

  • it caused Max/MSP to have a stack overflow

In all cases, re-uploading the sketch caused it start functioning normally.

Here's the system:
Older Arduino with ATMega8
Mac OS 10.4
Max/MSP 4.5

Any ideas on what could be happening?

Thanks.

Which board are you using? Serial (version 2 or 3), USB or NG?

When it stop working, what happens if you press reset, instead of re-upload the sketch?

When running the same sketch, but not connected to computer, it stops working too?

How many Arduino Pins are you using?

What kind of power source are you using?

This problem happened before, or it's the first time it happens?

Which board are you using? Serial (version 2 or 3), USB or NG?

USB

When it stop working, what happens if you press reset, instead of re-upload the sketch?

Just pressing reset doesn't fix it. It will not change it's behavior until I re-upload the sketch. And of course things like restarting Max/MSP and restarting the computer have been attempted.

When running the same sketch, but not connected to computer, it stops working too?

All it does is send data to the computer via USB so I don't know (plus that's how it's powered).

How many Arduino Pins are you using?

  • 4 digital pins output to control the multiplexers (MC14067) (connected in parallel to control all 3 multiplexers at the same time)
  • 2 analog pins input for 2 of the multiplexers
  • 1 digital pin input for the 3rd multiplexer
  • 7 additional digital pins input connected directly to switches (i.e. not multiplexed)

So - all digital pins except pins 0 & 1 plus 2 analog pins. I'm reading a total of 26 potentiometers and 26 switches.

What kind of power source are you using?

USB (either directly to the computer or through a powered hub - both ways have experienced problems).

This problem happened before, or it's the first time it happens?

The 3 examples I mentioned in my original post happened on three different occasions spanning a matter of months. I haven't been using it a lot lately so I don't have a huge sample set. Strangely, I don't think I've ever experienced problems at home, only when I'm on the road (of course it's natural that it will only go down at a gig...). Most of the time it works just fine, but when it goes weird only re-uploading the sketch seems to fix it.

Thanks for your help.

I had similar issues with my setup that were caused by a 12V powersupply that needed to be regulated. After putting in a voltage regulator I no longer see sketches getting corrupted.

on some of the boards without auto reset, the bootloader waits for about 8-9 seconds before starting the sketch. maybe that's whats wrong?

I'm having frequent problems with the sketch getting corrupted or something. I have an Arduino connected to several multiplexers for a box of knobs and switches that control a Max/MSP patch. Here's what happens:

Normally, it works fine. If it works for the first minute or two it will continue to work.

However, several times, something has happened to make it act strange. It might work for a minute or two, but then goes kaput. To further complicate matters, the way in which it goes awry has varied:

  • nothing worked - i.e. it wasn't sending the serial data at all (in fact, this time I had trouble connecting to it at all although eventually I managed to get the IDE to re-upload the sketch)

  • it sent data, but the knobs were all mixed up (mapped to the wrong value)

  • it caused Max/MSP to have a stack overflow

In all cases, re-uploading the sketch caused it start functioning normally.

Here's the system:
Older Arduino with ATMega8
Mac OS 10.4
Max/MSP 4.5

Any ideas on what could be happening?

Thanks.

This repsonse will not be helpful, I doubt, to resovle your issue, but I can at least attest that I too have experienced this situation.

It has happened when USB powered and externally powered from a well regulated and very stable power supply. The Arduino board is isolated from whatever surface it sits on with four non-conductive 3/4" plastic standoffs.

I also had one incident where the fuses became corrupted. This was resolved with some doctoring using AVRDude and a programmer (I used a USB Tiny) plus a reload of the boot loader.