These are chat archives for esp8266/Arduino

9th
Nov 2015
Victor Aprea
@vicatcu
Nov 09 2015 16:32
@igrr are you around?
Ivan Grokhotkov
@igrr
Nov 09 2015 16:41
@vicatcu yes, sort of
Victor Aprea
@vicatcu
Nov 09 2015 16:42
@igrr i'm working on getting this new board up and running, and using esptool-ck with -cd nodemcu seems to be making GPI0->low follow Reset->high
should be the other way around right?
....and thought i copied the nodemcu-devkit circuit
Ivan Grokhotkov
@igrr
Nov 09 2015 16:44
i.e. it doesn't pull reset low?
Victor Aprea
@vicatcu
Nov 09 2015 16:44
it does
but he transition of reset from low to high precedes the transition of GPIO0 from high to low...
i'm playing with hacking / rebuilding esptool-ck to see if I can add a new board
maybe ft231x usb chip acts behaves differently for rts/dts signals
Ivan Grokhotkov
@igrr
Nov 09 2015 16:46
ok, not near my scope right now, will check
This message was deleted
Victor Aprea
@vicatcu
Nov 09 2015 16:46
FTDI FT231x for USB
Ivan Grokhotkov
@igrr
Nov 09 2015 16:46
ok
Victor Aprea
@vicatcu
Nov 09 2015 16:47
maybe it has inverted flow control outputs?
anyway, i'll see what I can learn by hacking on esptool-ck
Ivan Grokhotkov
@igrr
Nov 09 2015 16:47
do they return to high level when idle?
if they do, they are not inverted
Victor Aprea
@vicatcu
Nov 09 2015 16:47
GPIO0 and Reset are both high in steady state
and same with RTS/DTS
i mean RTS/DTR
Ivan Grokhotkov
@igrr
Nov 09 2015 16:52
i just checked nodemcu schematic
RST and GPIO0 can not be both low at the same time
it's either both high, one low, or another low
ideally the switch between "RST low" and "GPIO low" should take less time than it takes the chip to sample input pins.
perhaps ft231x has some timing differences w.r.t cp2102 and ch340g...
Jeff Eberl
@jeffeb3
Nov 09 2015 16:55
In my manual button pushing, I make reset low, then GPIO0 low, then reset high, then GPIO0 high.
So that sounds right.
" transition of reset from low to high precedes the transition of GPIO0 from high to low..."
oh no, nm. Not enough coffee today.
Victor Aprea
@vicatcu
Nov 09 2015 16:58
@igrr ok looking at a longer time scale on the scope now
GPIO/RESET sequence goes
H/H
H/L
H/H
L/H
H/H
H/L
Victor Aprea
@vicatcu
Nov 09 2015 17:08
@igrr I measure about 390 microseconds after "RST high" I see "GPIO0 low"
i did add a single discrete AND gate delay on GPIO0, but I wouldn't think that would be a problem
Victor Aprea
@vicatcu
Nov 09 2015 17:24
the circuit also seems to go a little bit "non-digital" for extended periods of time, I presume because RTS and DTR float for some transient period of time and giving way to pickup from the 26MHz oscillator
Victor Aprea
@vicatcu
Nov 09 2015 19:38
@igrr hey I'm back
I have been able to load my 32Mbit ESP module using the Espressif Flash Download Tool in Windows (by using the 1284 to force the boot state to UART in software)
@igrr schematics are here for your interest http://update.wickeddevice.com/ESP8266_Mega1284.pdf
Victor Aprea
@vicatcu
Nov 09 2015 19:44
using this sketch on the Mega1284 https://gist.github.com/vicatcu/f770d5edca31251ac7e1
but can't quite figure out the incantations to get it to automatically load from Arduino
I think I should add a pull-up to 3.3v on the RTS_ESP_GPIO0_3V3 net, but it doesn't seem to matter to the Flash Downloader tool
I kind of thought it would "just work" if I selected NodeMCU as the board
wishful thinking I guess :)
Victor Aprea
@vicatcu
Nov 09 2015 19:54
Even if I choose Generic ESP8266 Module and force UART boot mode by hard-wiring GPIO0 to GND, I still get "warning: espcomm_sync failed" and "error: espcomm_open failed" from Arduino upload
d-anders
@d-anders
Nov 09 2015 19:55
are you trying to get "auto-reset" working on a custom board?
Victor Aprea
@vicatcu
Nov 09 2015 20:00
@d-anders yes that's what i'm trying to do
i'm struggling a little at the moment though
d-anders
@d-anders
Nov 09 2015 20:07
maybe an idea:

I'm using cp2102 USB to TTL with Windows 8.1, connecting DTR to GPIO0 and RTS (not RST!) to REST in my ESP-12 and I'm flashing with the click of a button... no extra hardware, buttons, capacitors or whatever (sometimes I have to click a second time, but that's probably just a missing pullup or capacitor somewhere).

in "C:\Espressif\utils\esptool.py" :

def connect(self):

RTS = EXT_RSTB

DTR = GPIO0

print 'Entering bootloader...'
self._port.setRTS(True)
self._port.setDTR(True)
time.sleep(0.25)
self._port.setRTS(False)
self._port.setDTR(True)
time.sleep(0.25)
self._port.setRTS(False)
self._port.setDTR(False)

heh, not sure why that text was formatted that way
anyway, i had that info stored, haven't tested it myself
supposen to work for a generic esp8266 module in eclipse
also the nodemcu "auto-reset" feature doesnt work 100% for me
Victor Aprea
@vicatcu
Nov 09 2015 20:14
hm.
Victor Aprea
@vicatcu
Nov 09 2015 21:04
@d-anders @igrr I wonder if I should have just hooked it up straight to the USB chip flow control signals like so instead of this NPN cross-strap circuit (since it seems like -cd ck is used most often with esptool in the IDE board selections, which states "RTS controls RESET or CH_PD, DTR controls GPIO0")
d-anders
@d-anders
Nov 09 2015 21:06
if your goal is to have "easy" programming of generic esp-12:s for example then any external circuitry is best avoided if possible
Markus
@Links2004
Nov 09 2015 21:07
its possible with no transistors see: https://github.com/Links2004/Arduino/blob/master/doc/boards.md#esp-to-serial
but the internal serial monitor works not with this, until the arduino IDE merge our patches.
if you use any other terminal it work like a charm.
d-anders
@d-anders
Nov 09 2015 21:11
is the problem with how arduino-ide resets a device when the serial monitor is started?
Victor Aprea
@vicatcu
Nov 09 2015 21:12
d-anders yup, I thought this was the recommended auto-reset circuit
Markus
@Links2004
Nov 09 2015 21:12
yes the keep DTR and RTS low, then the ESP is reseted and will not work.
d-anders
@d-anders
Nov 09 2015 21:12
yeah ok
i never use arduino ide serial monitor
because i dont like it
Victor Aprea
@vicatcu
Nov 09 2015 21:13
wait, the arduino serial monitor messes with auto-reset how?
d-anders
@d-anders
Nov 09 2015 21:13
when you start it it will reboot the device
Victor Aprea
@vicatcu
Nov 09 2015 21:13
oh yea
it's a "feature" :)
Markus
@Links2004
Nov 09 2015 21:13
if you open the serial monitor the put DTR and RTS low.
Victor Aprea
@vicatcu
Nov 09 2015 21:13
it's a transient
d-anders
@d-anders
Nov 09 2015 21:13
but doing so it will cause esp8266 to go into updating bootloader
Victor Aprea
@vicatcu
Nov 09 2015 21:14
oh i see what you mean
it's a transient that causes the esp8266 to go into uart boot state
i don't think that's a major concern for me at the moment :)
Markus
@Links2004
Nov 09 2015 21:14
no not bootloader the RTS is connected to reset so its a dead ESP ;)
Victor Aprea
@vicatcu
Nov 09 2015 21:15
RTS doesn't get stuck low, it just blips low right?
d-anders
@d-anders
Nov 09 2015 21:15
ahh, ok, even worse
Markus
@Links2004
Nov 09 2015 21:16
last time i take a look at the logic analyzer it was low until close of the Serial monitor same for DTR.
Victor Aprea
@vicatcu
Nov 09 2015 21:16
anyway, i think i can hack some zero-ohm resisters in to bypass these npn transistors and see if it works
lol
@Links2004 oh that's really dumb if it's true
those signals are conventionally supposed to be active low
and i can't imagine a reason the serial monitor should cause them to be active
time for some hot air rework
Markus
@Links2004
Nov 09 2015 21:19
the avr boards have a capacitor between DTR and the Reset pin to generate a short pulse out of the "endless" low signal
ok here is the java code for it:
https://github.com/arduino/Arduino/blob/master/arduino-core/src/processing/app/Serial.java#L115
the last to parameter are RTS and DTR, and they are true --> low signal
d-anders
@d-anders
Nov 09 2015 21:23
ok, so basically screw the internal serial monitor for the time beeing :)
are your suggested patch that they should pulse RTS?
keeping dtr low should be sort-of-ok even though it is not optimal
Markus
@Links2004
Nov 09 2015 21:29
dtr low will end in bootloder mode not good, you normally like to debug you application.
arduino/Arduino#4102
@d-a-v has submitted a pull request
Victor Aprea
@vicatcu
Nov 09 2015 21:30
that was a rather easy hack
but it still no worky...
Markus
@Links2004
Nov 09 2015 21:31
CH_PD has an pullup?
Victor Aprea
@vicatcu
Nov 09 2015 21:32
enable, ya
at least now i'm seeing GPIO0 and RST move when i hit upload
Markus
@Links2004
Nov 09 2015 21:32
so it look like this:
PIN Resistor Serial Adapter
VCC VCC (3.3V)
GND GND
TX or GPIO2* RX
RX TX
GPIO0 PullUp DTR
Reset* PullUp RTS
GPIO15* PullDown
CH_PD PullUp
Victor Aprea
@vicatcu
Nov 09 2015 21:34
@Links2004 yea, so I think I see the problem
i was lazy and used a 10k instead of a 0-ohm
10k series + 10k pullup means RST is only going halfway down
:) back to the hot air
d-anders
@d-anders
Nov 09 2015 21:38
yeah, 1.15v is probably not low enough to be a logical 0
@Links2004 How come ch_pd can't be connected directly to 3.3v (haven't read the specs on that one)?
Markus
@Links2004
Nov 09 2015 21:41
its used for deep sleep, then GPIO16 needs to be connected to ch_pd.
if deep sleep is activated GPIO16 is pulled low by the RTC, 3V3 without pull up will damage the chip in this setup.
Victor Aprea
@vicatcu
Nov 09 2015 21:42
in which setup?
d-anders
@d-anders
Nov 09 2015 21:42
yeah, right
Markus
@Links2004
Nov 09 2015 21:43
@vicatcu the wirering for deep sleep
Victor Aprea
@vicatcu
Nov 09 2015 21:43
dang it, what's wrong now
RST is definitely going all the way to 0 now
when it comes back to 3.3V, GPIO is definitely at 0
d-anders
@d-anders
Nov 09 2015 21:45
how long does gpio stay at 0?
"forever" still?
Victor Aprea
@vicatcu
Nov 09 2015 21:45
um... no
Markus
@Links2004
Nov 09 2015 21:46
for boot loading "forever" is good, but not needed, some milli seconds are ok.
d-anders
@d-anders
Nov 09 2015 21:46
yeah, but a few millis are needed
Victor Aprea
@vicatcu
Nov 09 2015 21:46
it's doing this crazy 24MHz thing after about 16ms after RST comes up
i want to say like GPIO0 is floating
d-anders
@d-anders
Nov 09 2015 21:47
you are trying to get into "programming" mode now?
Markus
@Links2004
Nov 09 2015 21:48
GPIO0 has an pullup, so no floating, its the bootloader wich is checking the pin state.
what do you see at the serial terminal at ~76800 Baud
(you may need manual control RTS / DTR in you serial terminal program)
  1. set RTS + DTR
  2. release RTS
ESP shut bring messages at ~76800 Baud
Victor Aprea
@vicatcu
Nov 09 2015 21:52
well in my circuit GPIO0 is driven by the output of an AND gate
but anyway... lets see about that output
hm... something's holding RST low and GPIO0 low
PuTTY was!?
what the hell
that implies PuTTY was doing the same RTS/DTR low business you were talking about earlier
Markus
@Links2004
Nov 09 2015 21:55
yes, putty has no manual RTS / DTR control
try realTerm or Hterm
Victor Aprea
@vicatcu
Nov 09 2015 21:58
sure.. one sec
@Links2004 RealTerm seems to be doing the same thing
tried selecting both RTS/CTS and DTR/DSR under hardware flow control
both seem to end up with both signals low
Markus
@Links2004
Nov 09 2015 22:01
blob
no hardware flow control
use the Pins tab for control it
Victor Aprea
@vicatcu
Nov 09 2015 22:02
seems like i can only control one of them
and it seems like when i click set/clear DTR GPIO0 responds (0/1 respectively)
Markus
@Links2004
Nov 09 2015 22:05
thats is good DTR is working fine then, so no reaction on the RTS pin?
can it have something to do with the AND gate you use?
Victor Aprea
@vicatcu
Nov 09 2015 22:06
well DTR should be controling RST, not GPIO0 shouldn't it?
i certainly thought that's what i had done with my bodge wiring
Markus
@Links2004
Nov 09 2015 22:07
DTR controling GPIO0
Victor Aprea
@vicatcu
Nov 09 2015 22:07
yea, that's right, i'm just getting bleary eyed
Markus
@Links2004
Nov 09 2015 22:07
so it look like this:
PIN Resistor Serial Adapter
VCC VCC (3.3V)
GND GND
TX or GPIO2* RX
RX TX
GPIO0 PullUp DTR
Reset* PullUp RTS
GPIO15* PullDown
CH_PD PullUp
Victor Aprea
@vicatcu
Nov 09 2015 22:07
so the AND gate is not involved at all in the RST control
Markus
@Links2004
Nov 09 2015 22:08
may the RTS output of the serial usb chip is damaged?
Victor Aprea
@vicatcu
Nov 09 2015 22:09
well the light doesn't even go on and off in RealTerm when i click the Set/Clear buttons
Markus
@Links2004
Nov 09 2015 22:10
oO you mean the green one?
blob
Victor Aprea
@vicatcu
Nov 09 2015 22:10
correct
figured it out
Markus
@Links2004
Nov 09 2015 22:10
blob
Victor Aprea
@vicatcu
Nov 09 2015 22:10
yup exactly :)
i've lost track of what i was trying to accomplish with realterm
Markus
@Links2004
Nov 09 2015 22:12

what do you see at the serial terminal at ~76800 Baud
(you may need manual control RTS / DTR in you serial terminal program)

  1. set RTS + DTR
  2. release RTS

ESP shut bring messages at ~76800 Baud

Victor Aprea
@vicatcu
Nov 09 2015 22:13
ah right
yea so ... ets Jan 8 2013,rst cause:2, boot mode:(1,7)
when RTS is clear and i set dts
Markus
@Links2004
Nov 09 2015 22:14
so you are in bootloading mode ;) now try to upload.
Victor Aprea
@vicatcu
Nov 09 2015 22:16
@Links2004 no joy
disconnected from realterm
clicked upload in Arduino
espcomm_sync failed, esp_open failed
Markus
@Links2004
Nov 09 2015 22:17
try to select generic ESP as board, nodeMCU not working with this modifications.
if still not working try to lower the upload speed
Victor Aprea
@vicatcu
Nov 09 2015 22:17
blob
lower speed, same effect
i really don't understand why GPIO0 looks so crazy on a scope
Markus
@Links2004
Nov 09 2015 22:20
strange, the ets Jan 8 2013,rst cause:2, boot mode:(1,7) shows that you enter the bootloader mode with realterm.
the upload shut do the same.
Victor Aprea
@vicatcu
Nov 09 2015 22:21
it's very clearly showing a 26MHz clock waveform min 280mV, max 4.04V
Markus
@Links2004
Nov 09 2015 22:21
4.04V?? normally the ESP has only 3.3V.
Victor Aprea
@vicatcu
Nov 09 2015 22:22
i know, there's nothing connected to the ESP8266 that's not 3.3V
d-anders
@d-anders
Nov 09 2015 22:23
heh
Markus
@Links2004
Nov 09 2015 22:23
is something connected to GPIO2?
Victor Aprea
@vicatcu
Nov 09 2015 22:24
pulled up to 3.3v
through 10k
the only thing is i feed a 5V signal into one input of the AND gate
but the AND gate is powered at 3.3V and should have 5V tolerant inputs as i read the datasheet
RST is high, EN is high, GPIO is inexplicably clocking
Markus
@Links2004
Nov 09 2015 22:28
ok the circuit is dangers if the application later on set the pin as output, its and end up in a ESP vs AND gate.
but thats is not you boot problem i think.
Victor Aprea
@vicatcu
Nov 09 2015 22:30
yup GPIO0 should probably be protected by a series resistor
but i don't think it's actually broken
d-anders
@d-anders
Nov 09 2015 22:31
you are using a bare esp-12 with nothing connected to its other io's?
Markus
@Links2004
Nov 09 2015 22:31
right now I am out of ideas.
Victor Aprea
@vicatcu
Nov 09 2015 22:32
i'm using a WT-8266-S1 module
yea pretty naked, it's UART is just connected to a Mega1284P
@Links2004 thanks for your ideas :)
d-anders
@d-anders
Nov 09 2015 22:35
ok. the reason i asked is that when i used my nodemcu i had some sensor connected to its pin 4 (i think) which turned out to be gpio2 (i think) which turned out to be a very bad idea
Victor Aprea
@vicatcu
Nov 09 2015 22:38
sure
the problem with this direct connect of RTS and DTR to the ESP is that RTS ends up getting held low
even by the Espressif Flash Download Tool when it tries to connect
xbary
@xbary
Nov 09 2015 22:39
HI
Moje wynalazki na ESP, pochwale siÄ™.
My inventions ESP, praise be.
:D
Victor Aprea
@vicatcu
Nov 09 2015 22:40
i'm going to switch back over to linux and try esptook-ck from the command lne
later all, if anyone has a thought, please give ma clue on twitter @vicatcu
later
d-anders
@d-anders
Nov 09 2015 22:41
im confused again. if rts is constantly low your device should be constantly rebooting?