Below diagram shows hardware and software block diagram for a typical MCU based system built with ESP-Hosted.
We recommend STM32CubeIDE version 1.4 IDE from STMicroelectronics on host machine(Laptop, Desktop etc.). User can download IDE from Here.
-
Arping: Arping software is needed for testing the project. Arping is a software tool which probes hosts on the network link by sending Link Layer frames using the ARP request to host identified by its MAC address. More details could be found on this link.
To install arping on ubuntu based system, please use
$ sudo apt install arping
For installation on Windows hosts, check this link
arping can easily be installed on other architectures.
-
Serial port communication program: For Linux and Mac development hosts, minicom is needed. For Windows based hosts Tera Term is needed.
Clone ESP-Hosted repository on machine, where STM32CubeIDE used to connect/flash to host.
$ git clone --recurse-submodules <url_of_esp_hosted_repository>
$ cd esp-hosted
$ git submodule update --init --recursive
In this setup, ESP board acts as a SPI peripheral and provides Wi-Fi capabilities to host. Please connect ESP peripheral to STM32F469I board's CN12 Extension connecter with jumper cables as mentioned below. It may be good to use small length cables to ensure signal integrity. BT/BLE support will be added in upcoming release. Power ESP peripheral and STM32F469I separately with a power supply that provide sufficient power. ESP peripheral can be powered through PC using micro-USB cable. STM32 can be powered with mini-B cable. It is also used as USART connection for debug logs from host. Serial port communicaton program like tera term or minicom used to print the logs.
STM32 Pin | ESP32 Pin | Function |
---|---|---|
PB4 (pin5) | IO19 | MISO |
PA5 (pin7) | IO18 | CLK |
PB5 (pin9) | IO23 | MOSI |
PA15 (pin11) | IO5 | CS |
GND (pin2) | GND | GND |
PC6 (pin6) | IO2 | Handshake |
PC7 (pin8) | IO4 | Data Ready from ESP |
PB13 (pin10) | EN | Reset ESP |
Setup image is here.
STM32 Pin | ESP32-S2 Pin | Function |
---|---|---|
PB4 (pin5) | IO13 | MISO |
PA5 (pin7) | IO12 | CLK |
PB5 (pin9) | IO11 | MOSI |
PA15 (pin11) | IO10 | CS |
GND (pin2) | GND | GND |
PC6 (pin6) | IO2 | Handshake |
PC7 (pin8) | IO4 | Data ready from ESP |
PB13 (pin10) | RST | Reset ESP |
Setup image is here.
MCU based ESP-Hosted solution is compatible with ESP-IDF version 4.0 and above.
The control path between host and ESP peripheral is based on protobuf
. For that, corresponding stack layer, protocomm
from ESP-IDF is used. Run following command on ESP32 to make protocomm_priv.h
available for control path.
$ git mv components/protocomm/src/common/protocomm_priv.h components/protocomm/include/common/
For pre built hosted mode firmware is present in release
tab. Execute below command to flash it on ESP peripheral.
$ python esptool.py --chip esp32 --port <serial_port> --baud 960000 --before default_reset \
--after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect \
0x1000 esp_hosted_bootloader_esp32_spi_v<release_version>.bin \
0x10000 esp_hosted_firmware_esp32_spi_v<release_version>.bin \
0x8000 esp_hosted_partition-table_esp32_spi_v<release_version>.bin
Where,
<serial_port> : serial port of ESP peripheral
<release_version>: 0.1,0.2 etc. Latest from [release page](https://github.com/espressif/esp-hosted/releases)
- This command will flash
SPI
interface binaries onesp32
chip.
$ python esptool.py --port <serial_port> --baud 960000 --before default_reset --after hard_reset \
--chip esp32s2 write_flash --flash_mode dio --flash_size detect --flash_freq 80m \
0x1000 esp_hosted_bootloader_esp32s2_spi_v<release_version>.bin \
0x8000 esp_hosted_partition-table_esp32s2_spi_v<release_version>.bin \
0x10000 esp_hosted_firmware_esp32s2_spi_v<release_version>.bin
Where,
<serial_port> : serial port of ESP peripheral
<release_version>: 0.1,0.2 etc. Latest from [release page](https://github.com/espressif/esp-hosted/releases)
- This command will flash
SPI
interface binaries onesp32s2
chip.
For windows user, you can also program the binaries using ESP Flash Programming Tool.
Please use above mentioned ESP-IDF repository release branch for your ESP peripheral.
The control path between host and ESP peripheral is based on protobuf
. For that protocomm
layer from ESP-IDF is used. Run following command to make protocomm_priv.h
available for control path.
$ git mv components/protocomm/src/common/protocomm_priv.h components/protocomm/include/common/
Navigate to esp/esp_driver/network_adapter
directory
$ make clean
Run following command and navigate to Example Configuration -> Transport layer -> SPI interface -> select
and exit from menuconfig.
$ make menuconfig
To build and flash the app on ESP peripheral, run
$ make
$ make flash
$ idf.py fullclean
$ idf.py set-target esp32s2
Run following command and navigate to Example Configuration -> Transport layer -> SPI interface -> select
and exit from menuconfig. Read more about idf.py here.
$ idf.py menuconfig
To build and flash the app on ESP peripheral, run
$ idf.py -p <serial_port> build flash
Following guide explains how to use ESP-Hosted soultion with MCU based platform.