Beginner
10 min

Provide the core wireless communication capabilities, WiFi 4 (802.11a/b/g/n) and v5.3 BLE with NORA-W36 and STM32F303VC

Dual-band WiFi module with Bluetooth LE for professional-grade applications

WiFi NORA Click with Discovery kit with STM32F303VC MCU

Published Sep 09, 2024

Click board™

WiFi NORA Click

Dev. board

Discovery kit with STM32F303VC MCU

Compiler

NECTO Studio

MCU

STM32F303VC

Boost your projects with dual-band WiFi and BLE connectivity for secure and reliable communication

A

A

Hardware Overview

How does it work?

WiFi NORA Click is based on the NORA-W366-00B6-00B, a dual-band WiFi and Bluetooth Low Energy (BLE) module from u-blox, based on a Realtek RTL8720DF chip designed to enhance wireless connectivity in professional-grade applications. This module supports WiFi 4 (802.11a/b/g/n) in both 2.4 and 5GHz bands, enabling it to function as either a WiFi station or an access point. Additionally, it offers Bluetooth v5.3 capabilities, allowing it to operate as a peripheral, central, or both, with the flexibility to act as a GATT client or server. Designed for a wide range of applications, WiFi NORA Click is ideal for industrial automation, smart buildings and homes, smart cities, metering and utilities, healthcare, and EV charging. The module comes globally certified and equipped with an internal PCB antenna that delivers high performance and an extensive range. Pre-flashed with u-connectXpress software, the NORA-W366-00B module simplifies end-product integration and accelerates time-to-market. It includes a TCP/IP stack for both point-to-point and

point-to-multipoint use cases and ensures secure communication with cloud-based services through support for TLS encryption and MQTT protocols. The module also offers robust security features, including WPA2/WPA3, WiFi enterprise security, and Bluetooth LE secure connections. This Click board™ establishes communication between the NORA-W366-00B6-00B module and the host MCU through a UART interface, using standard UART RX and TX pins along with hardware flow control pins (CTS/RTS). The default communication speed is set at 115200bps, ensuring efficient data exchange. The host MCU configures wireless communication and various other features using high-level AT commands, eliminating the need for in-depth expertise in WiFi and Bluetooth protocol stacks. Besides interface pins, the module also uses some other mikroBUS™ pins like the WKP pin, which serves as an output for the host MCU wake-up function, and the WHS pin, which is used as the module wake-up signal to bring the module out of deep sleep mode. The board also features

an RST pin and a RESET button, providing functionality for resetting the module. WiFi NORA Click features two buttons, SW1 and SW2, to enter bootloader mode. When both buttons are pressed simultaneously, the module enters bootloader mode. If this state is maintained for more than 10 seconds without sending commands to the bootloader via UART, the u-connectXpress application will automatically boot, and the module settings will be restored to factory default values. Pressing only the SW1 button triggers the booting of the u-connectXpress application. Additionally, the Click board™ includes one user-configurable RGB LED indicator labeled LD2, which is used to indicate various module statuses. This Click board™ can be operated only with a 3.3V logic voltage level. The board must perform appropriate logic voltage level conversion before using MCUs with different logic levels. Also, it comes equipped with a library containing functions and an example code that can be used as a reference for further development.

WiFi NORA Click hardware overview image

Features overview

Development board

Discovery kit with STM32F303VC MCU streamlines application development with the STM32F3 Series microcontroller, harnessing the robustness of Arm® Cortex®-M4 architecture to provide an optimal development experience. It caters to both beginners and experts, offering essential components for swift initiation. Powered by the STM32F303VCT6, it boasts features like ST-

LINK/V2 or ST-LINK/V2-B for debugging, accelerometer, gyroscope, e-compass ST MEMS, USB connectivity, LED indicators, and push-buttons. Key specifications include a 256-Kbyte Flash memory, 48-Kbyte RAM, USB FS support, and a comprehensive array of motion sensors. The board includes ten LEDs for various statuses, including power indication and USB

communication. With user-friendly connectors and flexible power-supply options, it enables easy integration with prototype boards. Equipped with an on-board debugger/programmer and support for various Integrated Development Environments (IDEs) like IAR™, Keil®, and STM32CubeIDE, it ensures smooth and efficient development cycles.

Discovery kit with STM32F303VC MCU double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

ARM Cortex-M4

MCU Memory (KB)

256

Silicon Vendor

STMicroelectronics

Pin count

100

RAM (Bytes)

40960

You complete me!

Accessories

STM32F3 Discovery Shield is the perfect extension for your STM32F3 Discovery Board from STMicroelectronics. This versatile shield features four mikroBUS™ host sockets, a USB-UART module, and a CAN transceiver, expanding the capabilities of your Discovery board. Acting as a docking station, the STM32F3 Discovery Shield enables you to effortlessly transform your board into various applications, whether it's an RFID lock, SMS-triggered control switch, GPS tracking device, full-blown weather station, or any other idea you have in mind. With its seamless integration and enhanced functionality, this shield empowers you to explore endless possibilities and quickly bring your projects to life.

STM32F3 Discovery Shield accessories 1 image

Used MCU Pins

mikroBUS™ mapper

Host Wake-Up
PF4
AN
Reset / ID SEL
PF2
RST
UART CTS / ID COMM
PB12
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Module Wake-Up
PA1
PWM
UART RTS
PC2
INT
UART TX
PD8
TX
UART RX
PD9
RX
NC
NC
SCL
NC
NC
SDA
NC
NC
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

WiFi NORA Click Schematic schematic

Step by step

Project assembly

STM32F3 Discovery Shield front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Discovery kit with STM32F303VC MCU as your development board.

STM32F3 Discovery Shield front image hardware assembly
Discovery kit with STM32F303VC MCU front image hardware assembly
Charger 27 Click front image hardware assembly
Prog-cut hardware assembly
Board mapper by product8 hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
STM32F303VC Discovery MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support

Library Description

This library contains API for WiFi NORA Click driver.

Key functions:

  • wifinora_hw_reset - This function is used to perform HW reset.

  • wifinora_send_cmd - This function is used to send a desired command.

  • wifinora_send_cmd_with_par - This function sends a desired command with the parameter.

Open Source

Code example

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.

/*!
 * @file main.c
 * @brief WiFi NORA Click Example.
 *
 * # Description
 * This example demonstrates the use of WiFi NORA Click board by processing
 * the incoming data and displaying them on the USB UART.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver, tests the communication, and after that restarts the device, and performs example configuration.
 *
 * ## Application Task
 * It creates a connection to the TCP-UDP echo server, sends a message to it reads it back, displaces it on the UART terminal, and then closes the connection.
 *
 * ## Additional Function
 * - static void wifinora_clear_app_buf ( void )
 * - static void wifinora_log_app_buf ( void )
 * - static err_t wifinora_process ( wifinora_t *ctx )
 * - static err_t wifinora_rsp_check ( uint8_t *rsp )
 * - static void wifinora_configure_for_example ( void )
 * - static void wifinora_configure_for_example ( void )
 *
 * @author Stefan Ilic
 *
 */

#include "board.h"
#include "log.h"
#include "wifinora.h"

// Message content
#define MESSAGE_CONTENT                     "WiFi NORA Click board - demo example."

// TCP/UDP example parameters
#define REMOTE_IP                           "77.46.162.162" // TCP/UDP echo server IP address
#define REMOTE_PORT                         "51111"         // TCP/UDP echo server port

// WiFi parameters
#define WIFI_SSID                           "MikroE Public"
#define WIFI_PWD                            "mikroe.guest"

// Application buffer size
#define APP_BUFFER_SIZE                     200
#define PROCESS_BUFFER_SIZE                 200

static wifinora_t wifinora;
static log_t logger;
static err_t error_flag;

static uint8_t app_buf[ APP_BUFFER_SIZE ] = { 0 };
static int32_t app_buf_len = 0;

/**
 * @brief WiFi NORA clearing application buffer.
 * @details This function clears memory of application buffer and reset its length.
 * @note None.
 */
static void wifinora_clear_app_buf ( void );

/**
 * @brief WiFi NORA log application buffer.
 * @details This function logs data from application buffer to USB UART.
 * @note None.
 */
static void wifinora_log_app_buf ( void );

/**
 * @brief WiFi NORA data reading function.
 * @details This function reads data from device and concatenates data to application buffer. 
 * @return @li @c  0 - Read some data.
 *         @li @c -1 - Nothing is read.
 * See #err_t definition for detailed explanation.
 * @note None.
 */
static err_t wifinora_process ( void );

/**
 * @brief Response check.
 * @details This function checks for response and
 * returns the status of response.
 * @param[in] rsp  Expected response.
 * @return @li @c  0 - OK response.
 *         @li @c -1 - Error response.
 *         @li @c -2 - Timeout error.
 *         @li @c -3 - Unknown error.
 * See #err_t definition for detailed explanation.
 */
static err_t wifinora_rsp_check ( uint8_t *rsp );

/**
 * @brief Check for errors.
 * @details This function checks for different types of
 * errors and logs them on UART or logs the response if no errors occured.
 * @param[in] error_flag  Error flag to check.
 */
static void wifinora_error_check ( err_t error_flag );

/**
 * @brief WiFi NORA configure for example function.
 * @details This function is used to configure device for example.
 */
static void wifinora_configure_for_example ( void );

/**
 * @brief WiFi NORA execute example function.
 * @details This function executes TCP/UDP Example.
 */
static void wifinora_example ( void );

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    wifinora_cfg_t wifinora_cfg;  /**< Click config object. */

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, " Application Init " );

    // Click initialization.
    wifinora_cfg_setup( &wifinora_cfg );
    WIFINORA_MAP_MIKROBUS( wifinora_cfg, MIKROBUS_1 );
    if ( UART_ERROR == wifinora_init( &wifinora, &wifinora_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    wifinora_process( );
    wifinora_clear_app_buf( );

    // Hardware reset
    wifinora_hw_reset( &wifinora );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_READY );
    wifinora_error_check( error_flag );

    // Communication check
    wifinora_send_cmd( &wifinora, WIFINORA_CMD_AT );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    // Factory reset
    wifinora_send_cmd( &wifinora, WIFINORA_CMD_AT_USYFR );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    // Software reset
    wifinora_send_cmd( &wifinora, WIFINORA_CMD_AT_SW_RESET );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_READY );
    wifinora_error_check( error_flag );

    wifinora_send_cmd( &wifinora, WIFINORA_CMD_AT_GMM );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    wifinora_configure_for_example( );

    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    wifinora_example( );
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}

static void wifinora_clear_app_buf ( void ) 
{
    memset( app_buf, 0, app_buf_len );
    app_buf_len = 0;
}

static void wifinora_log_app_buf ( void )
{
    for ( int32_t buf_cnt = 0; buf_cnt < app_buf_len; buf_cnt++ )
    {
        log_printf( &logger, "%c", app_buf[ buf_cnt ] );
    }
}

static err_t wifinora_process ( void ) 
{
    uint8_t rx_buf[ PROCESS_BUFFER_SIZE ] = { 0 };
    int32_t overflow_bytes = 0;
    int32_t rx_cnt = 0;
    int32_t rx_size = wifinora_generic_read( &wifinora, rx_buf, PROCESS_BUFFER_SIZE );
    if ( ( rx_size > 0 ) && ( rx_size <= APP_BUFFER_SIZE ) ) 
    {
        if ( ( app_buf_len + rx_size ) > APP_BUFFER_SIZE ) 
        {
            overflow_bytes = ( app_buf_len + rx_size ) - APP_BUFFER_SIZE;
            app_buf_len = APP_BUFFER_SIZE - rx_size;
            memmove ( app_buf, &app_buf[ overflow_bytes ], app_buf_len );
            memset ( &app_buf[ app_buf_len ], 0, overflow_bytes );
        }
        for ( rx_cnt = 0; rx_cnt < rx_size; rx_cnt++ ) 
        {
            if ( rx_buf[ rx_cnt ] ) 
            {
                app_buf[ app_buf_len++ ] = rx_buf[ rx_cnt ];
            }
        }
        return WIFINORA_OK;
    }
    return WIFINORA_ERROR;
}

static err_t wifinora_rsp_check ( uint8_t *rsp )
{
    uint32_t timeout_cnt = 0;
    uint32_t timeout = 120000;
    wifinora_clear_app_buf( );
    wifinora_process( );
    while ( ( 0 == strstr( app_buf, rsp ) ) &&
            ( 0 == strstr( app_buf, WIFINORA_RSP_ERROR ) ) )
    {
        wifinora_process( );
        if ( timeout_cnt++ > timeout )
        {
            wifinora_clear_app_buf( );
            return WIFINORA_ERROR_TIMEOUT;
        }
        Delay_ms ( 1 );
    }
    Delay_ms ( 100 );
    wifinora_process( );
    if ( strstr( app_buf, rsp ) )
    {
        return WIFINORA_OK;
    }
    else if ( strstr( app_buf, WIFINORA_RSP_ERROR ) )
    {
        return WIFINORA_ERROR_CMD;
    }
    else
    {
        return WIFINORA_ERROR_UNKNOWN;
    }
}

static void wifinora_error_check ( err_t error_flag )
{    
    switch ( error_flag )
    {
        case WIFINORA_OK:
        {
            wifinora_log_app_buf( );
            break;
        }
        case WIFINORA_ERROR:
        {
            log_error( &logger, " Overflow!" );
            break;
        }
        case WIFINORA_ERROR_TIMEOUT:
        {
            log_error( &logger, " Timeout!" );
            break;
        }
        case WIFINORA_ERROR_CMD:
        {
            log_error( &logger, " ERROR Response!" );
            break;
        }
        case WIFINORA_ERROR_UNKNOWN:
        default:
        {
            log_error( &logger, " Unknown!" );
            break;
        }
    }
    log_printf( &logger, "- - - - - - - - - - - - - - - -\r\n" );
    Delay_ms ( 500 );
}

static void wifinora_configure_for_example ( void )
{
    uint8_t command_data[ APP_BUFFER_SIZE ] = { 0 };

    #define WLAN_HANDLE         "0"
    strcpy( command_data, WLAN_HANDLE );
    strcat( command_data, ",\"" );
    strcat( command_data, WIFI_SSID );
    strcat( command_data, "\"" );
    wifinora_send_cmd_with_par( &wifinora, WIFINORA_CMD_AT_UWSCP, command_data );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    wifinora_send_cmd_with_par( &wifinora, WIFINORA_CMD_AT_UWSIPD, "0" );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    #define WPA_THRESHILD       "0"
    strcpy( command_data, WLAN_HANDLE );
    strcat( command_data, ",\"" );
    strcat( command_data, WIFI_PWD );
    strcat( command_data, "\"," );
    strcat( command_data, WPA_THRESHILD );
    wifinora_send_cmd_with_par( &wifinora, WIFINORA_CMD_AT_UWSSW, command_data );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    wifinora_send_cmd_with_par( &wifinora, WIFINORA_CMD_AT_UWSC, "0" );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    #define CONNECTED           "+UENEU"
    error_flag = wifinora_rsp_check( CONNECTED );
}

static void wifinora_example ( void )
{
    uint8_t command_data[ APP_BUFFER_SIZE ] = { 0 };
    #define TCP_CLIENT          "0"
    #define UDP_CLIENT          "1"
    #define READ_LEN            "255"

    log_printf( &logger, " TCP Example \r\n" );
    log_printf( &logger, "- - - - - - - - - - - - - - - -\r\n" );

    #define TCP_PROTOCOL        "6"
    wifinora_send_cmd_with_par( &wifinora, WIFINORA_CMD_AT_USOCR, TCP_PROTOCOL );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    strcpy( command_data, TCP_CLIENT );
    strcat( command_data, "," );
    strcat( command_data, REMOTE_IP );
    strcat( command_data, "," );
    strcat( command_data, REMOTE_PORT );
    wifinora_send_cmd_with_par( &wifinora, WIFINORA_CMD_AT_USOC, command_data );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    log_printf( &logger, " Send data \r\n" );
    log_printf( &logger, "- - - - - - - - - - - - - - - -\r\n" );
    strcpy( command_data, TCP_CLIENT );
    strcat( command_data, ",\"" );
    strcat( command_data, MESSAGE_CONTENT );
    strcat( command_data, "\"" );
    wifinora_send_cmd_with_par( &wifinora, WIFINORA_CMD_AT_USOWS, command_data );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    log_printf( &logger, " Read data \r\n" );
    log_printf( &logger, "- - - - - - - - - - - - - - - -\r\n" );
    strcpy( command_data, TCP_CLIENT );
    strcat( command_data, "," );
    strcat( command_data, READ_LEN );
    wifinora_send_cmd_with_par( &wifinora, WIFINORA_CMD_AT_USORS, command_data );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    // 10 seconds delay
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );

    log_printf( &logger, " UDP Example \r\n" );
    log_printf( &logger, "- - - - - - - - - - - - - - - -\r\n" );

    #define UDP_PROTOCOL        "17"
    wifinora_send_cmd_with_par( &wifinora, WIFINORA_CMD_AT_USOCR, UDP_PROTOCOL );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    strcpy( command_data, UDP_CLIENT );
    strcat( command_data, "," );
    strcat( command_data, REMOTE_IP );
    strcat( command_data, "," );
    strcat( command_data, REMOTE_PORT );
    wifinora_send_cmd_with_par( &wifinora, WIFINORA_CMD_AT_USOC, command_data );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    log_printf( &logger, " Send data \r\n" );
    log_printf( &logger, "- - - - - - - - - - - - - - - -\r\n" );
    strcpy( command_data, UDP_CLIENT );
    strcat( command_data, ",\"" );
    strcat( command_data, MESSAGE_CONTENT );
    strcat( command_data, "\"" );
    wifinora_send_cmd_with_par( &wifinora, WIFINORA_CMD_AT_USOWS, command_data );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    log_printf( &logger, " Read data \r\n" );
    log_printf( &logger, "- - - - - - - - - - - - - - - -\r\n" );
    strcpy( command_data, UDP_CLIENT );
    strcat( command_data, "," );
    strcat( command_data, READ_LEN );
    wifinora_send_cmd_with_par( &wifinora, WIFINORA_CMD_AT_USORS, command_data );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    log_printf( &logger, " Close sockets \r\n" );
    log_printf( &logger, "- - - - - - - - - - - - - - - -\r\n" );
    wifinora_send_cmd_with_par( &wifinora, WIFINORA_CMD_AT_USOCL, UDP_CLIENT );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    wifinora_send_cmd_with_par( &wifinora, WIFINORA_CMD_AT_USOCL, TCP_CLIENT );
    error_flag = wifinora_rsp_check( WIFINORA_RSP_OK );
    wifinora_error_check( error_flag );

    // 10 seconds delay
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
    Delay_ms ( 1000 );
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.