Don't use GPIO 9 or 10

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
dduley
Normal user
Posts: 93
Joined: 06 Feb 2016, 17:56

Don't use GPIO 9 or 10

#1 Post by dduley » 27 Apr 2016, 07:32

Hi All,

Tonight I was trying to setup a switch input on one module. I accidentally chose GPIO 9 from the drop down menu. I hit enter and my ESP became brain dead. It would reset every few seconds. On the serial port it would say WDT reset. I reloaded the ESPEasy R104 and no joy. I loaded R078, still resets. I then used the standard de-bricking technique of uploading the original AT firmware. That worked. I then used the Arduino IDE to upload R104 again. It came up but still remembered my AP and task settings. I was surprised since I loaded several different firmwares. I figured at least the original AT command firmware would have overwritten things. I managed to get things stable again but it took all night to do it. I did a little net searching and sure enough others have had issues using GPIO 9 and 10. Has any one else experienced issues with these two IOs? If these IO line don't function, why are they selectable? At least I got it working again.

Dave

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: Don't use GPIO 9 or 10

#2 Post by costo » 27 Apr 2016, 14:19

You have to look how the internal wiring of the ESP8266 chip with the flash-memory is done.
On most boards the flashmemory, a 8 pin chip, is connected to 6 GPIO pins and Vcc+Gnd.
4 of these pins, GPIO 6,7,8,& 11 are the equivalent of the SPI-bus & ChipSelect and are absolutely nessecary for communucation with the flash chip. 2 extra pins GPIO9 and GPIO 10 are used on special functions-pins of the flash chip. GPIO9 is connected to the HOLD pin and GPIO10 is connected to the WP (WriteProtect) pin of the flash chip. Both these pins are 'HIGH' when the flash chip is in normal mode. To program the flash chip WP GPIO10 is made 'LOW'.
It is possible to disconnect the HOLD and WP pin of the flash chip from the ESP and connect them both to VCC. If you do that you free GPIO9 & 10 and make them usable as general I/O. Only when (re)flashing the chip (Serial or OTA) GPIO9 & 10 pins need to be connected to the ESP again.
There are actually some development boards that do this automaticcally. For the NodeMCU board there are/were plans to do that too but it is not (yet) implemented.
Practically spoken GPIO 6,7,8,9,10 & 11 are dedicated to the flash memory and not usable for other purposes.

spaceguard
New user
Posts: 6
Joined: 26 Mar 2016, 17:08

Re: Don't use GPIO 9 or 10

#3 Post by spaceguard » 27 Apr 2016, 14:35

pin_functions.png
pin_functions.png (173.7 KiB) Viewed 80067 times

dduley
Normal user
Posts: 93
Joined: 06 Feb 2016, 17:56

Re: Don't use GPIO 9 or 10

#4 Post by dduley » 27 Apr 2016, 18:12

Thanks! This is useful information.

As I said I accidentally clicked on GPIO 9. The fingers are faster than the brain sometimes. There should be a way to clear the settings for ESPEasy in case of such an occurrence. Once I set GPIO 9 in a SWITCH task the module became unresponsive. The serial port data would show a few lines of the normal boot information and then it would state WDT reset. I suspect that the firmware is going through its initialization and it comes to setting GPIO 9 to an input, then Poof!: reset.
There should be a way of putting the firmware into a safe mode or clearing out the setting data to restore that new-module smell. We do this sort of thing at work with subsea instrumentation. When power is first applied there is a 10 second countdown, during which, the user can hit cntrl-C to enter a setup menu. After 10 seconds the system goes into normal operations an locks out the menu operation to prevent unintentional changes. Perhaps something like this with a serial command or a GPIO could help in situations like this.
I was amazed that after re-flashing with the AT command firmware and then flashing with R104 the settings were pretty much intact. The task with the SWTICH GPIO 9 was still there but the module would stay up long enough for me to see it and delete the task. The task then was gone but there still must be an errant memory booger because that task then showed no entry but the task name was now set to UPTIME. Tonight I will issue a reset command to try to clear it out completely. The module still won't stay up for more than about 10 minutes. It resets itself and shows a MANUAL RESET as the cause.

Dave

kboris
Normal user
Posts: 14
Joined: 13 May 2017, 22:34

Re: Don't use GPIO 9 or 10

#5 Post by kboris » 13 May 2017, 22:38

Hello

I read this post and I see that is possible to use GPIO 9 & 10. What should I doo? Costo can you please explain a litle more details for newbie this part "It is possible to disconnect the HOLD and WP pin of the flash chip from the ESP and connect them both to VCC" ?

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Don't use GPIO 9 or 10

#6 Post by Shardan » 13 May 2017, 23:24

costo wrote: 27 Apr 2016, 14:19 Practically spoken GPIO 6,7,8,9,10 & 11 are dedicated to the flash memory and not usable for other purposes.
Interesting..
In my self designed circuits i use GPIO9 and 10, partly as input (for a DS18B20 for example), partly as output (for driving a relay or a HC-SR04).
These are running for months now with R147/148 without issues.

If GPIO9 / 10 can't be used why does this work without issues?

Regards
Shardan
Regards
Shardan

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: Don't use GPIO 9 or 10

#7 Post by costo » 14 May 2017, 00:20

Shardan wrote: 13 May 2017, 23:24
costo wrote: 27 Apr 2016, 14:19 Practically spoken GPIO 6,7,8,9,10 & 11 are dedicated to the flash memory and not usable for other purposes.
Interesting..
In my self designed circuits i use GPIO9 and 10, partly as input (for a DS18B20 for example), partly as output (for driving a relay or a HC-SR04).
These are running for months now with R147/148 without issues.

If GPIO9 / 10 can't be used why does this work without issues?

Regards
Shardan
Read this article: http://smarpl.com/content/esp8266-esp-2 ... and-gpio10 to find more about GPIO 9&10

These 2 pins are connected to the flash chip, gpio9 on the Hold_pin and GPIO10 on the /WP_pin

If it works in your configuration, that is fine but using these pins can make your ESP unstable or not working at all.
Chances that your ESP will hang when you (re)flash it.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Don't use GPIO 9 or 10

#8 Post by Shardan » 14 May 2017, 03:34

Hello again,

I did some quickcheck on a breadboard with nodeMCU and some searching meanwhile.

I'm able to provoke failures under certain configurations using GPIO9.
With GPIO10 as input or output no Issues occur, tested with a DS18B20 and a DHT22.

I've tested reflashing with these configs and the results are same:
With GPIO9 problems under certain circumstances, with GPIO10 everything is nice.

Following this posting http://bbs.espressif.com/viewtopic.php?t=654
problems with flashing can be avoided with setting flash mode to DIO.
As this is the standard setting in the Arduino IDE I used it's possible i never
noticed issues with that.

The more they mention in that post that this does not work with some nodeMCU boards.
As my sensors are built on self designed PCB's this might lead to results where a nodeMCU fails.

Another point from the post that should be mentioned:
They said that pulling up GPIO10 to high level causes problems. I wasn't able to verify
this as the DS18b20 and the DHT22 both use a 10KOhm resistor as a pullup and worked.
Anyways, this might lead to issues under some circumstances.

Regards
Shardan
Regards
Shardan

kboris
Normal user
Posts: 14
Joined: 13 May 2017, 22:34

Re: Don't use GPIO 9 or 10

#9 Post by kboris » 14 May 2017, 09:53

Thanks to all replys guys. I am using ESP8266 E12. I assume that situation about GPIO 9 and 10 is the same ?!?!

I believe there is the best option not to use this pins but I already made 10 pcs self designed PCB's with GPIO 9 and 10 used for relays :( . I know that this is totaly my fault because I didn't made tests before I made self designed PCB's .....but it is what it is and that is the major reason why I would like to use GPIO 9 & 10.
I will also read sugested posts.

Maybe one question for you Shardan. You mention that problem with GPIO 9 & 10 can be avoided with setting flasj mode to DIO. I am using ESP8266 download tool V3.4.4. Is it enough to chose DIO when I flash my ESP8266 e12 with ESPEasy_R120_4096.bin or I should change some part of code. Please See picture bellow.
ScreenHunter_758 May. 14 09.44.jpg
ScreenHunter_758 May. 14 09.44.jpg (173.83 KiB) Viewed 75759 times
Regards
Boris

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Don't use GPIO 9 or 10

#10 Post by Shardan » 14 May 2017, 14:04

Hello Boris,

don't let me be misunderstood.
Using DIO mode seems to avoid problems with flashing.
I've tested some of my prototype PCB's last night and made some checks with a nodeMCU on a breadboard.
In any case as soon as i use GPIO9 and set it to "low" the ESP crashed. No matter if i send a http://<ip>/control?cmd=GPIO,9,0
or if the firmware for example wants to initialize a sensor connected to GPIO9 it ran into issues.
I was not able to provoke those issues with GPIO10.
Reviewing my existing sensors they use GPIO10, they also never showed issues.

So your PCB's might be worthless sadly.
It's a cold comfort, i know: I'll have to rework some of my new PCB's too.
Luckily i just have one prototype of them and nothing soldered yet.

Regards
Shardan
Regards
Shardan

kboris
Normal user
Posts: 14
Joined: 13 May 2017, 22:34

Re: Don't use GPIO 9 or 10

#11 Post by kboris » 14 May 2017, 19:32

Shardan, thank you for your explanations. I have exactly same situation. If I put GPIO 9 on LOW, ESP constantly restart. OK, I think the faster solution is cut off on PCB GPIO 9 and connect it to GPIO 2. I think there is no issue to used this pin?!?! I know that pin should be HIGH when flasshing but after that I assume it can be used? Can anybody confirm that?

Regards
Boris

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: Don't use GPIO 9 or 10

#12 Post by costo » 14 May 2017, 22:45

During the Boot Process GPIO-2 needs to be HIGH otherwise ESP cannot boot normally.

kboris
Normal user
Posts: 14
Joined: 13 May 2017, 22:34

Re: Don't use GPIO 9 or 10

#13 Post by kboris » 15 May 2017, 21:32

Costo, thank you for your information. What about GPIO 0 ?

Regards
Boris

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Don't use GPIO 9 or 10

#14 Post by toffel969 » 16 May 2017, 00:20

kboris wrote: 15 May 2017, 21:32 Costo, thank you for your information. What about GPIO 0 ?

Regards
Boris
Gpio0 high for normal boot. Gpio low for flashing
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Don't use GPIO 9 or 10

#15 Post by Shardan » 16 May 2017, 11:31

Maybe we should place a table in the wiki with the boot states etc for the GPIO's and which GPIO's
can be used for what purposes or should not be used?

With ESPEasy getting more widespread these questions will come up more often.

Maybe some tricks could be mentioned.
GPIO0 and GPIO2 (must be "high" on boot) can be used as output e.g. for a relay if
you use a relay board (or another actuator) that connects from VCC to GPIO0 / GPIO2.
This way the actuator / relay does not interfere with the necessary pullup resistor from GPIO to VCC.

For the same reason, just the other way round:
GPIO15 (must be "low" at boot) can be used as output if your actuator connects from GPIO to ground.

Regards
Shardan
Regards
Shardan

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Don't use GPIO 9 or 10

#16 Post by grovkillen » 16 May 2017, 11:40

Shardan wrote: 16 May 2017, 11:31 Maybe we should place a table in the wiki with the boot states etc for the GPIO's and which GPIO's
can be used for what purposes or should not be used?

With ESPEasy getting more widespread these questions will come up more often.

Maybe some tricks could be mentioned.
GPIO0 and GPIO2 (must be "high" on boot) can be used as output e.g. for a relay if
you use a relay board (or another actuator) that connects from VCC to GPIO0 / GPIO2.
This way the actuator / relay does not interfere with the necessary pullup resistor from GPIO to VCC.

For the same reason, just the other way round:
GPIO15 (must be "low" at boot) can be used as output if your actuator connects from GPIO to ground.

Regards
Shardan
+1 on that but I also should think some type of warning to be triggered if the settings is somewhat not recommended (within the WebGui?). Or at least a direct link into the wiki?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Don't use GPIO 9 or 10

#17 Post by grovkillen » 16 May 2017, 12:00

I started something here. Please add more information (if you're not an editor you might PM me or just post here).

https://www.letscontrolit.com/wiki/inde ... on_ESP8266
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Don't use GPIO 9 or 10

#18 Post by Shardan » 16 May 2017, 13:55

grovkillen wrote: 16 May 2017, 12:00 I started something here. Please add more information (if you're not an editor you might PM me or just post here).

https://www.letscontrolit.com/wiki/inde ... on_ESP8266
I've edit permisions but i'm not at home atm.

For GPIO 6,7,8,9,11 - Reserved for SPI and Flash - Do not use.
For GPIO 10 - Reserverd for SPI and Flash - use with caution.

Maybe we should open a page for that - the main page slowly gets confusing :)

I'll make some schematics about connecting sensors / actuators for that page.

Regards
Shardan
Regards
Shardan

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Don't use GPIO 9 or 10

#19 Post by grovkillen » 16 May 2017, 14:01

Shardan wrote: 16 May 2017, 13:55
grovkillen wrote: 16 May 2017, 12:00 I started something here. Please add more information (if you're not an editor you might PM me or just post here).

https://www.letscontrolit.com/wiki/inde ... on_ESP8266
Maybe we should open a page for that - the main page slowly gets confusing :)
Yeah we (the editors) need to make a plan for the future structure. :)
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Don't use GPIO 9 or 10

#20 Post by Shardan » 16 May 2017, 20:08

How's about this for a "GPIO" Page in the wiki:
.
ESP-12E_Basic-Circuit.jpg
ESP-12E_Basic-Circuit.jpg (419.6 KiB) Viewed 64693 times
Some explanation text what which part is good for, why connect the opto's like this etc.

Did I miss something in the schematic?

Regards
Shardan
Last edited by Shardan on 27 May 2017, 21:04, edited 2 times in total.
Regards
Shardan

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Don't use GPIO 9 or 10

#21 Post by grovkillen » 16 May 2017, 23:02

Shardan wrote: 16 May 2017, 20:08 How's about this for a "GPIO" Page in the wiki:
Great schematic! Someone more qualified (than me) might add something more?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: Don't use GPIO 9 or 10

#22 Post by costo » 17 May 2017, 12:24

Shardan wrote: 16 May 2017, 20:08 How's about this for a "GPIO" Page in the wiki:
.
ESP-12E_Basic-Circuit.jpg

Some explanation text what which part is good for, why connect the opto's like this etc.

Did I miss something in the schematic?

Regards
Shardan
You forgot GPIO-1 and GPIO-3 , which offcourse are RX/TX but can be used as normal GPIO´s

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Don't use GPIO 9 or 10

#23 Post by Shardan » 17 May 2017, 16:42

costo wrote: 17 May 2017, 12:24 You forgot GPIO-1 and GPIO-3 , which offcourse are RX/TX but can be used as normal GPIO´s
GPIO 1 and GPIO 3 are on the schematic, lead to the "Program" Header.

I've shown the GPIO's 0,2 and 15 in the circuit to show how inputs and outputs can be connected to These
without interfering with the pullups (GPIO 0,2) and the pulldown (GPIO 15).

There has to be some explanatory text added to this schematic:
Why is what in place, which GPIO's usable and so on.
Maybe I'll add the GPIO 1 & 3 to the text with a "HowTo Switch off Serial to make GPIO 1&3 usable" paragraph".

It seems better to me not to overload the schematic with info's and facts.
It is already a lot, so it might be better to split it into several schematics
with examples and separate text.

Regards
Shardan
Regards
Shardan

kboris
Normal user
Posts: 14
Joined: 13 May 2017, 22:34

Re: Don't use GPIO 9 or 10

#24 Post by kboris » 17 May 2017, 21:27

Guys...thumbs UP ;-)

Regards
Boris

kboris
Normal user
Posts: 14
Joined: 13 May 2017, 22:34

Re: Don't use GPIO 9 or 10

#25 Post by kboris » 17 May 2017, 21:29

....so if I understand correct, I can use GPIO 1 and 3 in any state (High or Low) after flashing ?

Regards
Boris

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: Don't use GPIO 9 or 10

#26 Post by costo » 18 May 2017, 03:42

kboris wrote: 17 May 2017, 21:29 ....so if I understand correct, I can use GPIO 1 and 3 in any state (High or Low) after flashing ?
That is a good question :P

I would be carefull, during bootup a short status message can appear on the TX pin. That may interfere with anything connected to that pin. After initialisation when Serial port is disabled , both GPIO´s can be used as input and/or output.

I used them for I2C bus or one wire bus, so with pull_up´s connected to Rx/Tx and have no experience with other uses for those pins.

kboris
Normal user
Posts: 14
Joined: 13 May 2017, 22:34

Re: Don't use GPIO 9 or 10

#27 Post by kboris » 20 May 2017, 10:30

@costo, thank you for your answers. One more question abot GPIO RX and TX. Let me say that I will program both pins to Low. Will I have problems if I would like to reflash ESP?

Resgards
Boris

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Don't use GPIO 9 or 10

#28 Post by Shardan » 20 May 2017, 14:14

kboris wrote: 20 May 2017, 10:30 @costo, thank you for your answers. One more question abot GPIO RX and TX. Let me say that I will program both pins to Low. Will I have problems if I would like to reflash ESP?

Resgards
Boris
Hello Boris,

From the ESP8266 Wiki:

GPIO15 GPIO0 GPIO2 Mode Description
L L H UART Download code from UART
L H H Flash Boot from SPI Flash (running your firmware)
H x x SDIO Boot from SD-card

GPIO15=Low and GPIO2=High usually should be hardwired in your circuit.
Then GPIO0 switches between two different firmwares: Your firmware in the SPI-Flash (GPIO0=High) or a separate firmware, the "loader" (GPIO0=Low).
Following this the settings from your firmware have no effect on flashing.

The only sideeffect is the serial monitoring gets lost.

That is the reason why I avoid using these GPIOs. For testing firmware and
my self developed hardware the serial monitor is a invaluable debugging tool.

Anyways, using these GPIO's is possible. The only thing you definitely have to avoid:
Do not connect sensors that might pull up or down the signal from your USB-TTL converter.
I suggest to use jumpers, a quick drawn schematic:
.
Using_GPIO1_GPIO3.jpg
Using_GPIO1_GPIO3.jpg (108.07 KiB) Viewed 66001 times
.
This way you can switch GPIO's 0,1 and 3 as you need.
For normal use place jumper caps on 3-4, 5-6, 7-8 - the GPIO's are connected to your sensors/actors.
For flashing place one jumper cap on 7-9 and connect your USB-TTL converter to 3 (Tx), 5 (Rx) and 10 (Gnd).

I'd prefer to connect actors to GPIO0 and GPIO2. You may connect sensors anyways, but you have to make sure
a sensor does not give "Low" on startup. This will lead to booting the ESP to the wrong mode.

REgards
Shardan
Regards
Shardan

kboris
Normal user
Posts: 14
Joined: 13 May 2017, 22:34

Re: Don't use GPIO 9 or 10

#29 Post by kboris » 27 May 2017, 20:34

Shardan, many thanks for your explanation.

Regards

TD-er
Core team member
Posts: 9221
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Don't use GPIO 9 or 10

#30 Post by TD-er » 18 Nov 2017, 15:33

Shardan wrote: 20 May 2017, 14:14 [...]
Anyways, using these GPIO's is possible. The only thing you definitely have to avoid:
Do not connect sensors that might pull up or down the signal from your USB-TTL converter.
I suggest to use jumpers, a quick drawn schematic:
.
Using_GPIO1_GPIO3.jpg
.
This way you can switch GPIO's 0,1 and 3 as you need.
[...]
Sorry for brining up such an old topic, but can you (re)share the schematic?
It is no longer available, so it seems.

I have been using D3 (GPIO-0) as TX and D4 (GPIO-2) as RX of the MH-Z19 sensor for a while now and they seem to work fine. Other pins used: D1 (GPIO5) for SCL and D2 (GPIO4) for SDA.
But the last version I made, when using the rev. B of this CO2 sensor, I had to hold the flash button during the entire flash period to upload the firmware.
So GPIO-0 may have been toggling data during flash?

Too bad I have already received my PCBs for this.

I also wanted to use one extra pin for a touch switch (new version of PCB), but I am looking into which pin is capable for this.
The hardware SPI pins are not being used yet, so that's an option.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Don't use GPIO 9 or 10

#31 Post by Shardan » 18 Nov 2017, 16:15

hm... just checked, the schemtic is still there. Maybe try <shift> + <F5> to refresh page or clear browser cache?

Anyways - the schematic was made for a ESP-01,. not for a nodeMCU.
The nodeMCU's and the WeMos D1 have their own circuits inside so additional resistors might not work as expected.

GPIO2 and GPIO15 are used at boot time to select the memory where the firmware resides.
This makes it possible to boot from a SD-card for example - atm not supported with ESPEasy.
GPIO0 pulled to low at boot time selects the boot loader to start with.
For ESPEasy at boot time these pins must be set to:

GPIO0 -> 10KOhm - Vcc (high) (low for starting the boot loader)
GPIO2 -> 10KOhm - Vcc (Memory select)
GPIO15 -_> 10KOhm --> Gnd (Memory select)

If i may ask: Why using a nodeMCU at all? It just takes up power for things like UART-USB converter you need only once
and it makes the whole thing bigger then required.
Another question: Why using these GPIO's at all? IF you use a nodeMCU or an ESP-12 type, there are more GPIO's availlable.

Can you give me a schematic so i can see what you're doing?

Regards
Shardan

PS: I'fe published some tested examples in my user wiki, all schematics and PCB's included.
https://www.letscontrolit.com/wiki/inde ... er:Shardan
Regards
Shardan

TD-er
Core team member
Posts: 9221
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Don't use GPIO 9 or 10

#32 Post by TD-er » 18 Nov 2017, 17:51

The design of the board is here: https://github.com/TD-er/NodeMCU_PCB (see rev 2 directory, rev3 is not usable)
About the "why" using a NodeMCU.
Well, I wanted to have some simple test-board for testing sensors which fit inside the cheapest available plastic case with air vents and something you can power using a standard USB-charger.

I made some pads available for SPI, since there are lots of interesting parts for SPI (already ordered an e-ink screen to play with), but I guess I can use these also for the touch sensors. (ideal to use in plastic cases, since you do not have to drill holes)
Probably a bad idea then to use GPIO-15 :)

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Don't use GPIO 9 or 10

#33 Post by Shardan » 18 Nov 2017, 20:21

Depends. If the touch switch gives a reliable "low" at startup you can use it even with GPIO15. Give it a try, in worst case it boots into flash mode.
If you can give me a schematic i'll give it a try with a pcb cad.

Regards
Shardan
Regards
Shardan

TD-er
Core team member
Posts: 9221
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Don't use GPIO 9 or 10

#34 Post by TD-er » 18 Nov 2017, 22:15

The Fritzing file is also included in the link I gave, however, I used Fritzing only to generate the PCB.

It generates a schematic rev 2 rev 3, but it isn't nice.
I was planning to use these capacitive touch switches. They are bases on the TTP223 and you can select toggle/switch mode and invert by shorting A or B:
Trigger setting mode: (1- > Short ; 0- > No Short)
AB=00:No-lock High TTL level ouput;
AB=01:Self-lock High TTL level ouput;
AB=10:No-lock Low TTL level ouput;
AB=11:Self-lock Low TTL level ouput;
I will test first on a breadboard if it will work.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Don't use GPIO 9 or 10

#35 Post by Shardan » 19 Nov 2017, 01:24

Hm.....
I'd suggest some changes if i understand the schematics right :)

- Two SSD1306 Displays - as far as i know it does not work as the display plugins for LCD and OLED can't handle two displays even with different addresses.
I don't think there's a fix for that, it will need a massive rework of the plugin. But i might be wrong about the fix - try it with two displays before you cut a case :)

- If you need additional GPIO's:
GPIO16 can be used for some purposes. Don't use for counters for example, it won't work. For output, driving a led or relay it works.
GPIO1 (Tx) and GPIO3 (Rx) can be used if you switch off the serial port in the Tools --> Advanced settings.
Be aware that on booting there will be some signals on Tx anyways, a relay or a led might "flicker".
If you deactivate the serial transmission in the advanced settings the GPIO1/GPIO3 can be configured for the CO2-Sensor, i've checked that.
Please test on a breadboard before soldering if that works as expected or if the sensor gets "irritated" by the startup data sent from the ESP.

- You may use GPIO10 (SD3) too. Do NOT use GPIO9, it might crash the ESP.

- Afaik the SPI port of the ESP is on CLK (SDCLK) - SD0 (MISO) - CMD (CS) - SD1 (MOSI). You've used the standard GPIO's for it. Is that correct?
ATM the SPI is not supported for displays and such by ESPEasy as far as i know.

As long as keeping the Flash button pressed all the time for flashing is the only problem i'd say it's tolerable.

In general:
Left pinheader is SPI and 3x I2C. Really SPI, not just some GPIO's broken out?
Right pinheader is 3x I2C and Serial, both headers with power supply.
Is that correct?

Do you plan to plug Displays and touch sensor directly to the PCB or do you plan to use wires?

Can you tell me the exact sizes of the PCB?

Regards
Shardan
Regards
Shardan

TD-er
Core team member
Posts: 9221
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Don't use GPIO 9 or 10

#36 Post by TD-er » 19 Nov 2017, 10:23

Shardan wrote: 19 Nov 2017, 01:24 Hm.....
I'd suggest some changes if i understand the schematics right :)

- Two SSD1306 Displays - as far as i know it does not work as the display plugins for LCD and OLED can't handle two displays even with different addresses.
I don't think there's a fix for that, it will need a massive rework of the plugin. But i might be wrong about the fix - try it with two displays before you cut a case :)
The idea was to have some "universal" experimental print. There was room for it and I figured the display would be about as high as the NodeMCU itself, so there might be some usecase possible where it would make sense to have a display on the same size as the NodeMCU. It was not my intention to have several displays installed at the same time.
On the other hand, limitations in libraries are there to be solved ;)
Shardan wrote: 19 Nov 2017, 01:24 - If you need additional GPIO's:
GPIO16 can be used for some purposes. Don't use for counters for example, it won't work. For output, driving a led or relay it works.
GPIO1 (Tx) and GPIO3 (Rx) can be used if you switch off the serial port in the Tools --> Advanced settings.
Be aware that on booting there will be some signals on Tx anyways, a relay or a led might "flicker".
If you deactivate the serial transmission in the advanced settings the GPIO1/GPIO3 can be configured for the CO2-Sensor, i've checked that.
Please test on a breadboard before soldering if that works as expected or if the sensor gets "irritated" by the startup data sent from the ESP.

- You may use GPIO10 (SD3) too. Do NOT use GPIO9, it might crash the ESP.
That is great information, which I think should be somewhere on the wiki.
Especially the GPIO16 -I can confirm- has little to none description on the wiki. I now understand what is so special about it (no interrupt) and its default use is to perform a reset from deep sleep.
The GPIO10 may be used to perform QIO mode on the flash, so there may be boards which do not have this pin available without soldering, right?
Shardan wrote: 19 Nov 2017, 01:24 - Afaik the SPI port of the ESP is on CLK (SDCLK) - SD0 (MISO) - CMD (CS) - SD1 (MOSI). You've used the standard GPIO's for it. Is that correct?
ATM the SPI is not supported for displays and such by ESPEasy as far as i know.
Those are the pins suggested in the ESPeasy web interface (Hardware => SPI interface.
Currently I do not have SPI devices, other than the e-ink display. So perhaps I can re-use pins on the SPI part to have a touch sensor.
Shardan wrote: 19 Nov 2017, 01:24 As long as keeping the Flash button pressed all the time for flashing is the only problem i'd say it's tolerable.

In general:
Left pinheader is SPI and 3x I2C. Really SPI, not just some GPIO's broken out?
Right pinheader is 3x I2C and Serial, both headers with power supply.
Is that correct?
As seen from the top (the nodeMCU is between the PCB and the bottom of the case)
Please see the images of the PCB here: https://github.com/TD-er/NodeMCU_PCB

The idea is to have about every possible combination of I2C pins on the left and right. Then about any possible I2C sensor board available will fit somewhere.
Also the space for the CO2 sensor is fit for either the MH-Z19 and the Senseair S8 (dimensions and signal compatible, not software compatible)
Shardan wrote: 19 Nov 2017, 01:24 Do you plan to plug Displays and touch sensor directly to the PCB or do you plan to use wires?
The display and the touch sensor will be mounted on a pinheader (which has to soldered first, before the rest).
By using the pinheader, the combined height of the stack will fit exactly inside the case. So the display will be pressed slightly against the top.
Shardan wrote: 19 Nov 2017, 01:24 Can you tell me the exact sizes of the PCB?

Regards
Shardan
I will redo the measuring of the holes again, since the current PCB can only be mounted on 2 holes.
When using 4 screws, the bottom plate of the case will bend a little. So perhaps I was off by a few 10th of a mm. (and use slightly bigger holes)

The board is 50x70 mm.
My caliper suggests 41.6 mm and 61.7 mm between hole diameters.
The hole diameter for the screws must be about 2.5 mm diameter.
Edit: I made some drawing of the bottom plate holes relative to the PCB: https://github.com/TD-er/NodeMCU_PCB/bl ... 0holes.svg

For the new version of this board, I was planning to add some capacitors. Currently when the CO2 sensor is performing a measurement, the Ikea USB power supply makes some high frequency noise. So perhaps adding some capacitors at the 5V line will help to make it more silent and also be more forgiving when using USB cables which are not that good.
With the current PCB version, the NodeMCU was positioned a bit too far inside the case, so I had to use micro USB cables with 8 mm depth on the micro-USB side. That's not standard and probably leaves less room to shop for 'quality' USB cables.
In the Fritzing file of rev2 the NodeMCU was already positioned more to the edge, but I did not take new screenshots of that.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Don't use GPIO 9 or 10

#37 Post by Shardan » 19 Nov 2017, 14:01

TD-er wrote: 19 Nov 2017, 10:23
[...]
On the other hand, limitations in libraries are there to be solved ;)
There was a thread about this problem: http://www.letscontrolit.com/forum/view ... hilit=oled
Seems up to now it came to nothing.
That is great information, which I think should be somewhere on the wiki.
Especially the GPIO16 -I can confirm- has little to none description on the wiki. I now understand what is so special about it (no interrupt) and its default use is to perform a reset from deep sleep.
The GPIO10 may be used to perform QIO mode on the flash, so there may be boards which do not have this pin available without soldering, right?
On some boards it is broken out, on others i have (Wemos D1 Mini for example) it is not, right.
But if you want to integrate more parts on a 50x70 PCB you will have to get used to soldering SMD parts anyways.
Don't worry, it needs no witchcraft.
Those are the pins suggested in the ESPeasy web interface (Hardware => SPI interface.
Currently I do not have SPI devices, other than the e-ink display. So perhaps I can re-use pins on the SPI part to have a touch sensor.
Ah i see - just didn't notice up to now, I never used SPI with ESPEasy up to now.
As seen from the top (the nodeMCU is between the PCB and the bottom of the case)
Please see the images of the PCB here: https://github.com/TD-er/NodeMCU_PCB

The idea is to have about every possible combination of I2C pins on the left and right. Then about any possible I2C sensor board available will fit somewhere.
Also the space for the CO2 sensor is fit for either the MH-Z19 and the Senseair S8 (dimensions and signal compatible, not software compatible)
I see. It might definitely be better to put an ESP-12E/F directly on the board together with a voltage regulator for running on 5V.
I'm using a LF-33CDT for this, it has proved running well.
The display and the touch sensor will be mounted on a pinheader (which has to soldered first, before the rest).
By using the pinheader, the combined height of the stack will fit exactly inside the case. So the display will be pressed slightly against the top.
I see. It would be helpfull if you could provide a Screenshot of the PCB where i can see:
- Pinout: Which pin is which signal on the board
- Positioning: Where are the display/sensor on the board?
A raw marking will do (Print out, sketch parts/pins with a pen, scan in).
I will redo the measuring of the holes again, since the current PCB can only be mounted on 2 holes.
When using 4 screws, the bottom plate of the case will bend a little. So perhaps I was off by a few 10th of a mm. (and use slightly bigger holes)
The board is 50x70 mm.
My caliper suggests 41.6 mm and 61.7 mm between hole diameters.
The hole diameter for the screws must be about 2.5 mm diameter.
Edit: I made some drawing of the bottom plate holes relative to the PCB: https://github.com/TD-r/NodeMCU_PCB/blo ... 0holes.svg
For the new version of this board, I was planning to add some capacitors. Currently when the CO2 sensor is performing a measurement, the Ikea USB power supply makes some high frequency noise. So perhaps adding some capacitors at the 5V line will help to make it more silent and also be more forgiving when using USB cables which are not that good.
With the current PCB version, the NodeMCU was positioned a bit too far inside the case, so I had to use micro USB cables with 8 mm depth on the micro-USB side. That's not standard and probably leaves less room to shop for 'quality' USB cables.
In the Fritzing file of rev2 the NodeMCU was already positioned more to the edge, but I did not take new screenshots of that.
The noise from the power supply is a so called "Coil Beeping". The converter inside the power supply uses a high frequency and if a coil is poorly embedded or coated it tends to resonate. I don't think capacitors will stop that. Anyways some more capacitors is always a good idea. There is a reason why a simple sonoff basic switch is full of capacitors....

Anyways. If you can provide the info mentioned above I'll try to make a PCB layout for a ESP-12 on board with that. But definitely i need a raw sketch where parts reside. Honestly it takes very much time to find out by an undocumented PCB drawing.

Just these days i've tested a new pooling service for PCB production - the PCB quality is unbelieveable. Gold coverer pads (ENIG), contacted vias, silk on both sides, solder resist - it's all included.
Not the cheapest PCB maker, but best price for industrial quality PCB's. For 3 pieces (lowest allowed quantity) you'll pay below 30 € incl. shipping.
That says: Below 30€ for all together!
.
TestPCB_900px.jpg
TestPCB_900px.jpg (541.5 KiB) Viewed 65323 times
.
The layout is made with KiCAD, a free schematics and PCB CAD. The manufacturer can use the files from KiCAD directly, no Gerber export or SVG files necessary.

Regards
Shardan

PS: Even a level shifter for 5V I2C could be integrated with the board.
Regards
Shardan

TD-er
Core team member
Posts: 9221
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Don't use GPIO 9 or 10

#38 Post by TD-er » 19 Nov 2017, 22:34

Shardan wrote: 19 Nov 2017, 14:01 [...]
But if you want to integrate more parts on a 50x70 PCB you will have to get used to soldering SMD parts anyways.
Don't worry, it needs no witchcraft.
For another project, which is going to be based on the ESP8266 and has to be low power and portable, there certainly will be some need for SMD stuff and a separate power supply.
Shardan wrote: 19 Nov 2017, 14:01 I see. It would be helpfull if you could provide a Screenshot of the PCB where i can see:
- Pinout: Which pin is which signal on the board
- Positioning: Where are the display/sensor on the board?
A raw marking will do (Print out, sketch parts/pins with a pen, scan in).
I can do even better than a raw marking.
There is a "ZofzPCB" project file.
If you're running Windows, you can download the free viewer on https://www.zofzpcb.com
This viewer allows to view traces (and distances etc.) by simply hovering over a trace or hole and press "N" for net view or "H" for hole inspection and distance measuring.
You can also peel off layers.
Here are the static screenshots: https://github.com/TD-er/NodeMCU_PCB/tr ... creenshots

And here the photo of an assembled rev2 board: https://raw.githubusercontent.com/TD-er ... d_rev2.jpg
Shardan wrote: 19 Nov 2017, 14:01 The noise from the power supply is a so called "Coil Beeping". The converter inside the power supply uses a high frequency and if a coil is poorly embedded or coated it tends to resonate. I don't think capacitors will stop that. Anyways some more capacitors is always a good idea. There is a reason why a simple sonoff basic switch is full of capacitors....
I'll just have a try at it. Using another USB charger is always an option. However, I was hoping the Ikea adapter would be up for it.
Shardan wrote: 19 Nov 2017, 14:01 Anyways. If you can provide the info mentioned above I'll try to make a PCB layout for a ESP-12 on board with that. But definitely i need a raw sketch where parts reside. Honestly it takes very much time to find out by an undocumented PCB drawing.
The pinout used is quite easy:
D1 (GPIO5) SCL
D2 (GPIO4) SDA
D3 (GPIO0) TX
D4 (GPIO2) RX
D5 (GPIO14) HSCLK
D6 (GPIO12) HMISO
D7 (GPIO13) HMOSI
D8 (GPIO15) HCS

And for rev. 3, I now have added some soldering pads which allow to choose which of the pins D5..D8 is used for the touch sensor.

Only thing is, I do not (yet) have the single ESP12F boards. I'll try to order a bunch.
At least they are closer to the PCB, so there may even be more room above the PCB left inside the enclosure. (they fit well between PCB and bottom plate)
But I think they will be all-in-all more expensive because you need extra components like for (USB) power connectors, regulators and perhaps some more components.
Shardan wrote: 19 Nov 2017, 14:01 Just these days i've tested a new pooling service for PCB production - the PCB quality is unbelieveable. Gold coverer pads (ENIG), contacted vias, silk on both sides, solder resist - it's all included.
Not the cheapest PCB maker, but best price for industrial quality PCB's. For 3 pieces (lowest allowed quantity) you'll pay below 30 € incl. shipping.
That says: Below 30€ for all together!
.
TestPCB_900px.jpg
.
The layout is made with KiCAD, a free schematics and PCB CAD. The manufacturer can use the files from KiCAD directly, no Gerber export or SVG files necessary.

Regards
Shardan

PS: Even a level shifter for 5V I2C could be integrated with the board.
30 euro for 3 boards is way more expensive compared to what I paid at [urlhttps://www.itead.cc/open-pcb.html]itead.cc[/url] (15$ for 12 boards + 5 euro shipping) and what Seeedstudio is charging (4,99 $ for 10 boards, excl shipping)
I did not order yet at Seeedstudio.
The project I'm planning will eventually have a few dozen CO2 sensors and thus prices are becoming an issue.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Don't use GPIO 9 or 10

#39 Post by Shardan » 22 Nov 2017, 14:21

Can't do much with that.
I could make some layouting - definitely i won't install lots of programs and invest most time to decode.

The price of PCB's... comparing apples with oranges does not help.
I've just caluclated the shown PCB's at seedstudio - with th same parameters, says ENIG-surface, both-sided silks, electric check...
SeedStudio is around double the price i paid.
Regards
Shardan

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest