These are chat archives for esp8266/Arduino

8th
Aug 2016
manucatni
@manucatni
Aug 08 2016 02:30
@MarcoMengoli about esp8266 12e. i want to connect it to arduino without a shield and program it to run independently thereafter
Ivan Grokhotkov
@igrr
Aug 08 2016 08:16
@gmag11 the issue with restart looks very much like you haven't applied external reset to the ESP after uploading the code
currently ESP.restart() doesn't work if used after serial upload, and the resulting message is the same as you have posted above
Clemens Kirchgatterer
@everslick
Aug 08 2016 09:19
This message was deleted
Germán Martín
@gmag11
Aug 08 2016 09:49
@igrr It was exactly that. Thank you. Is there any known reason for that?
Another one: How can I get AP list from an sync
From an async function?
Currently I always get 0 networks.
Stavros Korokithakis
@skorokithakis
Aug 08 2016 09:57
quick question: i use cutecom with crlf line endings, 8 data bits, 1 stop bits, no parity, and it works fine with my a6. i specify the same settings in picocom, yet the a6 does not respond to commands at all. what could i be missing?
Ivan Grokhotkov
@igrr
Aug 08 2016 10:06
It doesn't work from async, but there is scanNetworksAsync which you can use.
@gmag11
regarding restart — yes, the reason is known, it is because chip boot mode gets latched on external reset only. so once you do ESP.restart, it will boot using the boot mode which was latched at the previous external reset. in this case previous reset happens to be done by upload tool, so the ESP ends up restarting into upload mode.
Rohit Yermalkar
@romuye123
Aug 08 2016 10:41

what settings should be used in arduino ide ( esp8266 -12e) to generate a .bin file to be uploaded using esptool.py ?

my settings:
Board: Generic Esp8266 module
Flash Mode: QIO
Flash Frequency: 40 Mhz
CPU Frequency: 80 Mhz
Flash Size: 1M ( 64k SPIFFS )
Reset Method: ck
Upload Speed: 115200

but these settings do not work gives an error after esp boots:

ets Jan 8 2013,rst cause:4, boot mode:(3,6)

wdt reset load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d v09f0c112 ~ld

Ivan Grokhotkov
@igrr
Aug 08 2016 10:43
what is your esptool.py command line?
Rohit Yermalkar
@romuye123
Aug 08 2016 10:44
sudo esptool.py -p /dev/cu.SLAB_USBtoUART write_flash -fm dio -fs 1m 0x0000 /Users/Python/Desktop/Hexfiles/Myapp.cpp.bin
esptool.py v1.2-dev
Connecting...
Running Cesanta flasher stub...
Flash params set to 0x0200
Writing 344064 @ 0x0... 344064 (100 %)
Wrote 344064 bytes at 0x0 in 29.8 seconds (92.3 kbit/s)...
Leaving...
Ivan Grokhotkov
@igrr
Aug 08 2016 10:51
Hmm, settings look good both in the IDE and in esptool.
Rohit Yermalkar
@romuye123
Aug 08 2016 10:51
bin file gets uploaded but gives wdt reset repeatedly
Ivan Grokhotkov
@igrr
Aug 08 2016 10:51
No idea.
Rohit Yermalkar
@romuye123
Aug 08 2016 10:52
how do you generate .bin file in arduino ide ?
just by compiling the sketch, right ? it gets created in Hexfiles folder mentioned in preferences.
Ivan Grokhotkov
@igrr
Aug 08 2016 10:53
Oh, i didn't know that. I though that the IDE creates a .bin file inside a temporary directory.
this is how you set a user-defined folder for your bin files
Rohit Yermalkar
@romuye123
Aug 08 2016 11:07
the bin file gets uploaded and boots normally using esptool-ck and also with arduino ide ( since ide uses esptool-ck internally ), what should be the problem with esptool ?
Ivan Grokhotkov
@igrr
Aug 08 2016 11:08
IDE uses esptool-ck, maybe esptool.py does something differently?
the only thing which i know about is that you have to specify flash size when uploading with esptool.py
but you have that specified correctly
Rohit Yermalkar
@romuye123
Aug 08 2016 11:08
does esptool-ck splits the bin file ?
Ivan Grokhotkov
@igrr
Aug 08 2016 11:09
you mean when uploading? no it just uploads the whole file.
Rohit Yermalkar
@romuye123
Aug 08 2016 11:09
yeah while uploading...
Ivan Grokhotkov
@igrr
Aug 08 2016 11:09
well if had such an issue i would do the following
Rohit Yermalkar
@romuye123
Aug 08 2016 11:10
is there any GUI tool to upload bin file on esp ?
Ivan Grokhotkov
@igrr
Aug 08 2016 11:11
  • first erase the flash
  • upload from the IDE using esptool-ck
  • read the flash back into a file using esptool.py (read_flash command)
  • erase the flash again
  • upload using esptool.py
  • read the flash back into another file using esptool.py
  • compare the two files
Rohit Yermalkar
@romuye123
Aug 08 2016 11:11
ok let me follow the steps,
Ivan Grokhotkov
@igrr
Aug 08 2016 11:12
there is the official esp download tool from Espressif, but it uses the same esptool.py internally
so it may share the same issue you have with esptool
Rohit Yermalkar
@romuye123
Aug 08 2016 11:12
ok
what do you mean by read the flash back into a file using esptool.py ?
Ivan Grokhotkov
@igrr
Aug 08 2016 11:13
esptool.py can read the contents of flash into a file
and the command to do that is called read_flash
Rohit Yermalkar
@romuye123
Aug 08 2016 11:14
oh ok ok so you mean to say compare the file and see if any changes
Ivan Grokhotkov
@igrr
Aug 08 2016 11:14
yes, compare the two files was the final step :)
Rohit Yermalkar
@romuye123
Aug 08 2016 11:14
understood
will get back, let me follow the same first :)
Ivan Grokhotkov
@igrr
Aug 08 2016 11:16
okay, i'll be out of office in a few minutes, will log into the chat later tonight.
Rohit Yermalkar
@romuye123
Aug 08 2016 11:16
okay
Stavros Korokithakis
@skorokithakis
Aug 08 2016 12:06
does anyone know what could be the problem with picocom not working? data bits 8, stop 1, parity none is the same in both terminals but picocom won't send
or, the A6 won't react
Stavros Korokithakis
@skorokithakis
Aug 08 2016 12:47
also, does anyone know if i can use a WeMos's USB connection to talk to serial and use its serial TX/RX simultaneously?
Martin Ayotte
@martinayotte
Aug 08 2016 12:51
@skorokithakis , do you means using USB Serial while also connecting TX/RX to another devices ? it is Ok for TX, but for RX collision could occurs. Fortunately, the TX of the CH340 has a 470R resistor, so you can still connect an external device which will win over the CH340.
Stavros Korokithakis
@skorokithakis
Aug 08 2016 12:52
@martinayotte ah, i meant using both simultaneously. so the CH340 is connected to the TX/RX lines of the ESP, huh? that's unsurprising, thanks
I'll use the web UI instead
Martin Ayotte
@martinayotte
Aug 08 2016 12:53
BTW, for your previous question, I'm using picocom without any issue.
Stavros Korokithakis
@skorokithakis
Aug 08 2016 12:53
@martinayotte for the A6 breakout board?
Martin Ayotte
@martinayotte
Aug 08 2016 12:54
I don't have any A6, but it should work the same as any serial. Did you try CR+LF ?
Stavros Korokithakis
@skorokithakis
Aug 08 2016 13:13
@martinayotte i tried --omap <every option>
crcrlf, lfcrlf, crlf
all of them
cr+lf works fine in cutecom
but picocom doesn't seem to send it properly
Martin Ayotte
@martinayotte
Aug 08 2016 13:41
Instead of using --omap, which was working fine for me, did you tried it manually ? Is the CR+LF is really the issue ? Problem could be elsewhere.
Stavros Korokithakis
@skorokithakis
Aug 08 2016 14:04
@martinayotte manually how? i tried it and it didn't work
Martin Ayotte
@martinayotte
Aug 08 2016 14:05
I means directly on the keyboard. If it didn't work, the problem is elsewhere.
Stavros Korokithakis
@skorokithakis
Aug 08 2016 14:20
why is it elsewhere? cutecom works fine
it's picocom that doesn't work
Martin Ayotte
@martinayotte
Aug 08 2016 14:29
Maybe your version of picocom is broken, it is working fine on my system, it is v1.7
Does your version of picocom working fine with ESP ?
Stavros Korokithakis
@skorokithakis
Aug 08 2016 14:37
@martinayotte yep, it works fine with the ESP...
i'm running micropython on the ESP as well and it works fine there too
is there a second serial line on the ESP somewhere? i connected the A6 to the TX/RX but Micropython expects shell commands to be coming in from TX/RX, so it's getting confused
although i guess this would be micropython-specific
Martin Ayotte
@martinayotte
Aug 08 2016 14:49
The second serial on ESP is TX only, no RX available. If baudrate is low, such 9600, you can use SoftwareSerial using any free GPIOs
Stavros Korokithakis
@skorokithakis
Aug 08 2016 14:54
ah, thanks martin
does anyone know of a library that works with the A6? all i can find is SIM800/SIM900
Germán Martín
@gmag11
Aug 08 2016 15:23
@skorokithakis Most of A6 commands should be compatible with SIM800. But I guess you will have to digg into library code to find incompatibilities.
Stavros Korokithakis
@skorokithakis
Aug 08 2016 15:23
@gmag11 i'll try that one and see, thanks. i only want to send and receive SMS
Germán Martín
@gmag11
Aug 08 2016 15:27
You may use Serial1 for debugging. As my experience you cannot use Serial TX/RX and USB simultaneously. But, to flash ESP you need to disconnect RX.
You may use Serial.swap() but you can have issues with GPIO15. It must be low during boot, and most probably A6 TX pin will be up when not transmitting.
Stavros Korokithakis
@skorokithakis
Aug 08 2016 15:29
i wanted to prototype using MicroPython, because I figured all the string parsing would be easier, but it sounds like MicroPython can't work with the serial connection because the interpreter itself uses it
so i think i'll go with the Arduino framework instead
Germán Martín
@gmag11
Aug 08 2016 15:29
You can use a transistor to keep GPIO15 low. I cannot give you more details as I forgot about electronics some years ago.
Stavros Korokithakis
@skorokithakis
Aug 08 2016 15:30
haha
sounds like you know enough, to me
Stavros Korokithakis
@skorokithakis
Aug 08 2016 15:41
@gmag11 did you connect the TX/RX pins of the A6 to the TX/RX of the ESP? or can you use other pins with GSMLib?
hmm, looks like gsm uses GPIO 2 and 3 for TX/RX. i wonder if it just bitbangs stuff out
hmm, yeah, 9600 baud, so it could bitbang... however, how do you set the A6 to use 9600 baud instead of 115200 if you can't send that to begin with?
Stavros Korokithakis
@skorokithakis
Aug 08 2016 16:56
can i use softwareserial at 115200 baud?
Germán Martín
@gmag11
Aug 08 2016 18:25
I guess for SMS software serial will work. I do not recommend for ip data.
But try it and tell us.
Stavros Korokithakis
@skorokithakis
Aug 08 2016 18:40
i'm trying, but i can't get it to work :/ i have this and i'm seeing nothing: https://www.pastery.net/pavtbc/
Germán Martín
@gmag11
Aug 08 2016 19:01
Try to write some code to send AT commands and check result
Stavros Korokithakis
@skorokithakis
Aug 08 2016 20:09
yep, that's what i'm doing now
next step is trying the GSMLib library
i see here that when you say .begin(9600), it actually tries to communicate with the lib and discover its baud rate, and then sends the AT command to change the rate to 9600
so that should work beautifully
Germán Martín
@gmag11
Aug 08 2016 20:43
@skorokithakis Arduino boards can do softserial at 9600 max. I guess. ESP can do faster but you have to take care of interrupts if you don't want to lose some incoming bytes.
Stavros Korokithakis
@skorokithakis
Aug 08 2016 21:23
@gmag11 i only need it to do 115200 long enough to issue the AT command to switch to 9600... hopefully that will work
Stavros Korokithakis
@skorokithakis
Aug 08 2016 21:40
if i want to pull something high via a mosfet, i need to use a pMOS, right?
Stavros Korokithakis
@skorokithakis
Aug 08 2016 22:40
ah, so the pmos is closed when a negative Vgs is applied, whereas the nmos needs a positive Vgs
Martin Ayotte
@martinayotte
Aug 08 2016 22:50
Pmos is for switching VCC and Nmos for switching GND, and about Vgs, yes for Nmos, but no for Pmos, it is a kind of mirror of the Nmos but seen from VCC point of view : if Vgs is at VCC, so 0V, it is OFF, if Vgs is at GND, so -VCC, it is ON.
Stavros Korokithakis
@skorokithakis
Aug 08 2016 22:52
@martinayotte thanks martin. isn't that the same as what i said, though? pmos needs -VCC Vgs to be ON
Stavros Korokithakis
@skorokithakis
Aug 08 2016 22:53
so you connect the source to VCC, the drain to Vout and then if the gate is grounded, Vout is VCC
ah, yes, exactly
Martin Ayotte
@martinayotte
Aug 08 2016 22:54
Except here in this image, they are still switching VCC on the NMos
Stavros Korokithakis
@skorokithakis
Aug 08 2016 22:55
hmm, the Vgs is +VCC in the nmos image, no?
so it gets switched
then why do we say that nmos is for switching GND?
i guess the only difference is which way the source is connected
Martin Ayotte
@martinayotte
Aug 08 2016 22:57
Yes, but I hate connecting sources to load ...
Stavros Korokithakis
@skorokithakis
Aug 08 2016 22:57
@martinayotte why is that?
Stavros Korokithakis
@skorokithakis
Aug 08 2016 22:58
wow
so you suggest the first two configurations?
Martin Ayotte
@martinayotte
Aug 08 2016 22:59
Why ? because the Vgs reference isn't at the good place
Stavros Korokithakis
@skorokithakis
Aug 08 2016 22:59
ahhh
Martin Ayotte
@martinayotte
Aug 08 2016 22:59
I prefer staying with the 2 left one and forget about 3rd one
Stavros Korokithakis
@skorokithakis
Aug 08 2016 22:59
yes, that's true
great, this clarifies things a lot
i finally understand how to connect mosfets
thanks martin
Martin Ayotte
@martinayotte
Aug 08 2016 23:12
welcome