diff --git a/docs/eval/user-guide/eval-ad5421/img/EVAL-AD5421-Drawing.png b/docs/eval/user-guide/eval-ad5421/img/EVAL-AD5421-Drawing.png new file mode 100644 index 000000000..11900b17a --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/EVAL-AD5421-Drawing.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31e689ab1e5cd7744c5198b77af9579ce5c97f6c69a8db7b85ed989e933ca98c +size 211989 diff --git a/docs/eval/user-guide/eval-ad5421/img/ad5421-gui-fail.png b/docs/eval/user-guide/eval-ad5421/img/ad5421-gui-fail.png new file mode 100644 index 000000000..1c184a1fc --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/ad5421-gui-fail.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5315d021410337a2643ad35776418575c2130de009c4ef04521c2865bdc10ee +size 151957 diff --git a/docs/eval/user-guide/eval-ad5421/img/ad5421-gui.png b/docs/eval/user-guide/eval-ad5421/img/ad5421-gui.png new file mode 100644 index 000000000..2125e9ed4 --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/ad5421-gui.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46f4ab38030b636ef033a352da3244bf99e18718af7685198480e4ec0217822f +size 156033 diff --git a/docs/eval/user-guide/eval-ad5421/img/drag-n-drop-fw.png b/docs/eval/user-guide/eval-ad5421/img/drag-n-drop-fw.png new file mode 100644 index 000000000..21498cf89 --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/drag-n-drop-fw.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d68ca9e7b196459764c4fe048692f0b3aa3b033a147309e8fa57cbfbf972b3bd +size 59983 diff --git a/docs/eval/user-guide/eval-ad5421/img/pmod-spi-std.png b/docs/eval/user-guide/eval-ad5421/img/pmod-spi-std.png new file mode 100644 index 000000000..43fc9c0eb --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/pmod-spi-std.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f74db617f8bc0dffd83f6bb48e55fdd1ef402fce8cac0bd21c434c7a30335ebd +size 10732 diff --git a/docs/eval/user-guide/eval-ad5421/img/sdp-ad5421.jpg b/docs/eval/user-guide/eval-ad5421/img/sdp-ad5421.jpg new file mode 100644 index 000000000..c2579a589 --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/sdp-ad5421.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1aece931ab5a138408343601eaed83da944620a1ea2aea39b6c6e43ea796d71c +size 2005890 diff --git a/docs/eval/user-guide/eval-ad5421/img/serial-output.png b/docs/eval/user-guide/eval-ad5421/img/serial-output.png new file mode 100644 index 000000000..cc4c10115 --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/serial-output.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:88cec760fc3e993ea87442503565742474aad4134b218bb03f389deb5b11a53b +size 32583 diff --git a/docs/eval/user-guide/eval-ad5421/img/v1/ad5421-max32670.jpg b/docs/eval/user-guide/eval-ad5421/img/v1/ad5421-max32670.jpg new file mode 100644 index 000000000..206d369c7 --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/v1/ad5421-max32670.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f10df6693c9f4640f1f2234fb172074bab81b9042730c68b68a25490cf2e523c +size 2377475 diff --git a/docs/eval/user-guide/eval-ad5421/img/v1/adxl-solo.jpg b/docs/eval/user-guide/eval-ad5421/img/v1/adxl-solo.jpg new file mode 100644 index 000000000..9df4173de --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/v1/adxl-solo.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:11ac53847d5434e1ef2e94bb3a1bb37c07d3a5b37c3dc0f433824d268138a321 +size 1588969 diff --git a/docs/eval/user-guide/eval-ad5421/img/v1/adxl345pmod-max32670.jpg b/docs/eval/user-guide/eval-ad5421/img/v1/adxl345pmod-max32670.jpg new file mode 100644 index 000000000..a6aaa1cf0 --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/v1/adxl345pmod-max32670.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3a4f8629402c68fb8bc331384f87f40940b0008171f5abb60b54b5739814234e +size 1773248 diff --git a/docs/eval/user-guide/eval-ad5421/img/v1/final-hw-on.jpg b/docs/eval/user-guide/eval-ad5421/img/v1/final-hw-on.jpg new file mode 100644 index 000000000..faf886276 --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/v1/final-hw-on.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:52d6322ce67f237773073d554404cb2bcd9f6a26156c236ea7b8d52ea80593a6 +size 2511291 diff --git a/docs/eval/user-guide/eval-ad5421/img/v1/final-hw.jpg b/docs/eval/user-guide/eval-ad5421/img/v1/final-hw.jpg new file mode 100644 index 000000000..4231425e7 --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/v1/final-hw.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34da0d2f5891f22949d5fb1179dc00c6dd12faf7b7cf41bbb001ad3ac04fcdfc +size 2479791 diff --git a/docs/eval/user-guide/eval-ad5421/img/v2/ad5421-spi1.jpg b/docs/eval/user-guide/eval-ad5421/img/v2/ad5421-spi1.jpg new file mode 100644 index 000000000..f45f58f4d --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/v2/ad5421-spi1.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2504a8d98dc1592c6db13c56f2f80ed756e3acfe6ee3642d288fecb908a05de1 +size 601374 diff --git a/docs/eval/user-guide/eval-ad5421/img/v2/adxl382-mcu.jpg b/docs/eval/user-guide/eval-ad5421/img/v2/adxl382-mcu.jpg new file mode 100644 index 000000000..c89c123a8 --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/v2/adxl382-mcu.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9221743690a7e412938c1e5737f66424a57389a9e082c4135bbeb02156d70ac6 +size 440968 diff --git a/docs/eval/user-guide/eval-ad5421/img/v2/adxl382-solo.jpg b/docs/eval/user-guide/eval-ad5421/img/v2/adxl382-solo.jpg new file mode 100644 index 000000000..f2890b9ba --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/v2/adxl382-solo.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c83708aa5796e2e6c0686cf47a4a3d1cf7711907ecb8c902de2f1c41b7cd9d9 +size 413531 diff --git a/docs/eval/user-guide/eval-ad5421/img/v2/system.jpg b/docs/eval/user-guide/eval-ad5421/img/v2/system.jpg new file mode 100644 index 000000000..0e82587ae --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/img/v2/system.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ccedbfd35b234d76e32729e1532595c193df1018255ef7b282b1f2a37f13e33 +size 737620 diff --git a/docs/eval/user-guide/eval-ad5421/index.rst b/docs/eval/user-guide/eval-ad5421/index.rst new file mode 100644 index 000000000..bbf616a6b --- /dev/null +++ b/docs/eval/user-guide/eval-ad5421/index.rst @@ -0,0 +1,337 @@ +4-20mA Accelerometer-Correlated Industrial Output +================================================= + +.. attention:: + + This is a draft, very much WIP document in a fork of ``__ + +This project uses the :adi:`MAX32670` microcontroller with the :adi:`ADXL382` +MEMS accelerometer and :adi:`AD5421` 4-20mA Industrial DAC. The DAC output is correlated to the +Z-axis of the accelerometer because it’s usually the easiest to think +about. When the ADXL IC is sitting flat on a table, for example, the +normal vector in the Z-direction points fully up giving a normalized dot +product of 1. Therefore, under these conditions the Z component of the +ADXL output is +1.0. If you flip the ADXL, the Z component goes to -1.0. + +.. figure:: img/v2/system.jpg + :alt: Final HW Powered + + Final HW Powered + +.. figure:: img/serial-output.png + :alt: Output on Serial Port + + Output on Serial Port + +Hardware Setup +-------------- + +Boards +~~~~~~ + +There are 4 boards currently involved in doing the setup for this +project. + +- `MAX32670EVKIT `__ + ARM Cortex M4F Microcontroller +- `EVAL-AD5421 `__ + 4-20mA DAC +- `EVAL-SDP-CB1Z `__ + (just for powering the AD5421’s DVDD at the moment) +- `EVAL-ADXL382 `__ + MEMs Accelerometer + +.. note:: Before proceeding, please ensure the “BOOT LD EN” switch on + the MAX32670 EV Kit is set to “DIS” to disable the bootloader. + +AD5421 Setup +~~~~~~~~~~~~ + +Power +^^^^^ + +To setup the AD5421 DAC, the Eval-SDP-CB1Z board must be used to power +the AD5421 board at this time. There are multiple SDP connectors on the +SDP board; please verify the connection with the below image before +plugging in power. Also, please disconnect power before proceeding with +this guide to avoid damaging boards. + +.. figure:: img/sdp-ad5421.jpg + :alt: Eval-SDP-CB1Z to AD5421 connection + + Eval-SDP-CB1Z to AD5421 connection + +[OPTIONAL] Troubleshooting with the AD5421 GUI +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Note that it is possible at this point to verify communication with the :adi:`EVAL-AD5421` GUI. The GUI can be located on the Product Page under "AD5421 Evaluation Software". + +Once the Eval GUI has been installed, you can verify communication by connecting the SDP-BZ board to the AD5421 kit as shown in the above image, and connecting power over USB. + +Then, launch the GUI. You should see no popup warnings, and the Control Register is read by the GUI. You can also toggle various parameters such as the Auto Fault Readback to check that the Control Register can be be properly read & written, verifying SPI communication from the SDP-BZ board to the AD5421 and proper power-up for the AD5421. + +.. figure:: img/sdp-ad5421.jpg + :alt: Successful EVAL-AD5421 Communication + + +If communication to the AD5421 fails, a warning popup will show as follows: + +.. figure:: img/ad5421-gui-fail.png + :alt: Failed EVAL-AD5421 Communication + + +Soldering for the AD5421 +^^^^^^^^^^^^^^^^^^^^^^^^ + +.. warning:: Please disconnect power from all sources before + continuing. + +To work with the AD5421, TP1-6 (for SPI and FAULTIN/LDAC) and TP19 +should be soldered in. TP19 is just so the boards can directly share a +GND pin, and also depends on the position of the Reg_Sel1 jumper (do NOT +move this jumper unless you use a different test point for the GND). + +- TP1 - !SS0 / !SYNC + +- TP2 - SCLK + +- TP3 - SDI / MOSI + +- TP4 - SDO / MISO + +- TP5 - FAULTIN + +- TP6 - !LDAC + +- TP19 - GND. Can also use COM, but this avoid bringing any jumpers + close to the exposed supply. + +SPI Connection +^^^^^^^^^^^^^^ + +The EVAL-AD5421SDZ platform must be connected to the SPI1 bus on +MAX32670. Connect these MCU pins on GPIO0 for AD5421: + +- P0.17 –> TP1 +- P0.16 –> TP2 +- P0.15 –> TP3 +- P0.14 –> TP4 +- LDAC (GPIO P0.30 or GND) –> TP6 +- FAULTIN (optional) –> TP5 (unused, may be monitored with an + oscilloscope) +- GND (COM or TP19) - Any GND pin on the MAX32670 EVKit + +.. figure:: img/v2/ad5421-spi1.jpg + :alt: AD5421-MAX32670 EV KIT Connections + + AD5421-MAX32670 EV KIT Connections + +Jumper Settings for the AD5421 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The following jumpers are set by default for the AD5421 kit: + +- LK1 +- LK2 –> Position B +- LK4 +- LK6 +- LK7 (use onboard resistor if not provided externally on LOOP+/LOOP-) + +ADXL382 Setup +~~~~~~~~~~~~~ + +Connecting ADXL382 to MAX32670 +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The ADXL382 connects to MAX32670 over SPI0. There are silkscreen +markings for SPI0 on the MAX32670 EVKit. ADXL382 uses the following +pins: + +- V_AUX (3.3V) / GND +- P0.2 (SPI0 MISO) +- P0.3 (SPI0 MOSI) +- P0.4 (SPI0 SCK) +- P0.5 (SPI0 SS0) + +|ADXL345 Connection| |ADXL345 Solo| + +Final HW Setup +~~~~~~~~~~~~~~ + +The final hardware setup between Eval Kits looks like the below: + +.. figure:: img/v2/system.jpg + :alt: final HW setup + + final HW setup + +Finally, connect a 6-24V, >20 mA supply to LOOP+/LOOP- on the AD5421 +kit. Connect both USB ports and turn on the supply. If the Serial port +output shows an error due to supply sequencing, try resetting the +MAX32670 via the RSTN button (SW2). + +Flashing the ‘Prebuilt’ Demo +---------------------------- + +Under the ``prebuilt`` folder, there will be a .BIN file (e.g. ``adxl382-max32670-ad5421-v1.0.0.bin``) that contains +pre-built code. For those who do not want to compile the code +themselves, the prebuilt binary may be flashed to the MCU instead. To do +so, visit the following page: +https://github.com/analogdevicesinc/max32625pico-firmware-images + +.. important:: Follow the instructions under the **“How to update the + firmware?”** heading on the link above, holding down **SW4 on the + MAX32670EVKIT** when you plug it in. Use the + ``max32625_max32670evkit_if_crc_swd_v1.0.3.bin`` file inside the + prebuilt/ folder or the MAX32670 file to update the programmer on the + MAX32670 board. + +Once you have updated the above firmware, you should see a DAPLINK drive +show up on your PC. At this point, you can drag-n-drop the .BIN file +onto the DAPLINK drive to program the prebuilt binary. + +.. figure:: img/drag-n-drop-fw.png + :alt: drag-n-drop + + drag-n-drop + +Building the Software +--------------------- + +The software is built using ADI’s +`No-OS `__ software +framework. This requires an installation of the MaximSDK on the system +to use the low-level Hardware-Access-Layer (HAL) drivers for the MAX32 +parts. After fully installing the MSDK, setup No-OS to build for “Maxim” +devices. Please review the following guides for the setup: + +`MSDK Installation +Guide `__ +`No-OS Build +Guide `__ + +Install MSDK +~~~~~~~~~~~~ + +Please follow the MSDK Installation Guide link above completely to +install the MSDK for MAX32 microcontrollers. + +Setup No-OS +~~~~~~~~~~~ + +.. note:: To build this application, the author uses + `MSYS2 `__ via `Git + Bash `__. To avoid conflating + environments, it may be wise to try using an MSYS2 environment when + buiding the software. + + A few tools are needed to build the program besides MSDK / No-OS: - + GNU Make - Git (for cloning No-OS) + + These can be installed by calling + ``pacman -S git mingw-w64-x86_64-make`` in an MSYS2 environment. + +Please follow the No-OS guide with the “Maxim” setup for your operating +system (e.g. Windows–> Maxim). The steps are re-printed below targeting +a Windows setup to add clarity. MSYS2 is used by the author as the +primary Windows environment. + +- Install MSDK + +- Clone no-OS recursively ( ``git clone --recursive `` ) + +- Open the project on command-line ( + ``cd no-OS/projects/z-adxl-max32670-ad5421/`` ) + +- Set MAXIM_LIBRARIES environment variable ( + ``export MAXIM_LIBRARIES=/c/MaximSDK/Libraries`` if using MSYS2 ) + +- Set the environment variables for the PLATFORM and TARGET. ( + ``export PLATFORM=maxim TARGET=max32670`` ) + +- Finally, type “``make -j10``” into the command-line. + +.. warning:: If you get the error + ``*** multiple target patterns. Stop.``, it is most likely because of + the ‘:’ in the MAXIM_LIBRARIES environment variable. This cause Make + to think there is more than one application to build (the ‘:’ + character is a separator in GNU Make). Using MSYS2, make sure you + supply ``/c/`` as the path to your Windows hard drive e.g + ``MAXIM_LIBRARIES=/c/MaximSDK/Libraries``. - If rebuilding the + application, it’s wise to fully delete the ``build/`` folder between + builds due to the way No-OS’s build system works. Ensure every build + starts fresh this way before attempting to re-build the software. + +Flashing the Software +--------------------- + +With the MAX32670 EVKit connected via USB port, the software can be +flashed by calling ``make run`` from the project folder. The MAX32670 EV +Kit should enumerate as a USB device called “CMSIS-DAP”, and show up +similar to a USB Flash Drive under ``This PC`` in Windows File Explorer. + +:: + + # Log of "make run" Output + + $ make run + + [11:25:54] Building for maxim + [11:25:54] Done (build/z-adxl-max32670-ad5421.elf) + Open On-Chip Debugger (Analog Devices 0.12.0-1.0.0-7) OpenOCD 0.12.0 (2023-09-27-07:53) + Licensed under GNU GPL v2 + Report bugs to + DEPRECATED! use 'adapter driver' not 'interface' + DEPRECATED! use 'adapter srst delay' not 'adapter_nsrst_delay' + DEPRECATED! use 'adapter srst pulse_width' not 'adapter_nsrst_assert_width' + Info : CMSIS-DAP: SWD supported + Info : CMSIS-DAP: Atomic commands supported + Info : CMSIS-DAP: Test domain timer supported + Info : CMSIS-DAP: FW Version = 2.0.0 + Info : CMSIS-DAP: Serial# = 0423170264fa4de900000000000000000000000097969906 + Info : CMSIS-DAP: Interface Initialised (SWD) + Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 0 TDO = 0 nTRST = 0 nRESET = 1 + Info : CMSIS-DAP: Interface ready + Info : clock speed 2000 kHz + Info : SWD DPIDR 0x2ba01477 + Info : [max32xxx.cpu] Cortex-M4 r0p1 processor detected + Info : [max32xxx.cpu] target has 6 breakpoints, 4 watchpoints + Info : starting gdb server for max32xxx.cpu on 3333 + Info : Listening on port 3333 for gdb connections + [max32xxx.cpu] halted due to debug-request, current mode: Handler HardFault + xPSR: 0xa1000003 pc: 0x10009376 msp: 0x2001ff00 + Warn : [max32xxx.cpu] Only resetting the Cortex-M core, use a reset-init event handler to reset any peripherals or configure hardware srst support. + [max32xxx.cpu] halted due to debug-request, current mode: Thread + xPSR: 0x01000000 pc: 0x000001b4 msp: 0x20004000 + ** Programming Started ** + ** Programming Finished ** + ** Verify Started ** + ** Verified OK ** + ** Resetting Target ** + Warn : [max32xxx.cpu] Only resetting the Cortex-M core, use a reset-init event handler to reset any peripherals or configure hardware srst support. + shutdown command invoked + [11:26:00] z-adxl-max32670-ad5421.elf uploaded to board + +Connecting to the Serial Port +----------------------------- + +The serial port on the MAX32670 EV Kit comes through the USB connector +and using 115200 baud, 8 bits, No Parity, 1 Stop bit (8-N-1) settings. +To view the serial port output, use a serial monitor such as +`TeraTerm `__ or any +functional equivalent. A USB COM port should show up with the USB Name +“mbed Serial Port”. Connect to this and you should see the accelerometer +output and corresponding DAC value being printed repeatedly. + +.. figure:: img/serial-output.png + :alt: Serial Port Output + + Serial Port Output + +Otherwise, the application has most likely hit an error and stopped +printing. This can be due to any of the devices having a communication +problem, or the AD5421 hits a FAULT, for example. Press the RSTN button +on the MAX32670 EV Kit to restart the application. + +.. |ADXL345 Connection| image:: img/v2/adxl382-mcu.jpg +.. |ADXL345 Solo| image:: img/v2/adxl382-solo.jpg diff --git a/docs/eval/user-guide/index.rst b/docs/eval/user-guide/index.rst index 5187be7be..3ce04a0d2 100644 --- a/docs/eval/user-guide/index.rst +++ b/docs/eval/user-guide/index.rst @@ -31,6 +31,12 @@ Digital to Analog Converters Digital to Analog Converters (Current Output) ------------------------------------------------------------------------------- +.. toctree:: + :caption: 4-20mA DACs + :maxdepth: 1 + + eval-ad5421/index + Direct Digital Synthesis (DDS) ------------------------------------------------------------------------------- diff --git a/docs/software/zephyr-wifi-with-apard32690/index.rst b/docs/software/zephyr-wifi-with-apard32690/index.rst new file mode 100644 index 000000000..f37dfcfaf --- /dev/null +++ b/docs/software/zephyr-wifi-with-apard32690/index.rst @@ -0,0 +1,233 @@ +Networking Support - WiFi / T1L +=============================== + +The following document describes how to build and flash firmware for boards with the NINA-W102 WiFi module. As an example, it will use the :adi:`MAX32690 Arduino Form-Factor Board `. +It will also describe how to build and flash the Zephyr Wifi sample to work with this board once the NINA-W102 has been flashed. + +Some familiarity with Zephyr and building / flashing Zephyr applications is assumed. If you are new to Zephyr, please start with the Getting Started Guide: +https://docs.zephyrproject.org/latest/develop/getting_started/index.html + +WiFi +---- +The wifi chip on the AD-APARD32690 is a uBlox NINA-W102 "Open CPU" Wifi/Bluetooth module. The modules is based on an ESP32 chip, with "Open CPU" meaning it does NOT come preloaded with firmware from uBlox, but rather is intended for customers to develop their own firmware to run on it. + +Details of the chip: https://www.u-blox.com/en/product/nina-w10-series-open-cpu + +Software must be developed using the ESP32 SDK: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html + +Core ESP32 Device: ESP32-D0WDQ6-V3 + + +Pre-Built Firmware for ESP NINA-W102 +------------------------------------ +ESP provides pre-built firmware for integrating Wifi and BLE through AT commands. This can be found here: https://www.espressif.com/en/products/sdks/esp-at/overview. There is also a Zephyr driver for this firmware to make it look like generic Wifi here: https://github.com/zephyrproject-rtos/zephyr/tree/main/drivers/wifi/esp_at and a block talking about using the AT Firmware with Zephyr for a specific ESP32 module: https://blog.golioth.io/esp32-esp-at-enables-connectivity-on-any-zephyr-project/. + +However, the pre-built firmware is for ESP32 development boards which have a different pin out than the NINA-W102. Instructions are provided (https://docs.espressif.com/projects/esp-at/en/latest/esp32/Compile_and_Develop/How_to_set_AT_port_pin.html) describing how to change the port pins for the firmware image. + + +Building NINA-W102 Firmware +--------------------------- + +Before proceeding, ensure that P50 and P55 on the APARD32690 board are in position 1-2 if you are trying to get the NINA-W102 UART data through the SWD connector. Be sure to switch this back later for testing the Zephyr application. + +The following instructions mostly come from this document: +https://docs.espressif.com/projects/esp-at/en/latest/esp32/Compile_and_Develop/How_to_clone_project_and_compile_it.html + +Install the ESP SDK: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/index.html + +Open the ESP-IDF Command Prompt and run the following steps: + +1. Get the project: git clone --recursive https://github.com/espressif/esp-at.git +2. Run the builder: python build.py install + * Select PLATFORM_ESP32 + * Select module ESP32-D2WD as it has the same flash size as the NINA-W102, making it easier to configure + * When asked about silent mode, select Y. Otherwise, if silent mode is not enable, you'll need to set the compiler options later to Optimize for Size to get it to fit +3. Edit the components/customized_partitions/raw_data/factory_param_data.csv file so the D2WD line reads the following: + * PLATFORM_ESP32,ESP32-D2WD,"2MB flash, No OTA",4,78,0,1,13,CN,115200,1,3,-1,-1 +4. Build the project by running python build.py build +5. The complete firmware image is located in build\factory\factory_ESP32-.bin and can be archived for later loading of devices. + + +Programming the NINA-W102 on AD-APARD32690 +------------------------------------------ +A USB-UART adapter will be needed. A good one can be found here if needed: +https://ftdichip.com/products/ttl-232r-3v3/ + +1. Connect a USB-UART adapter to the NINA-W102 through P38-2 and P56-2, and a ground on P2 or P5 +2. Prior to powering up the board, pull the ESP32 SYS_BOOT pin low, but connecting P47 to ground +3. Power up the board. You can verify the bootloader started correctly by observing the USB-UART adapter in a terminal. There should be text similar to the following: + + .. code-block:: text + + rst:0x1 (POWERON_RESET),boot:0x23 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2)) + waiting for download + +4. From the ESP command line, run :code:`python build.py -p flash`. The flash operation should be performed +Depending on the integrity of the cables (bad jumper wires, etc), you may be have to add the -b 115200 forced slower baud rate for data integrity. + + +Standalone Programming +---------------------- +The NINA-W102 device may be flashed using the stand alone ESP Flash download tool without needing to install the full SDK. + +Follow the instructions in the previous section up through step 3, then consult the ESP-AT Downloading guide for using the Flash Download Tool on Windows. Selecting the combined factory firmware image, as described above. +https://docs.espressif.com/projects/esp-at/en/latest/esp32/Get_Started/Downloading_guide.html#flash-at-firmware-into-your-device + +AT Command Verification +----------------------- +The AT command set can be found here: https://docs.espressif.com/projects/esp-at/en/latest/esp32/AT_Command_Set/index.html. Some basic AT commands can be done to verify the part is programmed correctly: + +.. code-block:: + + AT + + OK + AT+GMR + AT version:4.1.0.0-dev(eb730f6 - ESP32 - Jan 3 2024 08:18:49) + SDK version:v5.0.4-dirty + compile time(899230b2):Jan 14 2024 17:16:03 + Bin version:v3.2.0.0(ESP32-D2WD) + + OK + AT+CWINIT=1 + + OK + AT+CWMODE=1 + + OK + AT+CWLAP + +CWLAP:(3,"MySSID",-74,"94:a6:7e:e3:b8:38",10,-1,-1,4,4,7,1) + OK + +Finished code block + +Integrating Into Zephyr +----------------------- + +Create files in your Zephyr workspace called `apard_wifi.conf` and `apard_wifi.overlay`. + +Next, place the text below in these files: + +apard_wifi.overlay +++++++++++++++++++ +.. code-block:: dts + :name: apard_wifi.overlay + + &uart2 { + pinctrl-0 = <&uart2a_tx_p1_10 &uart2a_rx_p1_9>; + pinctrl-names = "default"; + current-speed = <115200>; + status = "okay"; + + esp_wifi: esp-wifi { + compatible = "espressif,esp-at"; + status = "okay"; + }; + }; + + / { + aliases { + wifi0 = &esp_wifi; + }; + }; + +apard_wifi.conf ++++++++++++++++ +.. code-block:: text + :name: apard_wifi.conf + + # Enable WiFi via ESP-AT + CONFIG_WIFI=y + CONFIG_WIFI_ESP_AT=y + CONFIG_WIFI_ESP_AT_MDM_RX_BUF_COUNT=40 + + # Disable NET_L2_ETHERNET to avoid T1L PHY errors + # when not using T1L, but enabling net-if + CONFIG_NET_L2_ETHERNET=n + + # Increment max IPV4 count if using multiple net-if interfaces + CONFIG_NET_IF_MAX_IPV4_COUNT=2 + +Build your application as below: + +.. code-block:: bash + + west build -p auto -b apard32690//m4 zephyr/samples/net/wifi/shell -- -DDTC_OVERLAY_FILE=$PWD/apard_wifi.overlay -DEXTRA_CONF_FILE=$PWD/apard_wifi.conf + +Flash the application using a Segger JLink as below: + +.. code-block:: bash + + west flash -r jlink + +At this point, make sure that P55 and P50 on the APARD32690 board are in positions 2-3 to get UART data from the MAX32690. + +Testing +------- + +At this point, make sure that P55 and P50 on the APARD32690 board are in positions 2-3 to get UART data from the MAX32690. Connect to a terminal application with 115200 baud, 8-N-1 UART settings. Make sure that P56 and P38 are also connected. +The Zephyr Wifi sample application comes with a Wifi shell for doing basic Wifi interactions. After launching the scan, and connect commands were used to successfully connect to an AP via the Zephyr network subsystem. + +Verify the devices installed with `device list`: + +.. code-block:: + + *** Booting Zephyr OS build zephyr-v3.5.0-4086-g0a8d03b95f84 *** + uart:~$ device list + devices: + - rcc@40021000 (READY) + - reset-controller (READY) + - interrupt-controller@40010400 (READY) + - gpio@48001800 (READY) + - gpio@48001400 (READY) + - gpio@48001000 (READY) + - gpio@48000c00 (READY) + - gpio@48000800 (READY) + - gpio@48000400 (READY) + - gpio@48000000 (READY) + - rng@50060800 (READY) + - serial@40008000 (READY) + - serial@40013800 (READY) + - esp-wifi (READY) + uart:~$ + +Request a wifi scan with wifi scan: + +.. code-block:: + + uart:~$ wifi scan + Scan requested + + Num | SSID (len) | Chan (Band) | RSSI | Security | BSSID | MFP + 1 | MySSID 9 | 10 (2.4GHz) | -70 | WPA2-PSK | | Disable + Scan request done + +Connect to a Wifi Access Point with `wifi connect`. Note PSK was omitted in the following terminal log: + +.. code-block:: + + uart:~$ wifi connect "MySSID" 1 ****PSK HERE**** + Connection requested + Connected + +Get status information with `wifi status`: + +.. code-block:: + + uart:~$ wifi status + Status: successful + ================== + State: COMPLETED + Interface Mode: STATION + Link Mode: UNKNOWN + SSID: MySSID + BSSID: <__:__:__:__:__:__> + Band: 2.4GHz + Channel: 10 + Security: UNKNOWN + MFP: UNKNOWN + RSSI: -69 + Beacon Interval: 0 + DTIM: 0 + TWT: Not supported + uart:~$