The ESP32 module can be a standalone microcontroller that you program, or it can serve as a simple WiFi "command" interface for you to use from the SAMD51. This is made possible by the Adafruit ESP32 SPI library.

We need to program the ESP32 with specific firmware so it knows how to respond to commands from the SAMD51:

Instructions for Programming

❗ NOTE: A micro SD card is necessary to program the ESP32 using this method!

  1. Copy the latest NINA_W102...bin binary file from the SAM32 github "ESP32SPI/for sd card/" directory onto a microSD card and insert into your SAM32

  2. Plug your SAM32 board into your computer and put everything from the relevant "default" board directory (double check your board number) onto your SAM32

  3. Open a serial console and start the SAM32 REPL (Accessing the Serial Console)

  4. Press Ctrl + D to reboot the board, then Ctrl + C to halt it

  5. Type:

    >>> from sam32lib import sam32
    >>> 
    

    You should not see any [WARNING]. If you do, troubleshoot those, first.

  6. Now type:

    >>> sam32.esp_prog()
    

    and press enter. Watch the serial console as programming begins. BE PATIENT it'll take about 10 - 15 minutes for the programming to finish.

  7. Once it's finished, within the REPL type:

    >>> from sam32lib import sam32
    >>> sam32.esp_init()
    >>> sam32.ap_scan()
            xfinitywifi     RSSI: -81
            CableWiFi       RSSI: -81
            EDGE804         RSSI: -84
    >>>
    

    Seeing the printout of WiFi access points ("AP") is confirmation the ESP32 was properly programmed.