tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/espat/README.md (about)

     1  # ESP-AT Driver
     2  
     3  This package provides a driver to use a separate connected WiFi processor either the ESP8266 or the ESP32 from Espressif. 
     4  
     5  The way this driver works is by using the UART interface to communicate with the WiFi chip using the Espressif AT command set.
     6  
     7  ## ESP-AT Firmware Installation
     8  
     9  In order to use this driver, you must have the ESP-AT firmware installed on the ESP8266/ESP32 chip.
    10  
    11  ### Installing on Arduino Nano33 IoT
    12  
    13  In order to install the needed firmware on the Arduino Nano33 IoT board's built-in NINA W102 chip, you will need to use the `arduino-nano33-iot` branch of this fork of the firmware:
    14  
    15  https://github.com/hybridgroup/esp32-at
    16  
    17  To flash this firmware on the Arduino Nano33 IoT you will need to follow the following procedure:
    18  
    19  - Install _Arduino SAMD Boards_ from the Boards Manager.
    20  - Install _WiFiNANO_ from the Library Manager.
    21  - Using the normal Arduino software, load the `SerialNINAPassthrough` sketch on to the board (in File -> Examples -> WiFiNINA-> Tools).
    22  - Flash the NINA 102 firmware using the `make flash` command in the https://github.com/hybridgroup/esp32-at repo.
    23  
    24  You only need to do this one time, and then the correct ESP-AT firmware will be on the NINA chip, and you can just flash the Arduino Nano33 IoT board using TinyGo. We should be able to remove some of these step in a future release of this software.
    25  
    26  ### Installing on ESP32
    27  
    28  The official repository for the ESP-AT for the ESP32 processor is located here:
    29  
    30  https://github.com/espressif/esp32-at
    31  
    32  Your best option is to follow the instructions in the official repo.
    33  
    34  ### Installing on ESP8266
    35  
    36  The official repository for the AT command set firmware for the ESP8266 processor is located here:
    37  
    38  https://github.com/espressif/ESP8266_NONOS_SDK
    39  
    40  First clone the repo:
    41  
    42  ```shell
    43  git clone https://github.com/espressif/ESP8266_NONOS_SDK.git
    44  ```
    45  
    46  You will also need to install the Espressif `esptool` to flash this firmware on your ESP8266:
    47  
    48  https://github.com/espressif/esptool
    49  
    50  Once you have obtained the binary code, and installed `esptool`, you can flash the ESP8266.
    51  
    52  Here is an example shell script that flashes a Wemos D1 Mini board:
    53  
    54  
    55  ```python
    56  #!/bin/sh
    57  SPToolDir="$HOME/.local/lib/python2.7/site-packages"
    58  FirmwareDir="$HOME/Development/ESP8266_NONOS_SDK"
    59  cd "$SPToolDir"
    60  port=/dev/ttyUSB0
    61  if [ ! -c $port ]; then
    62     port=/dev/ttyUSB0
    63  fi
    64  if [ ! -c $port ]; then
    65     echo "No device appears to be plugged in.  Stopping."
    66  fi
    67  printf "Writing AT firmware to the Wemos D1 Mini in 3..."
    68  sleep 1; printf "2..."
    69  sleep 1; printf "1..."
    70  sleep 1; echo "done."
    71  echo "Erasing the flash first"
    72  esptool.py --port $port erase_flash
    73  esptool.py --port /dev/ttyUSB0 --baud 115200 \
    74     write_flash -fm dio -ff 20m -fs detect \
    75     0x0000 "$FirmwareDir/bin/boot_v1.7.bin" \
    76     0x01000 "$FirmwareDir/bin/at/512+512/user1.1024.new.2.bin" \
    77     0x3fc000 "$FirmwareDir/bin/esp_init_data_default_v05.bin"  \
    78     0x7e000 "$FirmwareDir/bin/blank.bin" \
    79     0x3fe000 "$FirmwareDir/bin/blank.bin"
    80  
    81  echo "Check the boot by typing: miniterm $port 74800"
    82  echo " and then resetting.  Use Ctrl-] to quit miniterm."
    83  
    84  ```