ninaw152  2.1.0.0
Main Page

NINA-W152 Click

NINA-W152 Click is a compact add-on board designed for seamless integration of Wi-Fi and Bluetooth communication into your projects. Based on the NINA-W152 multi-radio module from u-blox, this Click boardâ„¢ provides dual-mode wireless connectivity, including Wi-Fi 802.11b/g/n and Bluetooth BR/EDR v4.2+EDR and Bluetooth Low Energy v4.2. It features an internal PIFA antenna for optimal performance and supports communication through UART and SPI interfaces, with secure boot and enterprise-level security protocols (WPA2/WPA3) ensuring reliable operation.

Click Product page


Click library

  • Author : Stefan Filipovic
  • Date : Mar 2024.
  • Type : UART/SPI type

Software Support

We provide a library for the NINA-W152 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 from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for NINA-W152 Click driver.

Standard key functions :

Example key functions :

Example Description

Application example shows device capability of connecting to a WiFi network and

sending TCP/UDP messages to an echo server, or processing data from a connected BT device.

The demo application is composed of two sections :

Application Init

Initializes the driver and logger.

void application_init ( void )
{
log_cfg_t log_cfg;
ninaw152_cfg_t ninaw152_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
ninaw152_cfg_setup( &ninaw152_cfg );
NINAW152_MAP_MIKROBUS( ninaw152_cfg, MIKROBUS_1 );
if ( NINAW152_OK != ninaw152_init( &ninaw152, &ninaw152_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
app_state = NINAW152_POWER_UP;
log_printf( &logger, ">>> APP STATE - POWER UP <<<\r\n\n" );
}

Application Task

Application task is split in few stages:

  • NINAW152_POWER_UP:

    Powers up the device, performs a factory reset and reads system information.

  • NINAW152_CONFIGURE_CONNECTION:

    Configures connection to WiFi or BT depending on the selected example.

  • NINAW152_WAIT_FOR_CONNECTION:

    Checks the connection to WiFi access point.

  • NINAW152_EXAMPLE:

    Depending on the selected demo example, it sends a TCP/UDP message to an echo server over a WiFi network or processes all data from a connected BT device and sends back an adequate response message.

By default, the WiFi TCP/UDP example is selected.

void application_task ( void )
{
switch ( app_state )
{
{
if ( NINAW152_OK == ninaw152_power_up( &ninaw152 ) )
{
log_printf( &logger, ">>> APP STATE - CONFIGURE CONNECTION <<<\r\n\n" );
}
break;
}
{
if ( NINAW152_OK == ninaw152_config_connection( &ninaw152 ) )
{
log_printf( &logger, ">>> APP STATE - CHECK CONNECTION <<<\r\n\n" );
}
break;
}
{
if ( NINAW152_OK == ninaw152_check_connection( &ninaw152 ) )
{
app_state = NINAW152_EXAMPLE;
log_printf( &logger, ">>> APP STATE - EXAMPLE <<<\r\n\n" );
}
break;
}
{
ninaw152_example( &ninaw152 );
break;
}
default:
{
log_error( &logger, " APP STATE." );
break;
}
}
}

Note

For the BT example, we have used the Serial Bluetooth Terminal smartphone application for the test. A smartphone and the Click board must be paired to exchange messages.

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.NINAW152

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. UART terminal is available in all MikroElektronika compilers.


NINAW152_OK
@ NINAW152_OK
Definition: ninaw152.h:249
NINAW152_WAIT_FOR_CONNECTION
@ NINAW152_WAIT_FOR_CONNECTION
Definition: main.c:81
NINAW152_POWER_UP
@ NINAW152_POWER_UP
Definition: main.c:79
ninaw152_init
err_t ninaw152_init(ninaw152_t *ctx, ninaw152_cfg_t *cfg)
NINA-W152 initialization function.
ninaw152_cfg_t
NINA-W152 Click configuration object.
Definition: ninaw152.h:213
ninaw152_t
NINA-W152 Click context object.
Definition: ninaw152.h:185
application_task
void application_task(void)
Definition: main.c:215
ninaw152_send_cmd
void ninaw152_send_cmd(ninaw152_t *ctx, uint8_t *cmd)
NINA-W152 send command function.
NINAW152_EXAMPLE
@ NINAW152_EXAMPLE
Definition: main.c:82
NINAW152_MAP_MIKROBUS
#define NINAW152_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: ninaw152.h:154
ninaw152_send_cmd_with_par
void ninaw152_send_cmd_with_par(ninaw152_t *ctx, uint8_t *at_cmd_buf, uint8_t *param_buf)
NINA-W152 send command with parameter function.
ninaw152_reset_device
void ninaw152_reset_device(ninaw152_t *ctx)
NINA-W152 reset device function.
application_init
void application_init(void)
Definition: main.c:182
NINAW152_CONFIGURE_CONNECTION
@ NINAW152_CONFIGURE_CONNECTION
Definition: main.c:80
ninaw152_cfg_setup
void ninaw152_cfg_setup(ninaw152_cfg_t *cfg)
NINA-W152 configuration object setup function.