-->
Page 1 of 2

Rotary encoder/NodeMCU - cannot upload while 3V3 connected

PostPosted: Sat Jan 30, 2021 9:23 pm
by lotus49
I have been playing with a rotary encoder and a NodeMCU. I have connected the three data pins of the rotary encoder to D6, D7 and D8 and the + and GND pins to 3V3 and GND on the NodeMCU. When the example code is uploaded everything works as it should.

However, I can only upload the code if I disconnect the the jumper connecting + to 3V3 on the NodeMCU first. I then have to reconnect it actually to use the uploaded sketch.

I am using the current version of the Arduino IDE 1.8.13 and all the boards and libraries are up-to-date. I have tried this on both my MacBook Pro and on a Chromebook using a Debian container and the behaviour is the same for both. I've also tried pressing the flash button at the time I plug the NodeMCU in, holding it all the time I'm trying to flash and pressing rst and flash at the same time then releasing rst first then flash. None of that made any difference.

Am I doing something wrong or is there a way round this? It's a bit of a pain having to keep plugging and unplugging the jumper and if I actually made something using the rotary encoder I'd have to desolder wires just to re-flash and I'm sure that cannot be intended behaviour.

[Edit]
I have also tried a different NodeMCU clone using a different cable on an Ubuntu laptop with a fresh installation of the Arduino IDE (plus ESP8266 board etc.). The behaviour was identical.

I wanted to see whether I was actually entering flash mode so I tried setting the speed to 74880 so I could read the boot message but it refused, giving the following error message:

Code: Select allError while setting serial port parameters: 74,880 N 8 1


Setting other speeds such as 9600 or 115200 did not result in any error messages. Again, this behaviour was consistent across all the devices I tried.

Re: Rotary encoder/NodeMCU - cannot upload while 3V3 connect

PostPosted: Sun Jan 31, 2021 2:01 pm
by mgsecord62
I don't know how you have the rotary encoder connected, but my guess is that GPIO15 (D8) is not low when you are trying to download until you disconnect the 3.3 volts.

Re: Rotary encoder/NodeMCU - cannot upload while 3V3 connect

PostPosted: Mon Feb 01, 2021 8:18 am
by QuickFix
Like @mgsecord62 says, check which GPIO's can be used without problem, which when taking precautions and which you "Can't" use:
ESP8266-NodeMCU-kit-12-E-pinout-gpio-pin.png

ESP8266-NodeMCU-kit-12-E-GPIO.png

For more tips and tricks, see this excellent and helpful page. :idea:

Re: Rotary encoder/NodeMCU - cannot upload while 3V3 connect

PostPosted: Mon Feb 01, 2021 8:49 am
by lotus49
I am replying to my own post for the purposes of posterity as I have fixed the issue although I do not fully understand how.

The issue appears to be using pin D8 which is GPIO15. I don't know the detail but it appears to be the case that this pin should be pulled low (or at least not pulled high) at boot to permit flashing. Disconnecting the D8 jumper worked the same as disconnecting Vcc.

Using pins D3, D4 and D5 instead of D6, D7 and D8 resulted in the expected behaviour. This very helpful page https://randomnerdtutorials.com/esp8266 ... ence-gpios shows the mapping from IDE pin designations to actual GPIOs, which is far from obvious, and that enabled me finally to debug the problem after a couple of hours of faffing about.