1.. _mikroe_wifi_bt_click:
2
3MikroElektronika WIFI and BLE Shield
4####################################
5
6Overview
7********
8
9This shield contains an Espressif Systems ESP32 which is responsible
10to offload the WIFI and Bluetooth tasks from the host processor. It uses
11the standard MikroBus interface with UART pins plus its Espressif AT
12command set. Alternatively, the Zephyr modem driver can be used,
13configuring the module as a native WIFI networking interface.
14
15.. image:: wifi_click.jpg
16   :align: center
17   :alt: MikroE WIFI BLE Click
18
19Pins Assignment of the Shield
20=============================
21
22+-----------------------+---------------------------------------------+
23| Shield Connector Pin  | Function                                    |
24+=======================+=============================================+
25| RST#                  | Reset pin, in most of the boards it should  |
26|                       | be disconnected because its tied to GND     |
27+-----------------------+---------------------------------------------+
28| TX                    | UART TX communication pin                   |
29+-----------------------+---------------------------------------------+
30| RX                    | UART RX communication pin                   |
31+-----------------------+---------------------------------------------+
32
33Requirements
34************
35
36This shield requires a board which provides a configuration that allows an
37UART interface. (see :ref:`shields` for more details).
38
39.. note::
40   Sometimes boards declare standard headers like Arduino R3 but don't
41   define all connections.  Make sure that the board you are using includes
42   all required definitions to avoid build errors.
43
44This shield should be loaded with the `ESP32 AT Bin`_ software which is
45available at Espressif Systems web site. This version is command
46compatible with ESP32 AT Bin 2.0.0, after getting the binary from Espressif
47site, connect the J1 of the board to a serial-to-USB converter of your
48preference, or to one Espressif programming boards like ESP-Prog. Install
49the `ESP-Tool`_, extract the folder, navigate inside the binaries location
50and type the following command to flash the device:
51
52.. code-block:: console
53
54   esptool.py --chip auto \
55   --before default_reset \
56   --after hard_reset write_flash \
57   --flash_mode dio \
58   --flash_freq 40m \
59   --flash_size detect \
60   0x10000 ota_data_initial.bin \
61   0x1000 bootloader/bootloader.bin \
62   0x20000 at_customize.bin \
63   0x21000 customized_partitions/ble_data.bin \
64   0x24000 customized_partitions/server_cert.bin \
65   0x26000 customized_partitions/server_key.bin \
66   0x28000 customized_partitions/server_ca.bin \
67   0x2a000 customized_partitions/client_cert.bin \
68   0x2c000 customized_partitions/client_key.bin \
69   0x2e000 customized_partitions/client_ca.bin \
70   0x30000 customized_partitions/factory_param.bin \
71   0xf000 phy_init_data.bin \
72   0x100000 esp-at.bin \
73   0x8000 partitions_at.bin
74
75If necessary, you can indicate a specific port and the baud rate via
76``--port <Selected PORT>`` and ``--baud 115200``.
77
78Once flashed, it is possible to verify the module. While connected, open your preferred
79terminal configured as 115200, 8, N, 1 and perform a board reset. You should see an
80initial log and last message should be the version of the AT firmware flashed.
81
82.. note::
83   Boards that already have a network interface:  Check the network
84   documentation to understand how to properly configure both interfaces.
85   To keep things simple, make sure WiFi is the only interface enabled in
86   Networking -> Link Layer Options.  This will avoid problems running
87   Zephyr samples.
88
89Build and Programming
90*********************
91
92Set ``--shield <shield designation>`` when you invoke ``west build``.
93
94See the example below for lpcxpresso55s69 board using Mikrobus serial:
95
96.. zephyr-app-commands::
97   :zephyr-app: samples/net/wifi
98   :board: lpcxpresso55s69/lpc55s69/cpu0
99   :shield: mikroe_wifi_bt_click_mikrobus
100   :goals: build flash
101
102And this example for the b_u585i_iot02a development kit, using the Arduino connector for the UART pins:
103
104.. zephyr-app-commands::
105   :zephyr-app: samples/net/wifi
106   :board: b_u585i_iot02a
107   :shield: mikroe_wifi_bt_click_arduino
108   :goals: build flash
109
110References
111**********
112
113.. target-notes::
114
115.. _ESP32 AT Bin:
116   https://docs.espressif.com/projects/esp-at/en/latest/esp32/AT_Binary_Lists/ESP32_AT_binaries.html
117
118.. _WIFI BT Click Shield website:
119   https://www.mikroe.com/
120
121.. _ESP-Tool:
122   https://github.com/espressif/esptool
123