-->
Page 1 of 1

Why is this resetting?

PostPosted: Fri Dec 08, 2017 9:52 pm
by watusimoto
I'm running the following program, compiled in the Arduino IDE, on an NodeMCU 12e connected to my laptop via a USB cable, but otherwise not plugged into anything. This is of course just an example to illustrate the problem I have initializing the Wire library, not actual code I want to run.

Code: Select allvoid setup() {
   Serial.begin(115200);
   Serial.println("here 0");
   pinMode(6, INPUT);
   Serial.println("here 1");
   pinMode(6, OUTPUT);
   Serial.println("here 2");
   pinMode(6, INPUT_PULLUP);
   Serial.println("here 3");
}

void loop() {
   // Do nothing
}


And getting the following output:
Code: Select allβΈ®here 0
here 1

 ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v180000ca
~ld

This repeats every (approx) 6 seconds. Changing the 6s to 5s fixes the problem (except that I need to use pin 6).

My understanding is that setting the pinMode to OUTPUT is hanging, and the hardware watchdog is rebooting the device. But how can setting the pinMode hang?

Thanks!

Re: Why is this resetting?

PostPosted: Fri Dec 08, 2017 10:52 pm
by McChubby007
My immediate feeling is that pin 6 is not what you think it is, and it is in fact a reserved or illegal pin number on your particular board. I would check the pinout of your specific board - I know there has been confusion over nodemcu pin identities in the past.

Re: Why is this resetting?

PostPosted: Sat Dec 09, 2017 2:30 am
by jankop
GPIO 6 is used to read memory, you can not use it.

Re: Why is this resetting? (RESOLVED)

PostPosted: Sat Dec 09, 2017 3:20 am
by watusimoto
This was exactly the problem. Thank you!