ESP8266 Wiring Questions

Posted on
  • Hi, I'm looking at ways to connect an ESP8266 (ESP12) to an STM32 that leave maximum free pins available, and was wondering if anyone knew:

    • GPIO0 puts the ESP8266 into bootloader mode - but does the ESP8266 care what GPIO0 is set to at any point apart from right after reset or power on?
    • Does GPIO2 need pulling up, or can it be left disconnected? If it does, does it absolutely need a resistor? I'd be using the AT command firmware so hopefully the code won't be pulling it down.
    • What does GPIO16 do on the ESP12? I've seen it pulled up to 3.3v with a resistor, but is that required or can it just be shorted?
    • Anything else that's needed for an ESP12?
    • gpio0: no
    • gpio2: needs pull-up resistor, it's the uart1 TX which is used for debug output, so hard-wiring will consume a lot of power and possibly destroy the output driver
    • gpio16 does not need to do anything
    • pull-up and hardwire-up reset and ch_pd
    • pull-down gpio15
  • Oooh, is this for that board you mentioned a little while ago with a more-memory-heavy STM32 paired with an on-board ESP8266 for wifi connectivity? I'm definitely paying attention ;-)

  • Sorry if my earlier email was terse. My canonical esp8266 design has:

    • LM3671 switching regulator with 4.7uF pre and 22uF post regulation cap, and 2.2uH inductor (all 0805 SMD)
    • LED and 1K pull-up on gpio0 and gpio2
    • 10K pull-down on gpio15
    • 10k pull-up on ch_pd and on reset (or tie ch_pd high)
  • If you are considering a new board with ESP8266 controlled by another MCU please take into consideration the serving of pin CH_PD by one output pin of the master MCU. In many situations we don't need to power on ESP8266 in the same time as master MCU (battery life), it means that on the PCB could be any jumper with two positions:

    1. 4K7 pull-down ... the ESP8266 is not powered on together with master MCU but later as required by master MCU,
    2. 4K7 pull-up ... the ESP8266 is powered on together with master MCU but can be powered off by mater CPU.
      I am using this arrangement and it is very helpful when you are running on battery. BTW the pin CH_PD can be used as RESET too, it means you can save output pin of master MCU for the pin RST of ESP8266.
      Note: if you plan to connect GPIO2 to the master CPU please connect it with pin which could be RX... it would be useful for "cathing" of debug output from TX UART1.
  • Thanks for all the info!

    is this for that board you mentioned a little while ago with a more-memory-heavy STM32 paired with an on-board ESP8266

    Yes, it's still very early days, but I'm working on a PCB now.

    please take into consideration the serving of pin CH_PD by one output pin

    Yes, absolutely.

    4K7 pull-up

    I doubt you really want this... When pulled down by the MCU it's using almost 1mA (3.3v / 4700 = 0.7mA) to fight against it :)

    @tve is there any reason for the resistor on GPIO15? I'm just trying to reduce component count :)

    Also, can CH_PD really act as reset? So I could just connect reset to 3.3v, and then use CH_PD with GPOI0 low to put the board into bootloader mode? It'd be nice to save an IO pin :)

    Switching regulator is a nice idea - any idea what the quiescent current of that one is? I'd like to keep the battery life as high as possible.

    P.S. I'm thinking of ditching the Battery + USB switchover FET. Just seems like extra trouble and I'm not sure anyone really uses it.

  • also check this ESP12 shifter from adafruit

  • ch_pd can indeed be used as reset.
    The resistor on gpio15 is most likely not needed as long as you don't output on gpio15, which would result in excessive power consumption (I've had this happen).
    I have not tested the quiescent current on the regulator. I'm not sure how much it matters. I recently read http://www.ganssle.com/reports/ultra-low­-power-design.html about battery operation, which I've found very fascinating.

  • @Gordon

    4K7 pull-up
    I doubt you really want this... When pulled down by the MCU it's using almost 1mA (3.3v / 4700 = 0.7mA) to fight against it :)

    Surely the resistor can have higher value e.g. 10K but on the other side 0,7mA is 100 times less than avg. consumption of ESP8266 which is in ON state :)
    Frankly said I am using the other mode ... when ESP8266 is permanently switched off (pull-down resistor) and I turn it on at the moment when I need to send some data ... to understand my idea look at the picture... there are 3 options

    • Rx -> GND ... ESP8266 NormallyOff
    • Rx -> 3V3 ... ESP8266 NormallyOn
    • Rx -> NC ... On/Off state of ESP8266 is determined by MCU

    ... and still remains the possibility to generate RESET impulse and save one output of MCU for RESET signal
    ... probably a standard jumper would be too big for your PCB but wouldn't be bad to have this option in the form of 3 holes on the PCB
    ... the resistor on GPIO15 has to be there... GPIO15=MTDO.. if you want to boot from flash then you need pull-down
    ... It is also good to have RESET pin with pull-up resistor because then you can connect together pins RESET and GPIO16 -> generate wake-up signal from deep sleep mode... although I'm not sure if this mode is useful in this configuration (MCU+8266)
    ... You can find good info in the material from Espressif "0B-ESP8266Hardware_User_GuideEN_v1.1.pdf" ...
    ... link http://bbs.espressif.com/viewtopic.php?f­=51&t=818


    1 Attachment

    • 8266_CH_PD.jpg
  • Don't forget that some of the ESP modules have their own resistors on the module...

    For example, there seems to be a 4.7k pulldown on GPIO0 on the ESP12F modules I bought from the link @tve posted, unless I botched the soldering job something hardcore.

    That could make your board smaller (or at least cheaper).

  • Thanks! I sent a prototype off earlier this week - I guess it's worth having pads for the resistors there, but if the modules I fit has then on then I can leave my boards's ones off.

  • Hm, I don't seem to need an external resistor on either GPIO0 or GPIO2 (using ESP12F modules)

  • At reset all the gpio pins have the internal pull-up enabled. However, given that that's pretty darn weak (40Kohm min) it may work sometimes and not other times. I do believe that the LED on the module is on gpio2, in that case the LED and it's associated resistor indeed act as external pull-up, though.

  • According to this reverse-engineered schematic, you can omit a pull-up on reset and on gpio2, but I would not skip the pull-up on gpio0...
    http://www.addicore.com/v/vspfiles/downl­oadables/Product%20Downloadables/ESP8266­/schematic_esp-12-q.png

  • Thanks! That's really good to know... The prototype has been posted so I should get it back in a week or so - but by the look of it I'll skip the resistors (except for a pull-dowm on CH_PD), and will replace them with a LED on GPIO2. As I'll be connecting GPIO0 to the STM32, I can make sure it's set to the correct state.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

ESP8266 Wiring Questions

Posted by Avatar for Gordon @Gordon

Actions