This document explains ESP-Hosted setup and usage. The document is divided in two parts:
This section briefly explains ESP-Hosted setup. One can refer this guide to quickly prepare and test ESP-Hosted solution.
This section provides in depth information about ESP-Hosted setup, available customization options etc.
Make sure that Raspberry-Pi is equipped with following:
Linux Kernel Headers are installed
$ sudo apt update
$ sudo apt install raspberrypi-kernel-headers
Dependency tools need to be installed on Raspberry-Pi:
$ sudo apt install git raspi-gpio bluetooth bluez bluez-tools rfkill bluez-firmware pi-bluetooth python3
User access for bluetooth service
$ sudo usermod -G bluetooth -a $(whoami)
Using released codebase
Source code (zip) in Assets fold with associated release for host building.Using latest master
Clone ESP-Hosted code repository
$ git clone --recurse-submodules <url_of_esp_hosted_repository>
$ cd esp-hosted
$ git submodule update --init --recursive
Please use the exact same git commit for ESP flashing using source code.
Prepare connections based on interface requirements and setup host as below.
Compile and load host driver as below:
$ cd esp_hosted_fg/host/linux/host_control/
$ ./rpi_init.sh sdio
Compile and load host driver as below:
$ cd esp_hosted_fg/host/linux/host_control/
$ ./rpi_init.sh spi
Wi-Fi over SDIO and Bluetooth over UART
Compile and load host driver as below:
$ cd esp_hosted_fg/host/linux/host_control/
$ ./rpi_init.sh sdio btuart
After loading ESP firmware, execute below command to create hci0 interface
```sh
$ sudo hciattach -s 921600 /dev/serial0 any 921600 flow
Wi-Fi over SPI and Bluetooth over UART
Compile and load host driver as below:
$ cd esp_hosted_fg/host/linux/host_control/
$ ./rpi_init.sh spi btuart
After loading ESP firmware, execute below command to create hci0 interface
$ sudo hciattach -s 921600 /dev/serial0 any 921600 flow
readme.txt from release tarball to flash the ESP binarySource code (zip) in Assets fold with associated release for host building.Once everything is setup and host software and ESP firmware are loaded
Verify that ethsta0 and ethap0 interfaces are seen on host using following command.
$ ifconfig -a
Verify that hci0 interface is present using below command
$ hciconfig
Proceed to section 3. ESP-Hosted Usage Guide to test Wi-Fi and Bluetooth/BLE functionality.
Setup is required on two machines.
First to setup ESP-Hosted Linux Host driver building on Raspberry Pi
Second to create a development environment set-up on your native machine so that you can build the ESP-Hosted firmware and flash it on the ESP chipset.
The native machine here refers to your Windows/Linux/Mac desktop/laptop.
Although, if you prefer to use the released binaries for ESP firmware, second part of native machine setup can be skipped.
This section identifies Raspberry-Pi specific setup requirements.
Linux Kernel Setup
v4.19 and above. Prior kernel versions may work, but are not tested.Kernel headers are required for driver compilation. Please install them as:
$ sudo apt update
$ sudo apt install raspberrypi-kernel-headers
Verify that kernel headers are installed properly by running following command. Failure of this command indicates that kernel headers are not installed correctly. In such case, follow https://github.com/RPi-Distro/rpi-source and run rpi-source to get current kernel headers. Alternatively upgrade/downgrade kernel and reinstall kernel headers.
$ ls /lib/modules/$(uname -r)/build/ #Note the ending '/'
User previledges
Current user needs to be added to bluetooth group to use bluetoothctl without sudo
$ sudo usermod -G bluetooth -a $(whoami)
Additional Tools
Bluetooth Stack and utilities:
$ sudo apt install pi-bluetooth
For throughput testing
$ sudo apt install iperf #for iperf2
$ sudo apt install iperf3 #for iperf3
Linux Kernel setup on non Raspberry-Pi
v4.19 and above. Prior kernel versions may work, but are not tested.Verify that kernel headers are installed properly by running following command. Failure of this command indicates that kernel headers are not installed correctly.
$ ls /lib/modules/$(uname -r)/build/ # Note the last '/'
Install following tools on Linux Host machine.
Note: ESP-Hosted related BR/EDR 4.2 and BLE 4.2 functionalities are tested with bluez 5.43+. Whereas BLE 5.0 functionalities are tested with bluez 5.45+.
2.3 ESP-Hosted Code Repository below.Install the ESP-IDF using script
$ cd esp_hosted_fg/esp/esp_driver
$ cmake .
Set-Up the build environment using
$ . ./esp-idf/export.sh
# Optionally, You can add alias for this command in ~/.bashrc for later use
Clone esp-hosted repository on Linux host.
$ git clone --recurse-submodules <url_of_esp_hosted_repository>
$ cd esp-hosted
$ git submodule update --init --recursive
Please make sure that ESP and host checkeout to same git commit.
ESP-Hosted solutions supports SDIO and SPI as transport for Wi-Fi and Bluetooth/BLE connectivity. Bluetooth/BLE connectivity is supported over UART as well. Follow below setup guides according to transport layer of your choice.
Following guide explains how to use ESP-Hosted solution.
Following document explains guidelines for porting solution to othe Linux platforms