Code stopped working during test until reprogrammed?

Discussion in 'Embedded Systems and Microcontrollers' started by jjmalove, Sep 20, 2016.

  1. jjmalove

    Thread Starter Member

    Jul 6, 2016
    Hey all,

    For the second time in my career as a tech/junior engineer, I had a board today that randomly failed mid test. Checking multiple times and it was as if all the code just stopped. This particular example was audio related and the sound went all garbled for a few seconds then vanished. The microcontroller in this example is related to the audio.

    We reprogrammed it and the code took and all of a sudden everythings working fine.

    Anybody have any plausible explanation? The weird thing was the board wasn't even being handled when it broke. We were just sitting a few feet away talking and it died. The audio portion was running and hearing us talk so the code was being used when it died, its just I'm much more familiar with things breaking when you touch them than just randomly. Also nothing was even remotely hot, that was the first thing I checked almost immediately to try and catch before things would have cooled.
  2. jjmalove

    Thread Starter Member

    Jul 6, 2016
    Micro was ATmega2560.
  3. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    Did you have other boards that did not fail? Does the code run without error on another board?

    My first reaction is that the code caused an overrun of variable space, eating itself up. Like would happen with recursive code without limit checking.
  4. AlbertHall

    Distinguished Member

    Jun 4, 2014
    Resetting the uC didn't fix it? If not then then some persistent change occurred which means either the EEPROM or flash contents were changed. Do you use the EEPROM? Do you have code which writes to the flash?
  5. jayanthd

    Active Member

    Jul 4, 2015
    Show the circuit. Does the device write to flash memory during runtime ?
  6. jjmalove

    Thread Starter Member

    Jul 6, 2016
    Thanks for the advice everyone. I think we have decided it was related to a hardware problem found. Had a very small sliver of copper that was shorting VCC and GND, and coming and going from vibration. Must have just been coincidence that the bumping to program it un-shorted it. It re-shorted later and stopped working again until I found the problem.

    Thanks all!