Feather HUZZAH with ESP8266 rebooting

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ajdavis
 
Posts: 6
Joined: Mon Aug 21, 2017 1:19 pm

Feather HUZZAH with ESP8266 rebooting

Post by ajdavis »

I uploaded a simple Arduino sketch that outputs to serial when the chip starts. It's outputting this setup info intermittently when I 'm not interacting with the board. I tried powering from USB and battery and the behavior is the same. It seems to be intermittently rebooting on its own.

I tracked when it happened just to see if there was some consistency. The log of reboot times is below.
13:11:58
13:12:49
13:14:13
13:14:49
13:14:54

Is there something I can try to get this board stable?

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Feather HUZZAH with ESP8266 rebooting

Post by adafruit_support_mike »

It probably means the code running on it is hanging long enough to force a reboot. Post the code you're using (between CODE tags please) and we'll take a look.

User avatar
ajdavis
 
Posts: 6
Joined: Mon Aug 21, 2017 1:19 pm

Re: Feather HUZZAH with ESP8266 rebooting

Post by ajdavis »

I uploaded a slightly modified blink sketch based on your reply. I'm seeing the same behavior. Here it is:

Code: Select all

void setup() {
  Serial.begin(9600);

  delay(2000);  
  Serial.println("");
  Serial.println("Runnning...");

  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  delay(1000);
}

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Feather HUZZAH with ESP8266 rebooting

Post by adafruit_support_mike »

In that code, the calls to delay() are probably causing the trouble.

The ESP8266 runs an operating system that swaps between the user code and the code necessary to run the Wifi radio. It has to swap between them periodically to keep a Wifi connection working, and if the user code doesn't release the CPU for a while, you'll get a watchdog timer interrupt.

Try breaking the delay(1000) into this:

Code: Select all

    for ( int i=0 ; i < 100 ; i++ ) {
        yield();
        delay( 10 );
    }
The yield() calls give the OS a chance to check the Wifi.

User avatar
ajdavis
 
Posts: 6
Joined: Mon Aug 21, 2017 1:19 pm

Re: Feather HUZZAH with ESP8266 rebooting

Post by ajdavis »

Thanks, I will try that. Is there a certain threshold that I can keep in mind?

User avatar
ajdavis
 
Posts: 6
Joined: Mon Aug 21, 2017 1:19 pm

Re: Feather HUZZAH with ESP8266 rebooting

Post by ajdavis »

I modified my code to take into account the ESP8266 watchdog as seen below. I'm still running into random reboots.

Code: Select all

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

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  safe_delay(1000);
  digitalWrite(LED_BUILTIN, LOW);
  safe_delay(1000);
}

void safe_delay(int time_in_ms) {
  const int SAFE_DELAY_TIME = 10;
  
  for (int i=0 ; i < time_in_ms ; i += SAFE_DELAY_TIME ) {
    yield();
    delay(SAFE_DELAY_TIME);
  }
}

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Feather HUZZAH with ESP8266 rebooting

Post by adafruit_support_mike »

Okay, let's take a look at the hardware. Post a photo showing the ESP8266 and any connections to it please. 800x600 images usually work best.

User avatar
ajdavis
 
Posts: 6
Joined: Mon Aug 21, 2017 1:19 pm

Re: Feather HUZZAH with ESP8266 rebooting

Post by ajdavis »

At this point I've simplified as much as possible. I'm using the built in LED, USB connected to a powered hub and a 150mAh battery.
IMG_20170824_084337760_800x600.jpg
IMG_20170824_084337760_800x600.jpg (131.9 KiB) Viewed 1476 times

User avatar
adafruit_support_mike
 
Posts: 67485
Joined: Thu Feb 11, 2010 2:51 pm

Re: Feather HUZZAH with ESP8266 rebooting

Post by adafruit_support_mike »

Everything looks normal there.

Let me check with a couple of other people who know the ESP8266.

User avatar
adafruit2
 
Posts: 22200
Joined: Fri Mar 11, 2005 7:36 pm

Re: Feather HUZZAH with ESP8266 rebooting

Post by adafruit2 »

weird - no idea. we can replace it - email support@adafruit - not sure it will help but worth a shot :)

User avatar
ajdavis
 
Posts: 6
Joined: Mon Aug 21, 2017 1:19 pm

Re: Feather HUZZAH with ESP8266 rebooting

Post by ajdavis »

I already ordered a Metro Mini to replace it for this project. I was just wanting to test the wifi capabilities since this board is so inexpensive. I'll email support. Thanks.

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”