RA Flexible Software Package Documentation
Release v5.6.0
|
|
Functions | |
fsp_err_t | RM_WIFI_DA16XXX_SntpServerIpAddressSet (uint8_t *p_server_ip_addr) |
fsp_err_t | RM_WIFI_DA16XXX_SntpEnableSet (wifi_da16xxx_sntp_enable_t enable) |
fsp_err_t | RM_WIFI_DA16XXX_SntpTimeZoneSet (int utc_offset_in_hours, uint32_t minutes, wifi_da16xxx_sntp_daylight_savings_enable_t daylightSavingsEnable) |
fsp_err_t | RM_WIFI_DA16XXX_LocalTimeGet (uint8_t *p_local_time, uint32_t size_string) |
fsp_err_t | RM_WIFI_DA16XXX_GenericAtSendRcv (char const *const at_string, char *const response_buffer, uint32_t length) |
Wifi and Socket implementation using the DA16XXX WiFi module on RA MCUs.
This Middleware module currently supplies an implementation for using the DA16XXX module in two different configurations.
The first is for the FreeRTOS WiFi interface, where the network stack is located on the MCU using a socket interface, and the DA16XXX Wi-Fi module provides a connection to the internet. This configuration requires FreeRTOS to be used.
The second configuration is for use with the DA16XXX on-chip MQTT and HTTP client modules, where the network stack is located on the DA16XXX module. In this configuration, this Middleware driver supports FreeRTOS as well as Baremetal (Microsoft Azure support expected in future release).
DA16XXX is a low power Wi-Fi networking SoC that delivers a dramatic breakthrough in battery life even for devices that are continuously connected to the Wi-Fi network. The module comes readily equipped with radio certification for Japan, North America and Europe. More information about this module can be found at the DA16XXX Web Site
The DA16XXX module supports the following modules:
The WiFi Onchip da16xxx Middleware driver supplies these features:
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Enable DA16600 Support |
| Disabled | Enabled if using the DA16600 module |
Check Minimum SDK Version |
| Enabled | Enable or disable comparing the current DA16XXX module's SDK version to the minimum required |
Number of supported socket instances (not used with on-chip APIs) | 1 | 1 | Enable number of socket instances |
Size of RX buffer for socket (not used with on-chip APIs) | Manual Entry | 8192 | |
Size of TX buffer for CMD Port | Manual Entry | 1500 | |
Size of RX buffer for CMD Port | Manual Entry | 3000 | |
Enable SNTP Client |
| Disabled | Should the SNTP client of the module be enabled |
Configuration | Options | Default | Description |
---|---|---|---|
Country code in ISO 3166-1 alpha-2 standard | Manual Entry | US | |
SNTP server IPv4 address | Must be a valid IPv4 address | 0.0.0.0 | |
SNTP Timezone UTC Offset in Hours | Refer to the RA Configuration tool for available options. | 0 | Value in hours from 12 to -12 |
Note: It is suggested that when using the DA16XXX module that DTC and FIFO are enabled in the UART configuration to facilitate a more reliable data transfer between module and MCU.
Note: If you wish to use flow control then you must enable flow control in the RA Configuration editor. This can be found in the UART setting. It is advantageous to use flow control all the time since it allows the hardware to gate the flow of data across the serial bus. Without hardware flow control for faster data rate you will most likely see an overflow condition between MCU and the module device.
Note: Higher baud rates are supported in the RA Configuration editor and should be changed in the first UART configuration. There is no need to change the second UART baud rate since it is only used as an AT command channel.
Note: It is a good idea to also enable the FIFO in the UART configuration settings if you plan to use higher baud rates.
Refer to UART (r_sci_uart). R_SCI_UART_Open() is called by WiFi Onchip DA16XXX Framework Driver (rm_wifi_da16xxx).
Refer to UART (r_sci_uart).
Refer to UART (r_sci_uart). R_SCI_UART_Open() is called by WiFi Onchip DA16XXX Framework Driver (rm_wifi_da16xxx)
This is a basic example of minimal use of WiFi Middleware in an application.
An example of using Simple Network Time Protocol (SNTP) on WiFi in an application.
Data Structures | |
struct | wifi_da16xxx_cfg_t |
struct | da16xxx_socket_t |
struct | wifi_da16xxx_instance_ctrl_t |
Enumerations | |
enum | wifi_da16xxx_sntp_enable_t |
enum | da16xxx_socket_status_t |
enum | da16xxx_socket_rw |
enum | da16xxx_recv_state |
enum | wifi_da16xxx_sntp_daylight_savings_enable_t |
struct wifi_da16xxx_cfg_t |
User configuration structure, used in open function
Data Fields | ||
---|---|---|
at_transport_da16xxx_instance_t const * |
p_transport_instance | |
const uint32_t | num_sockets | Number of sockets to initialize. |
const uint8_t * | country_code | Country code defined in ISO3166-1 alpha-2 standard. |
const uint8_t * | sntp_server_ip | The SNTP server IP address string. |
const int32_t | sntp_utc_offset_in_hours | Timezone offset in secs (-43200 - 43200) |
void const * | p_context | User defined context passed into callback function. |
void const * | p_extend | Pointer to extended configuration by instance of interface. |
struct da16xxx_socket_t |
DA16XXX Wifi internal socket instance structure
Data Fields | ||
---|---|---|
uint8_t | remote_ipaddr[4] | Remote IP address. |
int | remote_port | Remote Port. |
int | socket_recv_data_len | Data length of incoming socket data. |
int | socket_type | Socket type (TCP Server | TCP Client | UDP) |
uint32_t | socket_status | Current socket status. |
uint32_t | socket_recv_error_count | Socket receive error count. |
uint32_t | socket_create_flag | Flag to determine in socket has been created. |
uint32_t | socket_read_write_flag | flag to determine if read and/or write channels are active. |
da16xxx_recv_state | socket_recv_state | Incoming Socket data header information. |
StreamBufferHandle_t | socket_byteq_hdl | Socket stream buffer handle. |
StaticStreamBuffer_t | socket_byteq_struct | Structure to hold stream buffer info. |
uint8_t | socket_recv_buff[WIFI_DA16XXX_CFG_MAX_SOCKET_RX_SIZE] | Socket receive buffer used by byte queue. |
struct wifi_da16xxx_instance_ctrl_t |
WIFI_DA16XXX private control block. DO NOT MODIFY.
Data Fields | ||
---|---|---|
wifi_da16xxx_cfg_t const * | p_wifi_da16xxx_cfg | Pointer to initial configurations. |
uint32_t | num_creatable_sockets | Number of simultaneous sockets supported. |
uint32_t | curr_socket | Current Socket index for AT commands. |
uint32_t | open | Flag to indicate if wifi instance has been initialized. |
uint8_t | is_sntp_enabled | Flag to indicate Enable/Disable of SNTP Client. |
uint8_t | cmd_tx_buff[WIFI_DA16XXX_CFG_CMD_TX_BUF_SIZE] | Command send buffer. |
uint8_t | cmd_rx_buff[WIFI_DA16XXX_CFG_CMD_RX_BUF_SIZE] | Command receive buffer. |
volatile uint32_t | curr_socket_index | Currently active socket instance. |
uint8_t | curr_ipaddr[4] | Current IP address of module. |
uint8_t | curr_subnetmask[4] | Current Subnet Mask of module. |
uint8_t | curr_gateway[4] | Current GAteway of module. |
da16xxx_socket_t | sockets[WIFI_DA16XXX_CFG_NUM_CREATEABLE_SOCKETS] | Internal socket instances. |
DA16XXX WiFi module enable/disable for SNTP
DA16XXX Wifi socket status types
enum da16xxx_socket_rw |
DA16XXX socket shutdown channels
enum da16xxx_recv_state |
DA16XXX socket receive state
DA16XXX WiFi module enable/disable for SNTP Daylight
fsp_err_t RM_WIFI_DA16XXX_SntpServerIpAddressSet | ( | uint8_t * | p_server_ip_addr | ) |
Set the SNTP Client Server IP Address
[in] | p_server_ip_addr | Pointer to IP address of SNTP server in byte array format. |
FSP_SUCCESS | Successfully set the value. |
FSP_ERR_WIFI_FAILED | Error occurred with command to Wifi module. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_ASSERTION | The parameter p_server_ip_addr is NULL. |
Update the SNTP Server IP Address
fsp_err_t RM_WIFI_DA16XXX_SntpEnableSet | ( | wifi_da16xxx_sntp_enable_t | enable | ) |
Set the SNTP Client to Enable or Disable
[in] | enable | Flag to indicate enable/disable for SNTP support. |
FSP_SUCCESS | Successfully set the value. |
FSP_ERR_WIFI_FAILED | Error occurred with command to Wifi module. |
FSP_ERR_NOT_OPEN | Module is not open. |
Enable or Disable the SNTP Client Service
fsp_err_t RM_WIFI_DA16XXX_SntpTimeZoneSet | ( | int | utc_offset_in_hours, |
uint32_t | minutes, | ||
wifi_da16xxx_sntp_daylight_savings_enable_t | daylightSavingsEnable | ||
) |
Set the SNTP Client Timezone
[in] | utc_offset_in_hours | Timezone in UTC offset in hours |
[in] | minutes | Number of minutes used for timezone offset from GMT. |
[in] | daylightSavingsEnable | Enable/Disable daylight saving in the timezone calculation. |
FSP_SUCCESS | Successfully set the value. |
FSP_ERR_WIFI_FAILED | Error occurred with command to Wifi module. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Parameter passed into function was invalid. |
Update the SNTP Timezone
fsp_err_t RM_WIFI_DA16XXX_LocalTimeGet | ( | uint8_t * | p_local_time, |
uint32_t | size_string | ||
) |
Get the current local time based on current timezone in a string . Exp: YYYY-MM-DD,HOUR:MIN:SECS
[out] | p_local_time | Returns local time in string format. |
[in] | size_string | Size of p_local_time string buffer.The size of this string needs to be at least 25 bytes |
FSP_SUCCESS | Successfully returned the local time string. |
FSP_ERR_ASSERTION | The parameter local_time or p_instance_ctrl is NULL. |
FSP_ERR_WIFI_FAILED | Error occurred with command to Wifi module. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_SIZE | String size value passed in exceeds maximum. |
Get the current local time based on current timezone in a string format
fsp_err_t RM_WIFI_DA16XXX_GenericAtSendRcv | ( | char const *const | at_string, |
char *const | response_buffer, | ||
uint32_t | length | ||
) |
Sends any AT command compatible with the DA16XXX module. Provide optional buffer to receive the response.
[in] | at_string | Input AT command string from the user. |
[in] | response_buffer | Optional buffer for receiving the response. |
[in] | length | Size of optional buffer. |
FSP_SUCCESS | Function completed successfully. |
FSP_ERR_WIFI_FAILED | Error occurred with command to Wifi module. |
FSP_ERR_NOT_OPEN | Module is not open. |
FSP_ERR_INVALID_ARGUMENT | Input was not a valid AT command. |
Send a generic AT command to the DA16XXX and optionally receive a response