logo elektroda
logo elektroda
X
logo elektroda

[Solved] [Electronics] ESP-12F: N-mosfet control at boot, GPIOs

prm_ex 1011 5
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 17345169
    prm_ex
    Level 9  
    Hello
    I am creating a circuit based on the ESP-12F itself which is supposed to operate over I2C various peripherals (sensors) and control several circuits digitally or via N-mosfets. (please don't look at the mosfet designations - examples from the Eagle library)
    Buttons and programming connections are not envisaged, as I have a separate programmer with which I can program the ESP in the target circuit.
    I don't plan to use the lower ESP pins (no holes) because they are used for flash and I will need that after SPI.

    The initial schematic looks like this:
    [Electronics] ESP-12F: N-mosfet control at boot, GPIOs .

    And now the dilemmas arise:

    1. at boot the only pins that are not H are GPIO4 and GPIO5, but these are used for I2C.
    So I am reliant on the other pins. The snag is that I want to connect N-mosfets under 3-4 pins. Unfortunately it is unacceptable
    to give H on reset even for a moment. Does it make sense to try to solve this by inverter and set pin in setup() as high,
    and to switch the mosfet on simply change the state to low? Is this likely to work?

    2. if the ESP is already programmed do I need to do GPIO15 with a pull-down or can I not do that and use it like a normal pin?

    3) If I connect a mosfet (as on the schematic, through a resistor and with a resistor to ground) to GPIO0, won't it accidentally enter
    into flash mode on reboot? (it is possible that using the above inverter this issue would also be solved)

    4. can I also set the ADC as digital input or output or does it only work as "analog input"?

    I kindly ask for your consultation.
    kind regards
  • ADVERTISEMENT
  • Helpful post
    #2 17345500
    dktr
    Level 25  
    Use the PCF8574 on i2c and control the mosfets from it. There will be no problem with transients during reboot. A low state on GPIO0 puts the chip into flash mode on boot.
  • ADVERTISEMENT
  • #3 17346533
    prm_ex
    Level 9  
    @dktr - master of consultation. Answered 5 questions in one short sentence.
    Thank you - the points have gone.

    Should sort out my dilemmas. Admittedly it only goes to 100kHz and all my I2C slaves will go to 400, but I manoeuvre the pins infrequently and will try a speed switch for this time.
  • ADVERTISEMENT
  • Helpful post
    #4 17354425
    krzbor
    Level 27  
    I am promoting a topic in the footer about solving ESP start problems. It is based on bipolar transistors, but you may find it useful.
  • ADVERTISEMENT
  • #5 17406566
    prm_ex
    Level 9  
    To avoid switching speeds I still found a PCF8575 at 400kHz but there is another problem. Or actually two.
    1. the maximum current on the HIGH output is 300uA. I wonder if this is enough to fully open the n-mosfets.
    2. When switching on, the pin states are input which results in a high state until they are set to output/low. I'm afraid I'll have time to open (unless point1 is an issue) the n-mosfets which is unacceptable in my application.
    So I am still in a quandary.
    Do you know of any other I2C 400kHz expanders that are LOW by default and will give in HIGH enough current to open the mosfets?
  • #6 17951932
    prm_ex
    Level 9  
    .... For those having a similar problem and reading the topic:
    In the end, since I have other peripherals on SPI, I used the MCP23S08 which took care of the issue completely and the mosfets open beautifully.
    The CS occupies one pin, and I freed up 2 pins (I2C) so there was enough for e.g. 2 more CS' for the SPI peripherals.
    The MCP23S08 "fits like a glove". As long as I don't deliberately enable output and HIGH, there is 0x00 on the pin and the mosfets are silent.
ADVERTISEMENT