Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Intermittent resets - only when pushing buttons
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Intermittent resets - only when pushing buttons

by adafruit on Thu Oct 01, 2009 11:33 am

yes its right

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Intermittent resets - only when pushing buttons

by madworm_de on Thu Oct 01, 2009 4:08 pm

OK.

What about the disabled "set snooze" code in there. Is it worth playing with it ?
NO LARDO CHIPS
madworm_de
 
Posts: 99
Joined: Mon Jun 09, 2008 6:56 am

Re: Intermittent resets - only when pushing buttons

by adafruit on Thu Oct 01, 2009 4:13 pm

we put it in
then decided it was kinda stupid overkill, so we took it out :)

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Intermittent resets - only when pushing buttons

by madworm_de on Thu Oct 01, 2009 5:15 pm

Hmm.

I was thinking auto dimming the clock during night time would be a nice thing. Like if you're asleep from 1:00 to 9:30 or maybe something less nasty, you don't look at the clock anyway. And in a dark room 30 for brightness is good enough and doesn't hurt your eyes (if you know what I mean). Or add a photo resistor for auto adjustment.

A thermometer based on the internal temperature sensor would have been nice as well, but that can't work reliably.

Adding an rgb led on the bottom of the pcb might work for some subtle mood light effects too. There's enough edges to light up.
NO LARDO CHIPS
madworm_de
 
Posts: 99
Joined: Mon Jun 09, 2008 6:56 am

Re: Intermittent resets - only when pushing buttons

by adafruit on Thu Oct 01, 2009 5:43 pm

there is a breakout specifically for a photoresistor, theres a spot for the sensor and a pulldown (or up) resistor

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Intermittent resets - only when pushing buttons

by Hellbus on Tue Oct 06, 2009 8:38 pm

This is happening to me as well. Setting options works fine, until I get to the adjust brightness option. If I try to change it, the display goes blank and the clock loses about 20 minutes. Brightness adjustment is the only menu option that causes this to happen, and it happens every time I try to change the brightness.

Also, the clock sometimes seems to reset itself without me even touching the buttons at all. The display will go blank, it will beep, and then it comes back on again, blinking. When this happens, the time remains correct. This happens unpredictably. It just happened to me twice in one minute after it went for 20 minutes without that happening. One of other topics mentioned problems with a fuse, so I wonder if that might be a factor.

I have made no adjustments to the firmware, nor could I even if I wanted to. This is what it's doing to me right out of the box. Given that the clock beeps when it comes back up from a reset, I may just have to leave it unplugged until there's more info. At the moment, it's an unpredictable, unset alarm clock.
Hellbus
 
Posts: 2
Joined: Tue Oct 06, 2009 8:26 pm

Re: Intermittent resets - only when pushing buttons

by adafruit on Wed Oct 07, 2009 12:01 am

these are 2 seperate issues, post up a photo of your kit, top and bottom you probably have the low power detection missoldered and its tripping

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Intermittent resets - only when pushing buttons

by brain_recall on Wed Oct 07, 2009 12:16 am

I had this happen again to me this morning. The alarm was going off, and I hit the snooze. The clock reset, screwing up the time, date, and alarm. I haven't had any time to look over the code but I'm going to try and make an effort this week.
brain_recall
 
Posts: 14
Joined: Thu Aug 27, 2009 10:46 pm

Re: Intermittent resets - only when pushing buttons

by adafruit on Wed Oct 07, 2009 2:36 am

ok since no one is willing to post up photos, try removing R2 (100K resistor) :D

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Intermittent resets - only when pushing buttons

by Hellbus on Wed Oct 07, 2009 12:18 pm

I noticed on closer inspection that I had forgotten to install C10. It looks like installing C10 has cured my woes, as I was able to turn the brightness up to maximum, and the random resets haven't happened since.
Last edited by Hellbus on Wed Oct 07, 2009 12:28 pm, edited 1 time in total.
Hellbus
 
Posts: 2
Joined: Tue Oct 06, 2009 8:26 pm

Re: Intermittent resets - only when pushing buttons

by adafruit on Wed Oct 07, 2009 12:20 pm

Hellbus wrote:I noticed on closer inspection that I had forgotten to install C10. I'm putting the clock back together now and will report whether the second issue is fixed. There is one thing I noticed when I was experimenting last night that got me thinking. As a test, I soldered in a jumper to short the fuse and then tried to adjust the brightness. It got as far as showing a final zero at the end of the display before resetting, which made me wonder if the VFD might be drawing too much power.

That was prior to adding C10, and my random resets were not solved by the jumper, so I have since removed it.


Please DO NOT ever short the fuse. Shorting the fuse will ONLY make any problems worse.
C10 is essential to the kit, adding it should solve your problems
viewtopic.php?f=41&t=12622&hilit=C10

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Intermittent resets - only when pushing buttons

by caitsith2 on Mon Oct 12, 2009 2:20 am

I had some intermittent reset issues as well. My problem though, was found when I was looking for what was wrong in someone elses trouble. I noticed a difference in the Way C7 was mounted, then all of a sudden, I had to look at assembly instructions, lo and behold, I had C7 Mounted wrong. I don't know how it happened, first time I made a mistake in putting together a kit, of that type, in quite a while. :)

As a result, now the intermittent reset issue I had been trying to debug, thinking it was a firmware bug, is fixed. (I was trying to get it to tell time, by its piezo buzzer only, while waiting for the driver chip. Hopefully sometime this week. (0% chance of it arriving tomorrow, because of Canadian turkey day :) ))

caitsith2
 
Posts: 217
Joined: Thu Jan 18, 2007 11:21 pm

Re: Intermittent resets - only when pushing buttons

by brain_recall on Mon Oct 19, 2009 8:12 pm

I'm still getting this reset. I've gone over it again and I can't see anything out of the ordinary. Suggestions welcome.
Attachments
DSC00376-resize.jpg
Bottom
DSC00376-resize.jpg (473.47 KiB) Viewed 4123 times
DSC00380-resize.jpg
Top
DSC00380-resize.jpg (449.8 KiB) Viewed 4123 times
brain_recall
 
Posts: 14
Joined: Thu Aug 27, 2009 10:46 pm

Re: Intermittent resets - only when pushing buttons

by adafruit on Mon Oct 19, 2009 8:35 pm

sounds like everyone had this issue had soldering or placement issues. try resoldering all the points. check for cold solder joints. try removing the 100K resistor as well

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Re: Intermittent resets - only when pushing buttons

by caitsith2 on Wed Oct 21, 2009 2:19 am

One more final reason for intermittent resets, and this one is software fixable. You are pushing the buttons way too fast.

The issue, is that every time you push the button, or flip a switch, you cause a processor interrupt. Now, in order for the processor to return to where it was interrupted from, it has to store that interrupt return location somewhere. Unfortunately, that somewhere, is in the limited ram. If the interrupt handler does not finish processing before it is interrupted, then more ram is consumed by this interrupt. If timed right, you could very well be filling all of the ram, corrupting what is in the ram, like current date, time, and all of that stuff. Worse, this corruption, might cause some loop to lock up somewhere, causing the watchdog to kick in and reset the processor.

What really needs to happen, if interrupts are to be enabled, the button interrupts themselves are to be disabled till the processing of that interrupt is complete.

The alarm switch is another interrupt that really needs to be disabled while it is processing, for the same reason. Someone could flick it back and forth fast enough to cause corruption of memory.

I believe I have fixed the issue completely. The solution is to disable the specific interrupt upon entry, and re-enable it just before exit of the interrupt handling routine. It is okay to allow all other interrupts to happen in the mean time, but sometimes, indeed, the switches bounce, and the interrupt fires very fast as a result.

Code: Select all | TOGGLE FULL SIZE
SIGNAL(SIG_PIN_CHANGE2) {
  // allow interrupts while we're doing this
  PCMSK2 = 0;
  sei();
  // kick the dog
  kickthedog();

  if (! (PIND & _BV(BUTTON1))) {
    // button1 is pressed
    if (! (last_buttonstate & 0x1)) { // was not pressed before
      delayms(10);                    // debounce
      if (PIND & _BV(BUTTON1))        // filter out bounces
      {
        PCMSK2 = _BV(PCINT21) | _BV(PCINT20);
         return;
      }
      tick();                         // make a noise
      // check if we will snag this button press for snoozing
      if (alarming) {
   // turn on snooze
   setsnooze();
  PCMSK2 = _BV(PCINT21) | _BV(PCINT20);
   return;
      }
      last_buttonstate |= 0x1;
      just_pressed |= 0x1;
      DEBUGP("b1");
    }
  } else {
    last_buttonstate &= ~0x1;
  }

  if (! (PIND & _BV(BUTTON3))) {
    // button3 is pressed
    if (! (last_buttonstate & 0x4)) { // was not pressed before
      delayms(10);                    // debounce
      if (PIND & _BV(BUTTON3))        // filter out bounces
      {
        PCMSK2 = _BV(PCINT21) | _BV(PCINT20);
         return;
      }
      buttonholdcounter = 2;          // see if we're press-and-holding
      while (buttonholdcounter) {
   if (PIND & _BV(BUTTON3)) {        // released
     tick();                         // make a noise
     last_buttonstate &= ~0x4;
     // check if we will snag this button press for snoozing
     if (alarming) {
       // turn on snooze
       setsnooze();
      PCMSK2 = _BV(PCINT21) | _BV(PCINT20);
       return;
     }
     DEBUGP("b3");
     just_pressed |= 0x4;
    PCMSK2 = _BV(PCINT21) | _BV(PCINT20);
     return;
   }
      }
      last_buttonstate |= 0x4;
      pressed |= 0x4;                 // held down
    }
  } else {
    pressed = 0;                      // button released
    last_buttonstate &= ~0x4;
  }
  PCMSK2 = _BV(PCINT21) | _BV(PCINT20);
}

// Just button #2
SIGNAL(SIG_PIN_CHANGE0) {
  PCMSK0 = 0;
  sei();
  if (! (PINB & _BV(BUTTON2))) {
    // button2 is pressed
    if (! (last_buttonstate & 0x2)) { // was not pressed before
      delayms(10);                    // debounce
      if (PINB & _BV(BUTTON2))        // filter out bounces
      {
        PCMSK0 = _BV(PCINT0);
         return;
      }
      tick();                         // make a noise
      // check if we will snag this button press for snoozing
      if (alarming) {
   setsnooze();    // turn on snooze
  PCMSK0 = _BV(PCINT0);
   return;
      }
      last_buttonstate |= 0x2;
      just_pressed |= 0x2;
      DEBUGP("b2");
    }
  } else {
    last_buttonstate &= ~0x2;
  }
  PCMSK0 = _BV(PCINT0);
}

//Alarm Switch
SIGNAL(SIG_INTERRUPT0) { 
  EIMSK = 0;  //Disable this interrupt while we are processing it.
  uart_putchar('i');
  uint8_t x = ALARM_PIN & _BV(ALARM);
  sei();
  delayms(10); // wait for debouncing
  if (x != (ALARM_PIN & _BV(ALARM)))
  {
    EIMSK = _BV(INT0);
    return;
  }
  setalarmstate();
  EIMSK = _BV(INT0);  //And reenable it before exiting.
}

caitsith2
 
Posts: 217
Joined: Thu Jan 18, 2007 11:21 pm

Please be positive and constructive with your questions and comments.