ESP-IDF Installation and Build

ESP-IDF is a framework or set of tools provided by Espressif - the manufacturer of the ESP32-S3 chip used by Loco.

ESP-IDF runs on Linux, MacOS and Windows and you can find instructions here.

There are four steps to installing the tools and building and running the Loco example code.

  1. Install Git
  2. Install ESP-IDF
  3. Download the example code
  4. Build and Run

The following instructions are for Windows.

Linux and MacOS users should be able to get the general idea from this and use the Espressif website.

Install Git

Download Git here.

You are probably already aware of Git. If not you should find out more but we will use it to download the example code from the Brennan repository at Github.

Install ESP-IDF

Follow the links on the Espressif page to the Windows Installer Download

Click on the button for the Universal Online Installer.
This downloads a small file which you must execute.
You should then accept all the defaults.

This will install the ESP_IDF tools and dependencies (other programs ESP-IDF needs) and will take several minutes.
At the end of this the installer opens a command prompt window and a Power Shell window.

You will work in the Power Shell window so you can close the command prompt window.

If and when you need to re-open the Power Shell window to use ESP-IDF - type "ESP" into the start box and select - ESP-IDF 5.4 PowerShell

Download the Example code

You need to decide where to put the example project. Its not really important so I suggest you use your user profile directory - usually c:\users\username.

In the Power Shell window type


cd ~
git clone https://github.com/martinbrennan/locoDemo1.git

This downloads the example code as a project to the folder locoDemo1.

Build and Run

Connect your Loco PCB to your PC using a USB cable. 

Then type the following commands into Power Shell


cd locoDemo1
idf.py build
idf.py flash monitor

 

The build step compiles all the code in the example. This takes longer the first time (a minute or so) but is much quicker on subsequent rebuilds.

The flash command programs the ESP chip on the Loco PCB. You can do this as many times as you want.

The monitor command starts the program on the ESP32 and displays any messages sent by the ESP32 in the Power Shell window.

To exit the monitor you must hit CTRL+]

Pressing the reset button on the Loco PCB will restart the program last loaded.