]> Git Repo - esp-hosted.git/blob - README.md
Merge branch 'bugfix/spi_clk_rpi_fix_SR_21Oct21' into 'master'
[esp-hosted.git] / README.md
1 # ESP-Hosted
2
3 # Index
4 * [**1. Introduction**](#1-introduction)  
5         * [Connectivity Feature](#11-connectivity-features)  
6         * [Supported ESP boards](#12-supported-esp-boards)  
7         * [Supported Hosts](#13-supported-hosts)  
8         * [Supported Transports](#14-supported-transports)  
9         * [Feature Matrix](#15-feature-matrix)  
10 * [**2. Get Started**](#2-get-started)  
11         * [Getting Started With Linux Host](#21-getting-started-with-linux-host)  
12         * [Getting Started With MCU host](#22-getting-started-with-mcu-host)  
13 * [**3. Design**](#3-design)  
14         * [System Architecture](#31-system-architecture)  
15         * [Transport layer communication protocol](#32-transport-layer-communication-protocol)  
16         * [Integration Guide](#33-integration-guide)  
17 * [**4. Performance And Validation**](#4-performance-and-validation)
18
19 ---
20
21
22 # 1. Introduction
23
24 ESP-Hosted solution provides a way to use ESP board as a communication processor for Wi-Fi and Bluetooth/BLE connectivity. It basically adds a network interface and a HCI interface to host, allowing it to communicate with other devices.
25
26 Following features are provided as a part of this solution:
27 * A standard 802.3 network interface is provided to host for transmitting and receiving 802.3 frames
28 * A standard HCI interface is provided to host over which Bluetooth/BLE is supported
29 * A control interface to configure and control Wi-Fi on ESP board
30
31 For end to end working of this solution, host needs to be equipped with corresponding TCP/IP, TLS and Bluetooth/BLE stack.
32
33 Please note that this project doesn't provide a standard 802.11 interface to the host. For the control path between the host and ESP board, ESP-Hosted uses a custom implementation based on [Protobuf](https://developers.google.com/protocol-buffers).
34
35 ### 1.1 Connectivity Features
36
37 ESP-Hosted solution provides following WLAN and BT/BLE features to host:
38 - WLAN Features:
39         - 802.11b/g/n
40         - WLAN Station
41         - WLAN Soft AP
42 - BT/BLE Features:
43         - v4.2 BR/EDR and BLE
44
45 ### 1.2 Supported ESP boards
46
47 ESP-Hosted solution is supported on following ESP boards:
48 - ESP32
49 - ESP32S2
50 - ESP32C3
51
52 ### 1.3 Supported Hosts
53
54 * ESP-Hosted solution supports following Linux based and MCU based hosts out of the box.
55         * Linux Based Hosts
56                 * Raspberry-Pi 3 Model B
57                 * Raspberry-Pi 3 Model B+
58                 * Raspberry-Pi 4 Model B
59         * MCU Based Hosts
60                 * STM32 Discovery Board (STM32F469I-DISCO)
61 * It is relatively easy to port this solution to other Linux and MCU platforms.
62
63 ### 1.4 Supported Transports
64
65 ESP-Hosted uses SDIO or SPI bus for interfacing ESP boards and host platform. Not all host platforms support both these interfaces. Further section depicts supported host platforms and corresponding transport interface, ESP boards and feature set.
66
67 ### 1.5 Feature Matrix
68 ##### 1.5.1 Linux Host
69 Below table explains which feature is supported on which transport interface for Linux based host.
70
71 | ESP device | Transport Interface | WLAN support | Virtual serial interface | BT/BLE support |
72 |:---------:|:-------:|:---------:|:--------:|:--------:|
73 | ESP32 | SDIO | Yes | Yes | Yes |
74 | ESP32 | SPI | Yes | Yes | Yes |
75 | ESP32 | UART | No | No | Yes |
76 | ESP32-S2 | SDIO | NA | NA | NA |
77 | ESP32-S2 | SPI | Yes | Yes | NA |
78 | ESP32-S2 | UART | No | No | NA |
79 | ESP32-C3 | SDIO | NA | NA | NA |
80 | ESP32-C3 | SPI | Yes | Yes | No |
81 | ESP32-C3 | UART | No | No | No |
82
83 ##### 1.5.2 MCU Host
84 Below table explains which feature is supported on which transport interface for MCU based host.
85
86 | ESP device | Transport Interface | WLAN support | Virtual serial interface | BT/BLE support |
87 |:------------:|:-------:|:---------:|:--------:|:--------:|
88 | ESP32 | SDIO | No | No | No |
89 | ESP32 | SPI | Yes | Yes | Yes\* |
90 | ESP32 | UART | No | No | Yes\*\* |
91 | ESP32-S2 | SDIO | NA | NA | NA |
92 | ESP32-S2 | SPI | Yes | Yes | NA |
93 | ESP32-S2 | UART | No | No | NA |
94 | ESP32-C3 | SDIO | NA | NA | NA |
95 | ESP32-C3 | SPI | Yes | Yes | No |
96 | ESP32-C3 | UART | No | No | No |
97
98 \* BT/BLE over SPI
99 > BT/BLE support over SPI is not readily available. In order to implement it, one needs to:
100
101 > Port BT/BLE stack to MCU, \
102 > Add a new virtual serial interface using the serial interface API's provided in host driver of ESP-Hosted solution.
103 > HCI implementation in Linux Driver `host/linux/host_driver/esp32` could be used as reference. Search keyword: `ESP_HCI_IF`
104 > Register this serial interface with BT/BLE stack as a HCI interface.
105
106 \*\* BT/BLE over UART
107 > BT/BLE support over UART is not readily available. In order to implement this, one needs to:
108 >
109 > Port BT/BLE stack to MCU, \
110 > Register the UART serial interface as a HCI interface with BT/BLE stack
111 > With the help of this UART interface, BT/BLE stack can directly interact with BT controller present on ESP32 bypassing host driver and firmware
112 > ESP Hosted host driver and a firmware plays no role in this communication
113
114
115 ---
116
117 # 2. Get Started
118 This section describes how to setup and use ESP-Hosted solution. Since ESP-Hosted solution supports two distinct platforms, procedure to use it vastly differs.
119
120 ### 2.1 Getting Started With Linux Host
121 Please refer [Getting Started](docs/Linux_based_host/Linux_based_readme.md) guide for Linux host.
122
123 ### 2.2 Getting Started With MCU Host
124 Please refer [Getting Started](docs/MCU_based_host/MCU_based_readme.md) guide for MCU host.
125
126 ---
127
128 # 3. Design
129 This section describes the overall design of ESP-Hosted solution. There are 3 aspects to it:
130 * System Architecture
131 * Transport layer communication protocol
132 * API Reference
133
134 ### 3.1 System Architecture
135
136 This section discusses building blocks of the ESP-Hosted solution for the supported host platforms.
137
138 These building blocks can be broadly classified as:
139 * ESP Host Software  
140 This includes ESP Host driver and control interface implementation.
141
142 * ESP Firmware  
143 This includes ESP peripheral driver and implementation of control commands.
144
145 * Third party components  
146 This includes components that are essential for end to end working of entire system but are not maintained or implemented as a part of this project.
147
148
149 ##### 3.1.1 ESP Host Software
150
151 The components of ESP host software are dependent on host platform that is being used. Please refer following documents:
152
153 1. [System Architecture: Linux based host](docs/Linux_based_host/Linux_based_architecture.md)
154 2. [System Architecture: MCU based host](docs/MCU_based_host/MCU_based_architecture.md)
155
156
157 ##### 3.1.2 ESP Firmware
158 This implements ESP-Hosted solution part that runs on ESP boards. ESP firmware is agnostic of the host platform. It consists of following.
159
160 * ESP Application  
161 This implements:
162         * SDIO transport layer
163         * SPI transport layer
164         * Virtual serial interface driver
165         * Control interface command implementation
166         * Bridges data path between Wi-Fi, HCI controller driver of ESP and Host platform
167 * ESP-IDF Components  
168 ESP firmware mainly uses following components from ESP-IDF. Please check [ESP-IDF documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html) for more details.
169         * SDIO Slave driver
170         * SPI Slave driver
171         * Wi-Fi driver
172         * HCI controller driver
173         * Protocomm Layer
174
175
176 ##### 3.1.3 Third Party Components
177 Third components such as following are essential for end to end working of ESP-Hosted Solution. Implementation or porting of these third party compoenent is not in scope of this project.
178 * TCP/IP and TLS stack
179 * BT/BLE stack
180 * UART driver
181 * Protobuf
182
183
184 ### 3.2 Transport layer communication protocol
185 This section describes the data communication protocol used at the transport layer. This protocol is agnostic of host platforms that is being used. Please refer following links to get more information on communication protocol per transport interface type.
186 * [SDIO Communication Protocol](docs/sdio_protocol.md)
187 * [SPI Communication Protocol](docs/spi_protocol.md)
188
189 ##### 3.2.1 Payload Format
190 This section explains the payload format used for data transfer on SDIO and SPI interfaces.
191
192 * Host and peripheral makes use of 8 byte payload header which preceeds every data packet.
193 * This payload header provides additional information about the data packet. Based on this header, host/peripheral consumes transmitted data packet.
194 * Payload format is as below
195
196 | Field | Length | Description |
197 |:-------:|:---------:|:--------|
198 | Interface type | 4 bits | Possible values: STA(0), SoftAP(1), Serial interface(2), HCI (3), Priv interface(4). Rest all values are reserved |
199 | Reserved | 4 bits | Not in use |
200 | Reserved | 1 byte | Not in use |
201 | Packet length | 2 bytes | Actual length of data packet |
202 | Offset to packet | 2 bytes | Offset of actual data packet |
203 | Reserved | 1 byte  | Not in use |
204 | Packet type | 1 byte | reserved when interface type is 0,1 and 2. Applicable only for interface type 3 and 4 |
205
206 ### 3.3 Integration Guide
207
208 ##### 3.3.1 Control Interface API's
209 This section describes control interface API's provided by ESP-Hosted Solution For higher layer applications. One can easily integrate ESP-Hosted solution with other projects using these API's. There are two flavors of these API's:
210
211 * [Python API's](docs/python_api.md)
212 * [C API's](docs/c_api.md)
213
214 ##### 3.3.2 API's for MCU Based ESP-Hosted Solution
215 Below document explains the API's provided for MCU based ESP-Hosted solution
216 * [API's for MCU based host](docs/MCU_based_host/mcu_api.md)
217
218 # 4. Performance And Validation
219 ### 4.1 Wi-Fi Performance in shielded environment
220 Following performance numbers are taken on Linux based ESP-Hosted solution.
221
222 ![alt text](esp_hosted_performance.png "ESP Hosted performance matrix")
This page took 0.037096 seconds and 4 git commands to generate.