.. _nxp_m2_wifi_bt:

NXP M.2 Wi-Fi and BT Shield
###########################

Overview
********

This Zephyr shield is tested with the following M.2 modules and hardware for Wi-Fi and Bluetooth applications:

- Embedded Artist 1XK module - uses Murata 1XK radio module with NXP IW416 chipset
- Embedded Artist 2EL module - uses Murata 2EL radio module with NXP IW612 chipset
- Embedded Artist 2LL module - uses Murata 2LL radio module with NXP IW610 chipset

More information about supported chipsets, radio modules and M.2 modules can be found in below links,

- `IW612 NXP Chipset <https://www.nxp.com/products/IW612>`_
- `IW416 NXP Chipset <https://www.nxp.com/products/IW416>`_
- `IW610 NXP Chipset <https://www.nxp.com/products/IW610>`_
- `2EL Murata Radio Module <https://www.murata.com/en-us/products/connectivitymodule/wi-fi-bluetooth/overview/lineup/type2el>`_
- `1XK Murata Radio Module  <https://www.murata.com/en-us/products/connectivitymodule/wi-fi-bluetooth/overview/lineup/type1xk>`_
- `2LL Murata Radio Module <https://www.murata.com/en-us/products/connectivitymodule/wi-fi-bluetooth/overview/lineup/type2ll>`_
- `1XK Embedded Artist Module <https://www.embeddedartists.com/products/1xk-m-2-module>`_
- `2EL Embedded Artist Module <https://www.embeddedartists.com/products/2el-m-2-module>`_
- `2LL Embedded Artist Module <https://www.embeddedartists.com/products/2ll-m-2-module>`_

Requirements
************

To use the shield, below requirements needs to be satisfied.

- M.2 module with BT HCI UART and SDIO Interface with NXP IW416 or IW612 or IW610 SoC support.
- Host platform shall have compatible M.2 interface slot.
- For Coex (Wi-Fi + BT), UART driver that supports UART RTS line control to wakeup BT CPU from sleep.
- To use default Bluetooth-Shell app it needs ~490KB flash & ~130KB RAM memory.
- To use default Wi-Fi-Shell app it needs ~1MB flash & ~1.2MB RAM memory.

Integration Platform
********************

This shield is validated and tested for use with the host platform listed below.
While the shield can be used with other host platforms, other combinations
are not actively tested or validated.

- :zephyr:board:`mimxrt1060_evk` Rev-C.

Fetch Binary Blobs
******************

To support Bluetooth or Wi-Fi, nxp_m2_wifi_bt requires fetching binary blobs,
using the following command:

.. code-block:: console

   west blobs fetch hal_nxp

Programming
***********

Below are the supported shields to be used with ``--shield <option>`` when you invoke
``west build``.

- ``nxp_m2_1xk_wifi_bt``: For Wi-Fi/Bluetooth samples to work with NXP IW416 SoC
- ``nxp_m2_2el_wifi_bt``: For Wi-Fi/Bluetooth samples to work with NXP IW612 SoC
- ``nxp_m2_2ll_wifi_bt``: For Wi-Fi/Bluetooth samples to work with NXP IW610 SoC

For example:

BT:

.. zephyr-app-commands::
   :zephyr-app: samples/bluetooth/classic/handsfree
   :board: mimxrt1060_evk@C//qspi
   :shield: nxp_m2_1xk_wifi_bt
   :goals: build

Wi-Fi Embedded supplicant:

.. zephyr-app-commands::
   :zephyr-app: samples/net/wifi/shell
   :board: mimxrt1060_evk@C//qspi
   :shield: nxp_m2_2ll_wifi_bt
   :goals: build
   :gen-args: -DEXTRA_CONF_FILE="nxp/overlay_hosted_mcu.conf"

Wi-Fi HostAP/WPA supplicant:

.. zephyr-app-commands::
   :zephyr-app: samples/net/wifi/shell
   :board: mimxrt1060_evk@C//qspi
   :shield: nxp_m2_2el_wifi_bt
   :goals: build
   :gen-args: -DEXTRA_CONF_FILE="nxp/overlay_hosted_mcu.conf;nxp/overlay_hostap_hosted_mcu.conf"

.. note::
   To build Wi-Fi application, ``nxp/overlay_hosted_mcu.conf`` config file
   must be passed along with default conf file as mentioned in above build command.

   To enable HostAP/WPA supplicant support, additional "nxp/overlay_hostap_hosted_mcu.conf" file
   needs to be passed.
   In above mentioned commands, shield parameter can be modified with respect to module selection.

Hardware Rework to Enable M.2 Interfaces
****************************************

Rework for MIMXRT1060EVK Rev-C
==============================

Bluetooth HCI UART
------------------

- Mount R93, R96.
- Remove R193.
- Connect J109, connect J76 2-3.

I2S For BT SCO
--------------

- Remove J54 and J55, connect J56, and J57.
- Remove R220.
- Connect J103.

.. note::
   When J103 is connected, flash cannot be downloaded. So, remove the connection when downloading flash
   and reconnect it after downloading.

.. figure:: mimxrt1060evkc_m2_bt_rework.webp
   :align: center
   :alt: MIMXRT1060EVK Rev-C BT Rework for M.2

   MIMXRT1060EVK Rev-C BT Rework for M.2 Modules
