Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Inventek es-WIFI serial bus and shield #29507

Merged
merged 5 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
/boards/shields/ @erwango
/boards/shields/atmel_rf2xx/ @nandojve
/boards/shields/esp_8266/ @nandojve
/boards/shields/inventek_eswifi/ @nandojve
/boards/x86/ @andrewboie @nashif @jenmwms @aasthagr
/boards/xtensa/ @nashif @dcpleung
/boards/xtensa/intel_s1000_crb/ @sathishkuttan @dcpleung
Expand Down Expand Up @@ -285,7 +286,7 @@
/drivers/watchdog/*gecko* @oanerer
/drivers/watchdog/wdt_handlers.c @andrewboie
/drivers/wifi/ @jukkar @tbursztyka @pfalcon
/drivers/wifi/eswifi/ @loicpoulain
/drivers/wifi/eswifi/ @loicpoulain @nandojve
/drivers/wifi/winc1500/ @kludentwo
/dts/arc/ @abrodkin @ruuddw @iriszzw
/dts/arm/atmel/sam4e* @nandojve
Expand Down
26 changes: 26 additions & 0 deletions boards/shields/inventek_eswifi/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (c) 2020 ATL Electronics
# SPDX-License-Identifier: Apache-2.0

if SHIELD_INVENTEK_ESWIFI || \
SHIELD_INVENTEK_ESWIFI_ARDUINO_SPI || \
SHIELD_INVENTEK_ESWIFI_ARDUINO_UART

if NETWORKING

config WIFI_ESWIFI
default y
depends on WIFI

orsource "boards/*.defconfig"

choice WIFI_ESWIFI_BUS
default WIFI_ESWIFI_BUS_SPI if SHIELD_INVENTEK_ESWIFI_ARDUINO_SPI
default WIFI_ESWIFI_BUS_UART if SHIELD_INVENTEK_ESWIFI_ARDUINO_UART
depends on WIFI_ESWIFI
endchoice

endif # NETWORKING

endif # SHIELD_INVENTEK_ESWIFI || \
# SHIELD_INVENTEK_ESWIFI_ARDUINO_SPI || \
# SHIELD_INVENTEK_ESWIFI_ARDUINO_UART
11 changes: 11 additions & 0 deletions boards/shields/inventek_eswifi/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2020 ATL Electronics
# SPDX-License-Identifier: Apache-2.0

config SHIELD_INVENTEK_ESWIFI
def_bool $(shields_list_contains,inventek_eswifi)

config SHIELD_INVENTEK_ESWIFI_ARDUINO_SPI
def_bool $(shields_list_contains,inventek_eswifi_arduino_spi)

config SHIELD_INVENTEK_ESWIFI_ARDUINO_UART
def_bool $(shields_list_contains,inventek_eswifi_arduino_uart)
11 changes: 11 additions & 0 deletions boards/shields/inventek_eswifi/boards/frdm_k64f.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Copyright (c) 2020 ATL Electronics
#
# SPDX-License-Identifier: Apache-2.0

if BOARD_FRDM_K64F

config NET_L2_ETHERNET
default n

endif # BOARD_FRDM_K64F
11 changes: 11 additions & 0 deletions boards/shields/inventek_eswifi/boards/nucleo_f767zi.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Copyright (c) 2020 ATL Electronics
#
# SPDX-License-Identifier: Apache-2.0

if BOARD_NUCLEO_F767ZI

config NET_L2_ETHERNET
default n

endif # BOARD_NUCLEO_F767ZI
196 changes: 196 additions & 0 deletions boards/shields/inventek_eswifi/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
.. _inventek_eswifi_shield:

Inventek es-WIFI Shield
#######################

Overview
********

The es-WIFI (embedded Serial-to-WiFi) modules are devices developed by Inventek
Systems. It integrates WIFI and optionaly Bluetooth Low Energy. The es-WIFI
devices can run Cypress WICED or Inventek's IWIN (Inventek Systems Wireless
Interoperability Network) AT commands set. The current es-WIFI driver is able
to use one of two serial interfaces: SPI or UART.

The Zephyr es-WIFI drivers was implemented using ISM43362-M3G-L44 with SPI
interface. The UART was implemented with ISM4343-WBM-L151. Besides that,
user can reprogram the modules to switch from one interface type to another
by the JTAG pin header.


ISMART4343C-EVB
===============

The `ISMART4343C-EVB`_ is a development Kit with Arduino Uno R3 compatible
shield. It allows evaluate es-WIFI modules with SPI or UART interface. For
UART interface the `inventek_eswifi_arduino_uart`_ must be selected. For
SPI interface the `inventek_eswifi_arduino_spi`_ must be enabled. The EVB
can use 5V from Arduino header, if board provide it, J17 position 1-2.
Otherwise, J17 2-3 will select USB-5V. More information can be found at
`ISMART4343C-EVB Users Manual`_.

.. note::
The Inventek's EVBs signals are 3.3V only.

.. image:: ./ismart4343c-evb.jpg
:width: 350px
:align: center
:alt: ISMART4343C-EVB

Pins Assignment of the ISMART EVBs
==================================

The below table presents signals by interface. The UART switch SW3 must be on
position 3 to enable RX/TX signals when using es-WIFI with UART firmware.

To enable full control by Arduino header user should do some manual wiring.
The signals from D3 up to D7 are not connected by default on the Inventek's
shield. These signals marked as optional can help on development. The current
driver do not handle that signals and are simple suggestions and can be left
as is. Some arduino boards don't have NRST pin connected to a GPIO pin. The
recomendation is bend the NRST pin and make a wire to D6. WAKE-UP signal is
available at header J26 pin 1 and shield configuration uses D7 to control that
signal, user need do a wire connecting these two terminals. On the below
image is possible see suggested wiring connections.

.. image:: ./ismart4343c-evb-wiring.jpg
:width: 800px
:align: center
:alt: ISMART4343C-EVB Wiring

+-----------------------+-----------+---------------------+
| Arduino Connector Pin | Function | Serial Connection |
+=======================+===========+=====================+
| D0 | UART RX | UART |
+-----------------------+-----------+---------------------+
| D1 | UART TX | UART |
+-----------------------+-----------+---------------------+
| D3 | CFG-1 | UART/SPI [optional] |
+-----------------------+-----------+---------------------+
| D4 | CFG-0 | UART/SPI [optional] |
+-----------------------+-----------+---------------------+
| D5 | BOOT-0 | UART/SPI [optional] |
+-----------------------+-----------+---------------------+
| D6 | NRST | UART/SPI [wiring] |
+-----------------------+-----------+---------------------+
| D7 | WAKE-UP | UART/SPI [wiring] |
+-----------------------+-----------+---------------------+
| D9 | CMD/RDY | SPI |
+-----------------------+-----------+---------------------+
| D10 | SPI CS | SPI |
+-----------------------+-----------+---------------------+
| D11 | SPI MOSI | SPI |
+-----------------------+-----------+---------------------+
| D12 | SPI MISO | SPI |
+-----------------------+-----------+---------------------+
| D13 | SPI SCK | SPI |
+-----------------------+-----------+---------------------+


Supported variations
====================

The below table suggests shield variation accordingly with end user
application. When a standard Arduino R3 connector is available on board, user
should select the matching shield configuration based on the serial interface
(SERIAL or SPI). The inventek_eswifi is available to allow users testing a
built-in module with dedicated <board>.overlay and <board>.defconfig files.

+-----------------------------+---------------------------------+-----------+
| Connector Standard | Shield Designation | Variation |
+=============================+=================================+===========+
| Without standard (overlay) | `inventek_eswifi`_ | 1 |
+-----------------------------+---------------------------------+-----------+
| Arduino by UART | `inventek_eswifi_arduino_uart`_ | 2 |
+-----------------------------+---------------------------------+-----------+
| Arduino by SPI | `inventek_eswifi_arduino_spi`_ | 3 |
+-----------------------------+---------------------------------+-----------+

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

This shield requires a board which provides a configuration that allows an
UART or SPI interface and two or three GPIO. (see :ref:`shields` for more
details).

.. note::
Some boards may already have a network interface: Check network
documentation to understand how properly configure both interfaces.
To keep simple, you can keep only the WIFI interface enabled at
Networking -> Link Layer Options. This will avoid problems running
Zephyr samples.

Tested Boards
=============

+-----------------------------+------------------------------+-----------+
| Board | Disabled Interface | Variation |
+=============================+==============================+===========+
| ATMEL sam_v71_xult | Ethernet | 2 , 3 |
+-----------------------------+------------------------------+-----------+
| ST nucleo_f767zi | Ethernet | 2 , 3 |
+-----------------------------+------------------------------+-----------+
| ST disco_l475_iot1 | | - |
+-----------------------------+------------------------------+-----------+

.. note::
ST disco_l475_iot1 already have an ISM43362 module with IWIN SPI
firmware. It doesn't need this shield to expose es-WIFI. It is only
used here as reference to demonstrate how configure an on-board
module.

Sample usage
************

The reference sample for WIFI is :ref:`wifi_sample`. It allows you use WIFI
shell to scan local Wireless networks. With the password you can pick,
connect and send ping.

Build and Programming
*********************

Set ``-DSHIELD=<shield designator>`` when you invoke ``west build``.

.. zephyr-app-commands::
:zephyr-app: samples/net/wifi
:host-os: unix
:board: [sam_v71_xult | nucleo_f767zi]
:shield: inventek_eswifi_arduino_uart
:goals: build flash
:compact:

.. zephyr-app-commands::
:zephyr-app: samples/net/wifi
:host-os: unix
:board: [sam_v71_xult | nucleo_f767zi]
:shield: inventek_eswifi_arduino_spi
:goals: build flash
:compact:

.. zephyr-app-commands::
:zephyr-app: samples/net/wifi
:host-os: unix
:board: disco_l475_iot1
:goals: build flash
:compact:


References
**********

.. target-notes::

.. _ISMART4343C-EVB:
https://www.inventeksys.com/ismart4343-c-arduino-shield-wi-fi-2ghz-bluetooth-ble/

.. _ISMART4343C-EVB Users Manual:
https://www.inventeksys.com/wp-content/uploads/IoT-EVB-Users-Manual.pdf

.. _inventek_eswifi:
https://github.com/zephyrproject-rtos/zephyr/blob/master/boards/shields/inventek_eswifi/inventek_eswifi.overlay

.. _inventek_eswifi_arduino_uart:
https://github.com/zephyrproject-rtos/zephyr/blob/master/boards/shields/inventek_eswifi/inventek_eswifi_arduino_uart.overlay

.. _inventek_eswifi_arduino_spi:
https://github.com/zephyrproject-rtos/zephyr/blob/master/boards/shields/inventek_eswifi/inventek_eswifi_arduino_spi.overlay
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions boards/shields/inventek_eswifi/inventek_eswifi.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright (c) 2020 ATL Electronics
*
* SPDX-License-Identifier: Apache-2.0
*/

/*
* This file is intentionally empty. Please refer to shield documentation for
* instructions how to use this shield.
*/
30 changes: 30 additions & 0 deletions boards/shields/inventek_eswifi/inventek_eswifi_arduino_spi.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2020 ATL Electronics
*
* SPDX-License-Identifier: Apache-2.0
*/

&arduino_spi {
status = "okay";

/* D10 */
cs-gpios = <&arduino_header 16 GPIO_ACTIVE_LOW>;

wifi0: iwin@0 {
status = "okay";
compatible = "inventek,eswifi";
spi-max-frequency = <2000000>;
reg = <0>;

/* D9 */
data-gpios = <&arduino_header 15 GPIO_ACTIVE_HIGH>;
/* D7 */
wakeup-gpios = <&arduino_header 13 GPIO_ACTIVE_HIGH>;
/* D6 */
resetn-gpios = <&arduino_header 12 GPIO_ACTIVE_HIGH>;
/* D5 */
boot0-gpios = <&arduino_header 11 GPIO_ACTIVE_HIGH>;

label = "ESWIFI0";
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2020 ATL Electronics
*
* SPDX-License-Identifier: Apache-2.0
*/

&arduino_serial {
status = "okay";

wifi0: iwin {
status = "okay";
compatible = "inventek,eswifi-uart";

/* D7 */
wakeup-gpios = <&arduino_header 13 GPIO_ACTIVE_HIGH>;
/* D6 */
resetn-gpios = <&arduino_header 12 GPIO_ACTIVE_HIGH>;

label = "ESWIFI0";
};
};
4 changes: 3 additions & 1 deletion drivers/wifi/eswifi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ if(CONFIG_WIFI_ESWIFI)

zephyr_sources(
eswifi_core.c
eswifi_bus_spi.c
eswifi_offload.c
eswifi_socket.c
)

zephyr_sources_ifdef(CONFIG_WIFI_ESWIFI_BUS_SPI eswifi_bus_spi.c)
zephyr_sources_ifdef(CONFIG_WIFI_ESWIFI_BUS_UART eswifi_bus_uart.c)

zephyr_sources_ifdef(CONFIG_WIFI_ESWIFI_SHELL eswifi_shell.c)

zephyr_sources_ifdef(CONFIG_NET_SOCKETS_OFFLOAD eswifi_socket_offload.c)
Expand Down
17 changes: 14 additions & 3 deletions drivers/wifi/eswifi/Kconfig.eswifi
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,23 @@ menuconfig WIFI_ESWIFI
select NET_OFFLOAD
select NET_SOCKETS
select NET_SOCKETS_OFFLOAD
select GPIO

if WIFI_ESWIFI

config WIFI_ESWIFI_NAME
string "Driver name"
default "ESWIFI"
choice WIFI_ESWIFI_BUS
bool "Select BUS interface"
default WIFI_ESWIFI_BUS_SPI

config WIFI_ESWIFI_BUS_SPI
bool "SPI Bus interface"
select SPI

config WIFI_ESWIFI_BUS_UART
bool "UART Bus interface"
select SERIAL

endchoice

config WIFI_ESWIFI_THREAD_PRIO
int "esWiFi threads priority"
Expand Down
2 changes: 1 addition & 1 deletion drivers/wifi/eswifi/eswifi.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ struct eswifi_dev *eswifi_socket_to_dev(struct eswifi_off_socket *socket)
return CONTAINER_OF(socket - socket->index, struct eswifi_dev, socket);
}

extern struct eswifi_bus_ops eswifi_bus_ops_spi;
struct eswifi_bus_ops *eswifi_get_bus(void);
int eswifi_offload_init(struct eswifi_dev *eswifi);
struct eswifi_dev *eswifi_by_iface_idx(uint8_t iface);
int eswifi_at_cmd_rsp(struct eswifi_dev *eswifi, char *cmd, char **rsp);
Expand Down
Loading