wifi11  2.0.0.0
Main Page

WiFi 11 Click

WiFi 11 Click is a compact add-on board that contains a WiFi and Bluetooth module that has dual bands for WiFi communication. This board features the BW16, a low-power dual bands Wireless LAN (WLAN) and Bluetooth Low Energy SoC module from Ai-Thinker.

Click Product page


Click library

  • Author : MikroE Team
  • Date : Sep 2020.
  • Type : UART type

Software Support

We provide a library for the Wifi11 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for Wifi11 Click driver.

Standard key functions :

  • Config Object Initialization function.

    void wifi11_cfg_setup ( wifi11_cfg_t *cfg );

  • Initialization function.

    WIFI11_RETVAL wifi11_init ( wifi11_t *ctx, wifi11_cfg_t *cfg );

  • Device reset function.

    void wifi11_reset_device ( wifi11_t *ctx );

Example key functions :

  • Send command function.

    void wifi11_send_cmd ( wifi11_t *ctx, char *cmd );

  • Create TCP/UDP server function.

    void wifi11_create_tcp_udp_server ( wifi11_t *ctx, uint8_t mode, uint16_t port );

  • Connect to AP function.

    void wifi11_connect_to_ap ( wifi11_t *ctx, char *ssid, char *password );

Examples Description

This example reads and processes data from WiFi 11 clicks.

The demo application is composed of two sections :

Application Init

Initializes the driver and powers up the module, then connects to the desired AP and creates TCP and UDP servers on the desired local port.

void application_init ( void )
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
WIFI11_MAP_MIKROBUS( cfg, MIKROBUS_1 );
wifi11_init( &wifi11, &cfg );
Delay_ms ( 100 );
wifi11_reset_device( &wifi11 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
// dummy read
wifi11_process( );
wifi11_clear_app_buf( );
log_printf( &logger, "\r\n ---- Common commands ---- \r\n" );
Delay_ms ( 500 );
// Test AT command ready
app_error_flag = wifi11_rsp_check( );
wifi11_error_check( app_error_flag );
Delay_ms ( 500 );
// Query version info
app_error_flag = wifi11_rsp_check( );
wifi11_error_check( app_error_flag );
Delay_ms ( 500 );
log_printf( &logger, "\r\n ---- WiFi commands ---- \r\n" );
Delay_ms ( 500 );
// Set WiFi mode - Station
app_error_flag = wifi11_rsp_check( );
wifi11_error_check( app_error_flag );
Delay_ms ( 500 );
// Connect to AP
app_error_flag = wifi11_rsp_check( );
wifi11_error_check( app_error_flag );
Delay_ms ( 500 );
// Wifi information
app_error_flag = wifi11_rsp_check( );
wifi11_error_check( app_error_flag );
Delay_ms ( 500 );
log_printf( &logger, "\r\n ---- TCP/IP commands ---- \r\n" );
Delay_ms ( 500 );
// Create TCP Server
app_error_flag = wifi11_rsp_check( );
wifi11_error_check( app_error_flag );
Delay_ms ( 500 );
// Create UDP Server
app_error_flag = wifi11_rsp_check( );
wifi11_error_check( app_error_flag );
Delay_ms ( 500 );
// Enable auto receive data mode
app_error_flag = wifi11_rsp_check( );
wifi11_error_check( app_error_flag );
Delay_ms ( 500 );
// Check network connection status
app_error_flag = wifi11_rsp_check( );
wifi11_error_check( app_error_flag );
Delay_ms ( 500 );
log_printf( &logger, "\r\n ---- Please connect to the TCP/UDP server listed above via" );
log_printf( &logger, " a TCP/UDP client ---- \r\n" );
}

Application Task

Logs all the received data and module's responses on the USB UART.

void application_task ( void )
{
wifi11_process( );
wifi11_log_app_buf( );
}

Note

In order for the example to work, user needs to set the AP SSID, password, and Local port on which the TCP and UDP servers will be created. Enter valid data for the following macros: AP_SSID, AP_PASSWORD and LOCAL_PORT.

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Wifi11

Additional notes and informations

Depending on the development board you are using, you may need USB UART Click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all Mikroelektronika compilers, or any other terminal application of your choice, can be used to read the message.


WIFI11_MAP_MIKROBUS
#define WIFI11_MAP_MIKROBUS(cfg, mikrobus)
Definition: wifi11.h:66
wifi11_send_cmd
void wifi11_send_cmd(wifi11_t *ctx, char *cmd)
Send command function.
WIFI11_CMD_ATSV
#define WIFI11_CMD_ATSV
Definition: wifi11.h:91
WIFI11_CMD_ATPK
#define WIFI11_CMD_ATPK
Definition: wifi11.h:130
wifi11_init
WIFI11_RETVAL wifi11_init(wifi11_t *ctx, wifi11_cfg_t *cfg)
Initialization function.
wifi11_cfg_t
Click configuration structure definition.
Definition: wifi11.h:183
wifi11_connect_to_ap
void wifi11_connect_to_ap(wifi11_t *ctx, char *ssid, char *password)
Connect to AP function.
WIFI11_CMD_AT
#define WIFI11_CMD_AT
Definition: wifi11.h:88
wifi11_cfg_setup
void wifi11_cfg_setup(wifi11_cfg_t *cfg)
Config Object Initialization function.
application_task
void application_task(void)
Definition: main.c:207
WIFI11_UDP_MODE
#define WIFI11_UDP_MODE
Definition: wifi11.h:142
LOCAL_PORT
#define LOCAL_PORT
Definition: main.c:49
WIFI11_CMD_ATPW
#define WIFI11_CMD_ATPW
Definition: wifi11.h:106
AP_SSID
#define AP_SSID
Definition: main.c:47
wifi11_reset_device
void wifi11_reset_device(wifi11_t *ctx)
Device reset function.
WIFI11_CMD_ATPI
#define WIFI11_CMD_ATPI
Definition: wifi11.h:131
AP_PASSWORD
#define AP_PASSWORD
Definition: main.c:48
application_init
void application_init(void)
Definition: main.c:107
wifi11_create_tcp_udp_server
void wifi11_create_tcp_udp_server(wifi11_t *ctx, uint8_t mode, uint16_t port)
Create TCP/UDP server function.
wifi11_send_cmd_with_parameter
void wifi11_send_cmd_with_parameter(wifi11_t *ctx, char *at_cmd_buf, char *param_buf)
Send command function with parameter.
WIFI11_CMD_ATW
#define WIFI11_CMD_ATW
Definition: wifi11.h:111
WIFI11_TCP_MODE
#define WIFI11_TCP_MODE
Definition: wifi11.h:141