|
| 1 | +.. _mimxrt_wlan_pinout: |
| 2 | + |
| 3 | +Managing external WLAN/BLE adapters |
| 4 | +=================================== |
| 5 | + |
| 6 | +Connection scheme for the i.MXRT WLAN adapters |
| 7 | +---------------------------------------------- |
| 8 | + |
| 9 | +Mapping between the NINA/esp_hosted signals and board pins by name. |
| 10 | + |
| 11 | +======== ========== ======= ======== ====== ====== ======= ======== |
| 12 | +NINAW10 esp_hosted Airlift MIMXRT Teensy OLIMEX Seeed METRO M7 |
| 13 | + Name Name Name 10xx_EVK 4.x RT1010 ArchMix Airlift |
| 14 | +======== ========== ======= ======== ====== ====== ======= ======== |
| 15 | +MOSI/RTS MOSI MOSI D11 D11 A2 J4-14 MOSI |
| 16 | +MISO MISO MISO D12 D12 A1 J4-13 MISO |
| 17 | +SCK SCK SCK D13 D13 A4 J4-15 SCK |
| 18 | +CS CS CS D10 D5 A3 J4-12 ESP_CS |
| 19 | +ACK/CTS HANDSHAKE Busy D7 D9 SCL2 J4-11 ESP_BUSY |
| 20 | +RESET RESET Reset D5 D6 SDA2 J4-10 ESP_RESET |
| 21 | +GPIO0 DATAREADY GP0 D6 D10 (*) J4-09 ESP_GP0 |
| 22 | +SPI# 0 0 0 0 0 |
| 23 | +TX TX TX D0 D0 D8 J4-06 D0 |
| 24 | +RX RX RX D1 D1 D7 J4-07 D1 |
| 25 | +RTS MOSI/RTS RTS D11 D11 A2 J4-14 MOSI |
| 26 | +CTS CTS CTS D12 D12 SCL2 J4-13 ESP_BUSY |
| 27 | +UART# 1 1 2 3 1 |
| 28 | +======== ========== ======= ======== ====== ====== ======= ======== |
| 29 | + |
| 30 | +(*) GPIO0 of the WiFi module can be shared e.g. with SCK if they are |
| 31 | + decoupled with a resistor from SCK (Host) to the GPIO input module. |
| 32 | + |
| 33 | +Mapping between firmware signal names and ESP32 pins for the NINA firmware |
| 34 | +and esp_hosted firmware |
| 35 | + |
| 36 | +======== ========== ======== ======= ======= |
| 37 | +NINAW10 esp_hosted NINA Airlift Airlift |
| 38 | +Name Name W102 pin Name pin |
| 39 | +======== ========== ======== ======= ======= |
| 40 | +MOSI MOSI 12 MOSI 14 |
| 41 | +MISO MISO 23 MISO 23 |
| 42 | +SCK SCK 18 SCK 18 |
| 43 | +GPIO1/CS CS 5 CS 5 |
| 44 | +ACK HANDSHAKE 33 Busy 33 |
| 45 | +RESET RESET EN Reset EN |
| 46 | +GPIO0 DATAREADY 0 GP0 0 |
| 47 | +TX TX 1 TX 1 |
| 48 | +RX TX 3 RX 3 |
| 49 | +RTS MOSI/RTS 12 - 14 |
| 50 | +CTS CTS 33 - 33 |
| 51 | +======== ========== ======== ======= ======= |
| 52 | + |
| 53 | +Mapping between the NINA/esp_hosted signals and adapter pins by name. |
| 54 | + |
| 55 | +======== ========== ======= ========= ======== ========= ========== |
| 56 | +NINAW10 esp_hosted Airlift ItsyBitsy Feather METRO M7 Airlift |
| 57 | +Name Name Name Add-on Add-on Airlift Uno Shield |
| 58 | +======== ========== ======= ========= ======== ========= ========== |
| 59 | +MOSI MOSI MOSI MOSI MOSI MOSI MOSI |
| 60 | +MISO MISO MISO MISO MISO MISO MISO |
| 61 | +SCK SCK SCK SCK SCK SCK SCK |
| 62 | +GPIO1/CS CS CS ECS ESPCS ESP_CS CS |
| 63 | +ACK HANDSHAKE Busy EBSY ESPBUSY ESP_BUSY BUSY |
| 64 | +RESET RESET Reset RST ESPRESET ESP_RESET RST |
| 65 | +GPIO0 DATAREADY GP0 GPIO0 ESPGPIO0 ESP_GP0 G0 |
| 66 | +TX TX TX ETX ESPTX ESP_TX TX |
| 67 | +RX RX RX ERX ESPRX ESP_RX RX |
| 68 | +======== ========== ======= ========= ======== ========= ========== |
| 69 | + |
| 70 | +Signals required for WiFi: |
| 71 | + |
| 72 | +- NinaW10: MISO/MOSI/SCK (SPI), CS, Busy (ACK), Reset |
| 73 | +- esp_hosted: MISO/MOSI/SCK (SPI), CS, Handshake, Dataready, Reset |
| 74 | + |
| 75 | +Signals required for Bluetooth: |
| 76 | + |
| 77 | +- NinaW10: RX/TX (UART), RTS (MOSI), CS, RESET |
| 78 | +- esp_hosted: RX/TX (UART), RTS (MOSI), CS, RESET |
| 79 | + |
| 80 | +CTS seems not to be used, but specified. |
| 81 | + |
| 82 | +Signals required for NINA/esp_hosted firmware upload: |
| 83 | + |
| 84 | +- RX/TX (UART), GPIO0, Reset. |
| 85 | + |
| 86 | +If the hardware supports it, pull RESET low (!). That keeps the |
| 87 | +ESP32 with the NINA/esp_hosted firmware silent and at low power |
| 88 | +when not being used. |
| 89 | + |
| 90 | + |
| 91 | +.. _mimxrt_wlan_firmware_upload: |
| 92 | + |
| 93 | +Instructions for WLAN/BLE firmware upload ESP32 module |
| 94 | +------------------------------------------------------ |
| 95 | + |
| 96 | +The NINA firmware in the NINA module has to be updated for use with MicroPython. That can be done |
| 97 | +using MicroPython and two small Python scripts. |
| 98 | + |
| 99 | +The firmware binaries are available at |
| 100 | +https://github.com/micropython/micropython-lib/tree/master/micropython/espflash |
| 101 | +There are the firmware files available for different esp32 modules. |
| 102 | + |
| 103 | +1. Adafruit Airlift modules with NINA firmware: NINA_FW_v1.5.0_Airlift.bin. |
| 104 | +2. Adafruit Airlift modules with esp_hosted firmware: esp_hosted_airlift.bin |
| 105 | +3. Arduino Nano RP2040 connect: NINA_FW_v1.5.0_W102.bin |
| 106 | + |
| 107 | +For the mimxrt boards with i.MX RT 101x MCU, you need the file NINA_FW_v1.5.0_Airlift.bin, for |
| 108 | +all other boards esp_hosted_airlift.bin. |
| 109 | + |
| 110 | +For firmware upload, the following connections to the WiFi module are required: |
| 111 | + |
| 112 | +- Pin Reset (as above) |
| 113 | +- Pin GPIO0 |
| 114 | +- UART RX |
| 115 | +- UART TX |
| 116 | + |
| 117 | +The GPIO pins and UART device id varies between boards. See the tables above. |
| 118 | +At the Adafruit Metro M7 board, the UART is UART(1), and the Pin names |
| 119 | +for reset and GPIO0 are ESP_RESET and ESP_GPIO0. |
| 120 | +The firmware can be uploaded, using the espflash.py module, a short script |
| 121 | +using espflash.py and mpremote. espflash.py is available at |
| 122 | +https://github.com/micropython/micropython-lib/tree/master/micropython/espflash. |
| 123 | +This place also holds the example script.:: |
| 124 | + |
| 125 | + import espflash |
| 126 | + from machine import Pin |
| 127 | + from machine import UART |
| 128 | + import sys |
| 129 | + sys.path.append("/flash") |
| 130 | + |
| 131 | + reset = Pin("ESP_RESET", Pin.OUT) |
| 132 | + gpio0 = Pin("ESP_GPIO0", Pin.OUT) |
| 133 | + uart = UART(0, 115200, timeout=350) |
| 134 | + |
| 135 | + md5sum = b"b0b9ab23da820a469e597c41364acb3a" |
| 136 | + path = "/remote/NINA_FW_v1.5.0_Airlift.bin" |
| 137 | + |
| 138 | + esp = espflash.ESPFlash(reset, gpio0, uart) |
| 139 | + # Enter bootloader download mode, at 115200 |
| 140 | + esp.bootloader() |
| 141 | + # Can now change to higher/lower baud rate |
| 142 | + esp.set_baudrate(921600) |
| 143 | + # Must call this first before any flash functions. |
| 144 | + esp.flash_attach() |
| 145 | + # Read flash size |
| 146 | + size = esp.flash_read_size() |
| 147 | + # Configure flash parameters. |
| 148 | + esp.flash_config(size) |
| 149 | + # Write firmware image from internal storage. |
| 150 | + esp.flash_write_file(path) |
| 151 | + # Compares file and flash MD5 checksum. |
| 152 | + esp.flash_verify_file(path, md5sum) |
| 153 | + # Resets the ESP32 chip. |
| 154 | + esp.reboot() |
| 155 | + |
| 156 | +The script shows the set-up for the Metro M7 board. |
| 157 | +The md5sum is the one of the WiFi firmware. It may change and |
| 158 | +can be recalculated using e.g. the Linux *md5sum* command. It is used to |
| 159 | +verify the firmware upload. To upload the firmware, place the firmware |
| 160 | +and the above script (let's call it ninaflash.py) into the same directory |
| 161 | +on your PC, and run the command:: |
| 162 | + |
| 163 | + mpremote connect <port> mount . run ninaflash.py |
| 164 | + |
| 165 | +After a while, the upload will start. A typical start sequence looks like:: |
| 166 | + |
| 167 | + Local directory . is mounted at /remote |
| 168 | + Failed to read response to command 8. |
| 169 | + Failed to read response to command 8. |
| 170 | + Changing baudrate => 921600 |
| 171 | + Flash attached |
| 172 | + Flash size 2.0 MBytes |
| 173 | + Flash write size: 1310720 total_blocks: 320 block size: 4096 |
| 174 | + Writing sequence number 0/320... |
| 175 | + Writing sequence number 1/320... |
| 176 | + Writing sequence number 2/320... |
| 177 | + Writing sequence number 3/320... |
| 178 | + Writing sequence number 4/320... |
| 179 | + .... |
| 180 | + .... |
| 181 | + Writing sequence number 317/320... |
| 182 | + Writing sequence number 318/320... |
| 183 | + Writing sequence number 319/320... |
| 184 | + Flash write finished |
| 185 | + Flash verify: File MD5 b'b0b9ab23da820a469e597c41364acb3a' |
| 186 | + Flash verify: Flash MD5 b'b0b9ab23da820a469e597c41364acb3a' |
| 187 | + Firmware verified. |
| 188 | + |
| 189 | +The initial messages *Failed to read response to command 8.* |
| 190 | +can be ignored. |
0 commit comments