WiFi NORA Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
- Author : Stefan Ilic
- Date : Jan 2024.
- Type : UART type
This example demonstrates the use of WiFi NORA Click board by processing the incoming data and displaying them on the USB UART.
- MikroSDK.Board
- MikroSDK.Log
- Click.WiFiNORA
wifinora_cfg_setup
Config Object Initialization function.
void wifinora_cfg_setup ( wifinora_cfg_t *cfg );
wifinora_init
Initialization function.
err_t wifinora_init ( wifinora_t *ctx, wifinora_cfg_t *cfg );
wifinora_hw_reset
This function is used to perform HW reset.
void wifinora_hw_reset ( wifinora_t *ctx );
wifinora_send_cmd
This function is used to send a desired command.
void wifinora_send_cmd ( wifinora_t *ctx, uint8_t *at_cmd_buf );
wifinora_send_cmd_with_par
This function sends a desired command with the parameter.
void wifinora_send_cmd_with_par ( wifinora_t *ctx, uint8_t *at_cmd_buf, uint8_t *param_buf );
Initializes the driver, tests the communication, and after that restarts the device, and performs example configuration.
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 " );
}
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.
void application_task ( void )
{
wifinora_example( );
}
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
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.