2

My Arduino mini is experiencing some really strange problem.

I'm using the BlinkWithoutDelay example sketch for testing:

const int ledPin =  13;
int ledState = LOW;             // ledState used to set the LED
long previousMillis = 0;        // will store last time LED was updated
long interval = 1000;           // interval at which to blink (milliseconds)

void setup() {
    pinMode(ledPin, OUTPUT);      
}

void loop()
{
    unsigned long currentMillis = millis();

    if(currentMillis - previousMillis > interval) {
    // save the last time you blinked the LED 
    previousMillis = currentMillis;   

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW)
        ledState = HIGH;
    else
        ledState = LOW;

   // set the LED with the ledState of the variable:
   digitalWrite(ledPin, ledState);
  }
}

The program basically turns pin 13 on and off every 1000ms.

When I uploaded this sketch into the mini (via Arduino Uno board, sans Atmega chip), the scope reading of pin 13 shows nice square waves (1s pulsewidth, 2s period), as expected.

I then unplug the USB cable powering the mini through the Uno board, wait for a few seconds for the scope traces to settle (I only have an old analog one at hand), and then plug it back in to turn on the board. However, the pin output is different - I now get a train of three pulses (60ms wide, 60ms between pulses) at sporadic intervals.

Uploading the sketch then yields the desired square waves again.

What is going on here? I'm fairly sure the mini has nonvolatile memory and it's intact (otherwise the bootloader through which I upload the sketch would not work).

  • What does the led do? The led will fade during the bootloader phase. Try disconnecting the scope while power cycling. – Gerben Oct 4 '14 at 14:16
  • There is no LED actually connected. The sketch simply alternates the pin between HIGH and LOW for 1s, and I'm just monitoring the output on the scope. Are you suggesting that having a high impedance load connected (the scope) to the output during power cycling someone interferes with the Arduino correctly executing instructions? – Asy Oct 6 '14 at 0:34
  • It shouldn't matter. But then again, your program shouldn't misbehave, like it does, either. Try using a different pin. Also, what happens if you press the reset button (instead of, or after power cycling)? – Gerben Oct 6 '14 at 13:42
  • I've used multiple pins, the behavior persists. When I press the reset button, there's no output for a little bit, then the same triple-pulses start again. I'm going to do the same thing on my Arduino Uno, to check if my mini is somehow screwed up. – Asy Oct 15 '14 at 0:42
1

There was a defective bootloader that shipped on some Arduino devices which caused the symptom you describe. See:

http://forum.arduino.cc/index.php?topic=51172.0

http://forum.arduino.cc/index.php?topic=74090.0

If that's the case, your options are to re-write the bootloader yourself (if you have the capability) or return to the manufacturer.

  • Thanks a lot for the links. That would make sense, I'll probably flash the bootloader then. – Asy Feb 6 '15 at 22:02

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.