Skip to content

Commit

Permalink
make programming reset pulse longer for esp8266 and add notes to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
tve committed Nov 18, 2015
1 parent fe2c74e commit df8afa8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------
Expand Down
5 changes: 2 additions & 3 deletions esp-link/cgiwifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion serial/serbridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit df8afa8

Please sign in to comment.