|
| 1 | +<p align="center"><img src="https://user-images.githubusercontent.com/17078589/73821108-300bda00-482e-11ea-89f6-011a50037a12.png"/></p> |
| 2 | +<h1 align="center">Wireless ESP8266 DAP</h1> |
| 3 | + |
| 4 | +[](https://travis-ci.com/windowsair/wireless-esp8266-dap) master |
| 5 | +[](https://travis-ci.com/windowsair/wireless-esp8266-dap) develop |
| 6 | + |
| 7 | +[](https://github.com/windowsair/wireless-esp8266-dap/LICENSE) [](https://github.com/windowsair/wireless-esp8266-dap/pulls) [](https://github.com/windowsair/wireless-esp8266-dap) |
| 8 | + |
| 9 | + |
| 10 | +## Introduce |
| 11 | + |
| 12 | +Wireless debugging with ***only one ESP8266*** ! |
| 13 | + |
| 14 | +Realized by USBIP and CMSIS-DAP protocol stack. |
| 15 | + |
| 16 | +> 👉 5m distance, 100kb size firmware flash test: |
| 17 | +
|
| 18 | +<p align="center"><img src="https://user-images.githubusercontent.com/17078589/73829782-808b3380-483e-11ea-8389-1570bc4200af.gif"/></p> |
| 19 | + |
| 20 | +## Feature |
| 21 | + |
| 22 | +1. Debug Communication Mode |
| 23 | + - [x] SWJ |
| 24 | + - [x] JTAG |
| 25 | + |
| 26 | +2. USB Communication Mode |
| 27 | + - [x] USB-HID |
| 28 | + - [ ] WCID & WinUSB |
| 29 | + |
| 30 | +3. Debug Trace |
| 31 | + - [ ] UART Serial Wire Output(SWO) |
| 32 | + - [ ] SWO Streaming Trace |
| 33 | + |
| 34 | +4. More.. |
| 35 | + - [x] Custom maximum debug clock(more than 10MHz) |
| 36 | + - [ ] ... |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +## Link your board |
| 41 | + |
| 42 | +1. WIFI |
| 43 | + |
| 44 | +The default connected WIFI SSID is `DAP` , password `12345678` |
| 45 | + |
| 46 | +You can change `WIFI_SSID` and ` WIFI_PASS` in [wifi_configuration.h](main/wifi_configuration.h) |
| 47 | + |
| 48 | +2. Debugger |
| 49 | + |
| 50 | +- SWD |
| 51 | + |
| 52 | +| SWD | | |
| 53 | +|----------------|--------| |
| 54 | +| SWCLK | GPIO5 | |
| 55 | +| SWDIO | GPIO4 | |
| 56 | +| LED\_CONNECTED | GPIO2 | |
| 57 | +| LED\_RUNNING | GPIO15 | |
| 58 | +| TVCC | 3V3 | |
| 59 | +| GND | GND | |
| 60 | + |
| 61 | +- JTAG |
| 62 | + |
| 63 | +| JTAG | | |
| 64 | +|--------------------|---------| |
| 65 | +| TCK | GPIO5 | |
| 66 | +| TMS | GPIO4 | |
| 67 | +| TDI | GPIO13 | |
| 68 | +| TDO | GPIO12 | |
| 69 | +| nTRST \(optional\) | GPIO0\* | |
| 70 | +| nRESET | GPIO14 | |
| 71 | +| LED\_CONNECTED | GPIO2 | |
| 72 | +| LED\_RUNNING | GPIO15 | |
| 73 | +| TVCC | 3V3 | |
| 74 | +| GND | GND | |
| 75 | + |
| 76 | +You can modify these pin definitions in [DAP_config.h](components/DAP/config/DAP_config.h) |
| 77 | + |
| 78 | +> Tips: Try to avoid using `GPIO0`(working mode switch) and `GPIO16`(RTC) |
| 79 | +
|
| 80 | +## Build |
| 81 | + |
| 82 | +1. Get ESP8266 RTOS Software Development Kit |
| 83 | + |
| 84 | +See: [ESP8266_RTOS_SDK](https://github.com/espressif/ESP8266_RTOS_SDK "ESP8266_RTOS_SDK") |
| 85 | + |
| 86 | +2. Build & Flash |
| 87 | + |
| 88 | +Build with ESP-IDF build system. |
| 89 | +More information can be found at the following link: [Build System](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html "Build System") |
| 90 | + |
| 91 | +The following example shows a possible way to build on Windows: |
| 92 | + |
| 93 | +```bash |
| 94 | +# Build |
| 95 | +python ./idf.py build |
| 96 | +# Flash |
| 97 | +python ./idf.py -p /dev/ttyS5 flash |
| 98 | +``` |
| 99 | + |
| 100 | +> We also provided sample firmware quick evaluation. See [Releases](https://github.com/windowsair/wireless-esp8266-dap/releases) |
| 101 | +
|
| 102 | + |
| 103 | +## Usage |
| 104 | + |
| 105 | +1. Get USBIP project |
| 106 | + |
| 107 | +- Windows: [usbip-windows](https://github.com/george-hopkins/usbip-windows "usbip-windows") . Or you can find it already built here: https://github.com/barbalion/usbip-win-client |
| 108 | +- Linux: Distributed as part of the kernel |
| 109 | + |
| 110 | +2. Start esp8266 and connect it to the device to be debugged |
| 111 | + |
| 112 | +3. Connect it with usbip: |
| 113 | + |
| 114 | +```bash |
| 115 | +.\usbip.exe -D -a <your-esp8266-ip-address> 1-1 |
| 116 | +``` |
| 117 | + |
| 118 | +If all goes well, you should see your device connected. |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | +## Develop |
| 126 | + |
| 127 | +> Credits to: |
| 128 | +> - https://github.com/thevoidnn/esp8266-wifi-cmsis-dap for adapter firmware based on CMSIS-DAP v1.0 |
| 129 | +> - https://github.com/ARM-software/CMSIS_5 for CMSIS |
| 130 | +
|
| 131 | + |
| 132 | +In this repo you can find the complete implementation of the USB protocol stack including USB-HID, WCID, WinUSB. Although WinUSB-based mode currently does not work on USBIP :disappointed_relieved: . They are very easy and can help you quickly build your own DAP on other hardware platforms. |
| 133 | + |
| 134 | + |
| 135 | +Currently using USB-HID for transmission is still slightly slower, If you have any ideas, welcome: |
| 136 | +- [New issues](https://github.com/windowsair/wireless-esp8266-dap/issues) |
| 137 | +- [New pull](https://github.com/windowsair/wireless-esp8266-dap/pulls) |
| 138 | + |
| 139 | + |
| 140 | +### Issue |
| 141 | + |
| 142 | +2-4 |
| 143 | + |
| 144 | +Due to the limitation of USB-HID (I'm not sure if this is a problem with USBIP or Windows), now each URB packet can only reach 255 bytes (About 1MBps bandwidth), which has not reached the upper limit of ESP8266 transmission bandwidth. |
| 145 | + |
| 146 | +I now have an idea to construct a Man-in-the-middle between the two to forward traffic, thereby increasing the bandwidth of each transmission. |
| 147 | + |
| 148 | +1-31 |
| 149 | + |
| 150 | +At present, the adaptation to WCID, WinUSB, etc. has all been completed. However, when transmitting data on the endpoint, we received an error message from USBIP. This is most likely a problem with the USBIP project itself. |
| 151 | + |
| 152 | +Due to the completeness of the USBIP protocol document, we have not yet understood its role in the Bulk transmission process, which may also lead to errors in subsequent processes. |
| 153 | + |
| 154 | +We will continue to try to make it work on USB HID. Once the USBIP problem is solved, we will immediately transfer it to work on WinUSB |
| 155 | + |
| 156 | + |
| 157 | + |
| 158 | +## License |
| 159 | +[MIT LICENSE](LICENSE) |
0 commit comments