beckdac / ESP8266-transparent-bridge

Absolutely transparent bridge for the ESP8266
GNU General Public License v2.0
367 stars 95 forks source link

ESP8266-transparent-bridge

I've noticed the jeelabs/esp-link fails in most new projects for wireless uploading to AVRs. From scoping the problem, I suspect the GPIO reset time is not correct for most of the RESET cap setups. ## Note, this firmware is largely unsupported. For new projects, I would recommend this firmware: https://github.com/jeelabs/esp-link. It also supports a transparent bridge, but has additional features like a configuration web server, uController programming ports, and additional features for the esp12 class boards.

Join the chat at https://gitter.im/beckdac/ESP8266-transparent-bridge

Absolutely transparent bridge for the ESP8266

This is really basic firmware for the ESP that creates a totally transparent TCP socket to ESP UART0 bridge. Characters come in on one interface and go out the other. The totally transparent bridge mode is something that has been missing and is available on higher priced boards.

Pros:

Upon success, all commands send back "OK" as their final output. Note that passwords may not contain spaces.

The settings are saved after the commands +++AT PORT +++AT BAUD ...

After +++AT FLASH 0 the parameter of command +++AT BAUD ... are NOT saved to the flash memory. The new settings are applied to the UART and saved only in RAM. But a following +++AT PORT need to flash the settings for the necessary reboot. Then also the changed UART setting are saved to flash.

The disable of flash the settings is for devices with baud rate changes to avoid permanently flash of the setting sector. Some electric meter start conversion with 300 baud and accept a command to change to 9600.

Example session:

user@host:~$ telnet 192.168.1.197
Trying 192.168.1.197...
Connected to 192.168.1.197.
Escape character is '^]'.
+++AT MODE
MODE=3
OK
+++AT AP
SSID=ESP_9E2EA6 PASSWORD= AUTHMODE=0 CHANNEL=3
OK
+++AT AP newSSID password
OK
+++AT AP
SSID=newSSID PASSWORD=password AUTHMODE=2 CHANNEL=3
OK
+++AT AP ESP_9E2EA6
OK
+++AT AP
SSID=ESP_9E2EA6 PASSWORD= AUTHMODE=0 CHANNEL=3
OK
^]c

telnet> c
Connection closed.

In order, this gets the current opmode. Good, it is 3 for STA + AP. Next, the current AP settings are retrieved. Next, the AP ssid is changed to newSSID and the authmode set to WPA and a password set. The AP settings are retrieved again to verify. Finally, the AP SSID is changed back to the original and by not using a password, the authmode is set to OPEN.

Cons:

This could potentially impact performance, however, in my hands that hasn't been an issue.

Parts of this firmware are from the stock AT firmware and the esphttpd project. Enjoy.

Flash command, e.g. w/ locations:

/opt/Espressif/esptool-py/esptool.py --port /dev/tty.usbserial-A603HRFF write_flash 0x00000 0x00000.bin 0x40000 0x40000.bin
...
or use ESP8266Flasher.exe from https://github.com/nodemcu/nodemcu-flasher with
0x00000.bin at 0x00000
0x40000.bin at 0x40000

Visual Studio 2013 Integration

see "New Windows terminal/flasher apps & Visual Studio" http://www.esp8266.com/viewtopic.php?f=9&t=911#p5113 to setup Visual Studio 2013 Please install in a folder i.e. c:\Projects\Espressif\

ESP8266-transparent-bridge/              #this project
esp_iot_sdk_v0.9.5/                      #http://bbs.espressif.com/download/file.php?id=189
xtensa-lx106-elf/                        #pre-built compiler, see http://www.esp8266.com/viewtopic.php?f=9&t=911#p5113 ,
                                         #I used xtensa-lx106-elf-141114.7z from  https://drive.google.com/uc?export=download&confirm=XHSI&id=0BzWyTGWIwcYQallNcTlxek1qNTQ
esptool-py.py                            #http://www.esp8266.com/download/file.php?id=321

The files used by Visual Studio are:

ESP8266-transparent-bridge.sln           #solution file
ESP8266-transparent-bridge.vcxproj       #project file, with IncludePath to xtensa-lx106-elf, sdk for intellisense and "Go To Definition" F12
espmake.cmd                              #batch file called by build, rebuild, clean command, which set the path and call make with Makefile_VS2013
Makefile_VS2013                          #the makefile called by the Visual Studio NMake project via espmake.cmd

The Debug config is used for compile, Release for compile & flash with esptool-py.py

The following absolute path names and COM Port number are expected:

C:\MinGW\bin;C:\MinGW\msys\1.0\bin       in espmake.cmd
C:\Python27\python                       in Makefile_VS2013 for flash
COM5                                     in Makefile_VS2013 for flash