-->
Page 1 of 5

more than 4 pinmode give wdt reboot

PostPosted: Fri May 05, 2017 4:20 am
by magnets
so this is a wierd one and i have no idea what's going on.

I have an ESP-12e module

this is my code:
Code: Select all//ok lets declare them
int ServoSignal = 4;
int RelaySignal = 5;
int IRSend = 9;
int IRRec = 10;
int LEDClosed = 12;
int LEDOpen = 13;
int ButtonOpen = 14;
int ButtonAC = 16;
int ButtonBoom = 0; //this is using the adc do not use yet, placeholder only

void setup() {

  // put your setup code here, to run once:
//ok lets declare them
  pinMode(ServoSignal, OUTPUT);
  pinMode(RelaySignal, OUTPUT);
  pinMode(LEDClosed, OUTPUT);
  pinMode(LEDOpen, OUTPUT);
//  pinMode(IRSend, OUTPUT);
 // pinMode(IRRec, INPUT);
  pinMode(ButtonOpen, INPUT_PULLUP);
//  pinMode(ButtonAC, INPUT_PULLUP);
//  pinMode(ButtonBoom, INPUT_PULLUP);
   Serial.begin(115200);
Serial.println("i'm in the setup.");
}

void loop() {
  // put your main code here, to run repeatedly:
Serial.println("i'm running.");
}


this results in the wdt kicking in and my code not running.
if i comment out any one of the pinmode lines, it then works.
it doesn't matter which pinmode lines i comment out, if there are 5 or more it crashes.

Things i've tried:

loading up the normal blink example (works fine)
powercycling the module (no change)
using a different power supply (i'm using a 1amp linear bench top power supply) it never draws more than 180ma
soldering a 10uf capacitor across the Vcc and gnd of the module (no change)
using esptool.py to flash the nodemcu firmware and the original AT firmware (both work fine, then i go back to the code above and the same thing happens).

i haven't tried a different module as this thing is soldered directly to a few buttons leds and a servo so i'm really reluctant to unsolder and start again. I can also use the servo or blink the leds (as long as i don't have more than 4 pinmode lines.

can anyone help?

Re: more than 4 pinmode give wdt reboot

PostPosted: Fri May 05, 2017 6:22 am
by rudy
I'm sure that the problem is with 9 and 10. Those are connected to the flash memory chip and are not to be used in most cases.
Image

Re: more than 4 pinmode give wdt reboot

PostPosted: Fri May 05, 2017 6:34 am
by magnets
thanks Rudy,
I'll double check and post the results (in the example code both 9 and 10 are commented out so i'm not sure this is correct).

Re: more than 4 pinmode give wdt reboot

PostPosted: Fri May 05, 2017 7:44 am
by rudy
Also GPIO16 can be INPUT, OUTPUT, or INPUT_PULLDOWN_16. No pull up available for 16

Also
int ButtonBoom = 0; //this is using the adc do not use yet, placeholder only
A0 and 0 are not the same. So if you plan to use the analog input then you need to change this to A0. On one project I used A0 with some resistors to connect six push buttons. To keep more digital pins available.

I don't see anything wrong in the uncommented code.