Skip to content

Latest commit

 

History

History
169 lines (132 loc) · 6.68 KB

MCU_based_readme.md

File metadata and controls

169 lines (132 loc) · 6.68 KB

Getting Started with MCU based host (STM32F469I)

Below diagram shows hardware and software block diagram for a typical MCU based system built with ESP-Hosted.

ESP-Hosted Block Diagram

1. Development Environment Setup

1.1 Preconditions

1.1.1 STM32CubeIDE installation

We recommend STM32CubeIDE version 1.4 IDE from STMicroelectronics on host machine(Laptop, Desktop etc.). User can download IDE from Here.

1.1.2 Tools for testing

  • 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.

1.1.3 ESP-Hosted Code Repository

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

2. Wi-Fi connectivity Setup over SPI

2.1 Hardware Setup/Connections

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.

Hardware connections for ESP32

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.

alt text

Hardware connections for ESP32-S2

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.

alt text

2. ESP peripheral setup

2.1 ESP-IDF requirement

MCU based ESP-Hosted solution is compatible with ESP-IDF version 4.0 and above.

2.2 Setup

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/

2.2.1 Using pre-built binary

For pre built hosted mode firmware is present in release tab. Execute below command to flash it on ESP peripheral.

ESP32
$ 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 on esp32 chip.
ESP32-S2
$ 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 on esp32s2 chip.

For windows user, you can also program the binaries using ESP Flash Programming Tool.

2.2.2 Compilation using source

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

Using make

⚠️ make build system is only supported till ESP32. Please refer cmake section below for ESP32-S2.

$ 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
Using cmake
$ idf.py fullclean

⚠️ Skip this step for ESP32. Run for ESP32-S2 only.

$ 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

3. ESP-Hosted Usage Guide

Following guide explains how to use ESP-Hosted soultion with MCU based platform.