From df8afa82d0bc64194cc60f542fbe60fc53121b1c Mon Sep 17 00:00:00 2001 From: Thorsten von Eicken Date: Tue, 17 Nov 2015 23:32:50 -0800 Subject: [PATCH] make programming reset pulse longer for esp8266 and add notes to readme --- README.md | 17 +++++++++++++++-- esp-link/cgiwifi.c | 5 ++--- serial/serbridge.c | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8ffa55d..5f72622 100644 --- a/README.md +++ b/README.md @@ -365,8 +365,21 @@ it starts the connection with the `?\r\n` synchronization sequence. (This is not well tested, more details forthcoming...) Yes, you can use esp-link running on one esp8266 module to flash another esp8266 module! -For this to work you need a special version of esptool.py that has support for serial over -telnet. +The basic idea is to use some method to direct the esp8266 flash program to port 2323 of +esp-link. Using port 2323 with the appropriate wiring will cause the esp8266's reset and +gpio0 pins to be toggled such that the chip enters the flash programming mode. + +One option for connecting the programmer with esp-link is to use my version of esptool.py +at http://github.com/tve/esptool, which supports specifying a URL instead of a port. Thus +instead of specifying something like `--port /dev/ttyUSB0` or `--port COM1` you specify +`--port socket://esp-link.local:2323`. Important: the baud rate specified on the esptool.py +command-line is irrelevant as the baud rate used by esp-link will be the one set in the +uC console page. Fortunately the esp8266 bootloader does auto-baud detection. (Setting the +baud rate to 115200 is recommended.) + +Another option is to use a serial-to-tcp port forwarding driver and point that to port 2323 +of esp-link. On windows users have reported success with +[HW Virtual Serial Port](http://www.hw-group.com/products/hw_vsp/hw_vsp2_en.html) Debug log --------- diff --git a/esp-link/cgiwifi.c b/esp-link/cgiwifi.c index a56eee2..dc190db 100644 --- a/esp-link/cgiwifi.c +++ b/esp-link/cgiwifi.c @@ -113,7 +113,7 @@ wifiAddStateChangeCb(WifiStateChangeCb cb) { DBG("WIFI: max state change cb count exceeded\n"); } -static bool mdns_started = true; +static bool mdns_started = false; static struct mdns_info mdns_info; // cannot allocate the info struct on the stack, it crashes! @@ -126,7 +126,6 @@ void wifiStartMDNS(struct ip_addr ip) { mdns_info.server_port = 80, // service port mdns_info.ipAddr = ip.addr, espconn_mdns_init(&mdns_info); - espconn_mdns_enable(); mdns_started = true; } } @@ -237,7 +236,7 @@ static int ICACHE_FLASH_ATTR cgiWiFiGetScan(HttpdConnData *connData) { while (pos < cgiWifiAps.noAps && pos < next+chunk) { len += os_sprintf(buff+len, "{\"essid\": \"%s\", \"rssi\": %d, \"enc\": \"%d\"}%c\n", cgiWifiAps.apData[pos]->ssid, cgiWifiAps.apData[pos]->rssi, cgiWifiAps.apData[pos]->enc, - (pos+1 == cgiWifiAps.noAps) ? ' ' : ','); + (pos+1 == cgiWifiAps.noAps) ? ' ' : ','); pos++; } // done or more? diff --git a/serial/serbridge.c b/serial/serbridge.c index c996b9a..7814d88 100644 --- a/serial/serbridge.c +++ b/serial/serbridge.c @@ -211,7 +211,7 @@ serbridgeRecvCb(void *arg, char *data, unsigned short len) if (mcu_reset_pin >= 0) GPIO_OUTPUT_SET(mcu_reset_pin, 0); os_delay_us(100L); if (mcu_isp_pin >= 0) GPIO_OUTPUT_SET(mcu_isp_pin, 0); - os_delay_us(100L); + os_delay_us(2000L); if (mcu_reset_pin >= 0) GPIO_OUTPUT_SET(mcu_reset_pin, 1); //os_delay_us(100L); //if (mcu_isp_pin >= 0) GPIO_OUTPUT_SET(mcu_isp_pin, 1);