Skip to content

Provision an ESP32#

If you don't have an ESP32 device yet, you can buy one from here.

Before an ESP32 can be claimed into your organization in the Toit console, it needs to be initially provisioned. This means that the ESP32 is being granted a hardware ID used for the remaining of its lifecycle, and the latest released Toit firmware will be installed on the ESP32 device.

If you haven't yet installed Toit on your computer follow the steps described here.

Troubleshooting

If you have trouble connecting your ESP32 via a serial port to your computer, have a look in the section about serial port troubleshooting for help. Some hardware models need physical interaction with the device during flashing (like pushing a button). If flashing doesn't work, consult the documentation for your device.

Prerequisites#

In order to install Toit on your ESP32, the device should include 4MB of ROM and support the following features:

  • WiFi to enable the initial connection to the Toit cloud

  • UART to transmit and receive serial data

Drivers for macOS

If you are using macOS, you might need to update the drivers from here and here. Install both drivers, reboot your computer and try to run the Toit CLI serial commands again.

WiFi connection#

Since the ESP32 must connect to WiFi in order to come online after provisioning you must provide WiFi credentials (SSID and password) to the provision command for the WiFi connection you have available.

The WiFi settings can be changed later on when the ESP32 is online and has been claimed into your organization in the Toit console.

Provision your device#

Follow the steps to initially provision your device:

  • Connect the ESP32 with a USB cable to your computer where the Toit CLI is installed.

  • Use the Toit CLI command to provision your device with initial settings and the latest released Toit firmware. Enter your own WiFi credentials in the command:

    toit serial provision -p wifi.ssid=<SSID> -p wifi.password=<WiFi-password>
    
  • The provision process might take up to 5 minutes. When finished the output of the provision command will look like this:

looking for available hardware identities on disk
no hardware identities found on disk, claiming new hardware identity
Flashing device on port /dev/ttyUSB0
+--------------------------+--------------------------------------+
|         SETTING          |                VALUE                 |
+--------------------------+--------------------------------------+
| Firmware                 | v1.0.0                               |
| Device Model             | esp32-4mb                            |
| Hardware ID              | feddd5e3-fe15-4c91-a580-c1ff5b15b582 |
| Hardware Batch & Seq. No | 2020-11-10#377                       |
| context                  | remote                               |
| wifi.password            | mypassword                           |
| broker.host              | device.toit.io                       |
| broker.cn                | device.toit.io                       |
| broker.port              | 9426                                 |
| wifi.ssid                | myssid                               |  
+--------------------------+--------------------------------------+
erasing device flash
successfully erased device flash
writing device partitions
successfully written device partitions
reading hardware chip information
successfully read hardware chip information
+--------------------------+--------------------------------------+
|         SETTING          |                VALUE                 |
+--------------------------+--------------------------------------+
| factory device model     | esp32-4mb                            |
| factory firmware version | v1.0.0                               |
| chip ID                  |                                      |
+--------------------------+--------------------------------------+
device was successfully flashed
  • The device is now provisioned and ready to be claimed in the Toit console.

Device model#

The provision command sets the model on the device. The default model is esp32-4mb.

If you want to use another device model, you can provide it with -m in the provision command:

toit serial provision -m <model> -p wifi.ssid=<SSID> -p wifi.password=<WiFi-password>

Look for available device models for each firmware version available in the Toit console.

If the initial device provision fails during the provisioning steps, the hardware ID (if any) is written to the local disk if possible and will be reused the next time the command is executed on the same computer.

Also, if the provision command failed, consider trying with a lower baud rate (here half the default baud rate):

toit serial provision --baud 460800 -p wifi.ssid=<SSID> -p wifi.password=<WiFi-password>