RA Flexible Software Package Documentation
Release v5.2.0
|
|
Functions | |
fsp_err_t | RM_WIFI_ONCHIP_SILEX_EpochTimeGet (time_t *p_utc_time) |
fsp_err_t | RM_WIFI_ONCHIP_SILEX_LocalTimeGet (uint8_t *p_local_time, uint32_t size_string) |
fsp_err_t | RM_WIFI_ONCHIP_SILEX_SntpEnableSet (wifi_onchip_silex_sntp_enable_t enable) |
fsp_err_t | RM_WIFI_ONCHIP_SILEX_SntpServerIpAddressSet (uint8_t *p_ip_address) |
fsp_err_t | RM_WIFI_ONCHIP_SILEX_SntpTimeZoneSet (int32_t hours, uint32_t minutes, wifi_onchip_silex_sntp_daylight_savings_enable_t daylightSavingsEnable) |
Wifi and Socket implementation using the Silex SX-ULPGN WiFi module on RA MCUs.
This Middleware module supplies an implementation for the FreeRTOS WiFi interface and AzureRTOS NetxDuo WiFi interface using the Silex SX-ULPGN module.
You can find specifics about the WiFi and Secure Socket interface APIs supported by this module at these web sites: Wifi API.
The SX-ULPGN is a low-power, compact IEEE 802.11b/g/n 2.4GHz 1x1 Wireless LAN module equipped with the Qualcomm® QCA4010 Wireless SOC. The module comes readily equipped with radio certification for Japan, North America and Europe. More information about this module can be found at the Silex Web Site
The WiFi Onchip Silex Middleware driver supplies these features:
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Number of supported socket instances | Refer to the RA Configuration tool for available options. | 1 | Enable number of socket instances |
Size of RX buffer for socket | Manual Entry | 4096 | |
Size of TX buffer for CMD Port | Manual Entry | 1500 | |
Size of RX buffer for CMD Port | Manual Entry | 3000 | |
Semaphore maximum timeout | Manual Entry | 10000 | |
Number of retries for AT commands | Manual Entry | 10 | |
Module Reset Port | Refer to the RA Configuration tool for available options. | 06 | Specify the module reset pin port for the MCU. |
Module Reset Pin | Refer to the RA Configuration tool for available options. | 03 | Specify the module reset pin for the MCU. |
Enable SNTP Client |
| Disabled | Should the SNTP client of the module be enabled |
Configuration | Options | Default | Description |
---|---|---|---|
SNTP server IPv4 address | Must be a valid IPv4 address | 0.0.0.0 | |
SNTP Timezone Offset from UTC Hours | Must be between 12 and -12 hours | 0 | Value in hours from 12 to -12 |
SNTP Timezone Offset from UTC Minutes | Must be between 0 and 59 minutes | 0 | Value in minutes from 0 to 59 |
Use Daylight Savings Time |
| Disabled | Specify if daytime savings should be used for local time calulation |
Note: It is suggested that when using the Silex 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 Silex Driver using r_sci_uart (rm_wifi_onchip_silex).
Refer to UART (r_sci_uart).
Refer to UART (r_sci_uart). R_SCI_UART_Open() is called by WiFi Onchip Silex Driver using r_sci_uart (rm_wifi_onchip_silex)
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_onchip_silex_cfg_t |
struct | ulpgn_socket_t |
struct | wifi_onchip_silex_instance_ctrl_t |
Enumerations | |
enum | sx_ulpgn_socket_status_t |
enum | sx_ulpgn_socket_rw |
enum | wifi_onchip_silex_sntp_enable_t |
enum | wifi_onchip_silex_sntp_daylight_savings_enable_t |
struct wifi_onchip_silex_cfg_t |
User configuration structure, used in open function
Data Fields | ||
---|---|---|
const uint32_t | num_uarts | Number of UART interfaces to use. |
const uint32_t | num_sockets | Number of sockets to initialize. |
const bsp_io_port_pin_t | reset_pin | Reset pin used for module. |
const uart_instance_t * | uart_instances[WIFI_ONCHIP_SILEX_CFG_MAX_NUMBER_UART_PORTS] | SCI UART instances. |
const wifi_onchip_silex_sntp_enable_t |
sntp_enabled | Enable/Disable the SNTP Client. |
const uint8_t * | sntp_server_ip | The SNTP server IP address string. |
const int32_t | sntp_timezone_offset_from_utc_hours | Timezone offset from UTC in (+/-) hours. |
const uint32_t | sntp_timezone_offset_from_utc_minutes | Timezone offset from UTC in minutes. |
const wifi_onchip_silex_sntp_daylight_savings_enable_t |
sntp_timezone_use_daylight_savings | Enable/Disable use of daylight saving time. |
void const * | p_context | User defined context passed into callback function. |
void const * | p_extend | Pointer to extended configuration by instance of interface. |
struct ulpgn_socket_t |
Silex ULPGN Wifi internal socket instance structure
struct wifi_onchip_silex_instance_ctrl_t |
WIFI_ONCHIP_SILEX private control block. DO NOT MODIFY.
Data Fields | ||
---|---|---|
uint32_t | open | Flag to indicate if wifi instance has been initialized. |
wifi_onchip_silex_cfg_t const * | p_wifi_onchip_silex_cfg | Pointer to initial configurations. |
bsp_io_port_pin_t | reset_pin | Wifi module reset pin. |
uint32_t | num_uarts | number of UARTS currently used for communication with module |
uint32_t | tx_data_size | Size of the data to send. |
uint32_t | num_creatable_sockets | Number of simultaneous sockets supported. |
uint32_t | curr_cmd_port | Current UART instance index for AT commands. |
uint32_t | curr_data_port | Current UART instance index for data. |
uint8_t | cmd_rx_queue_buf[WIFI_ONCHIP_SILEX_CFG_CMD_RX_BUF_SIZE] | Command port receive buffer used by byte queue // FreeRTOS. |
StreamBufferHandle_t | socket_byteq_hdl | Socket stream buffer handle. |
StaticStreamBuffer_t | socket_byteq_struct | Structure to hold stream buffer info. |
volatile uint32_t | curr_socket_index | Currently active socket instance. |
uint8_t | cmd_tx_buff[WIFI_ONCHIP_SILEX_CFG_CMD_TX_BUF_SIZE] | Command send buffer. |
uint8_t | cmd_rx_buff[WIFI_ONCHIP_SILEX_CFG_CMD_RX_BUF_SIZE] | Command receive buffer. |
uint32_t | at_cmd_mode | Current command mode. |
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. |
SemaphoreHandle_t | tx_sem | Transmit binary semaphore handle. |
SemaphoreHandle_t | rx_sem | Receive binary semaphore handle. |
uint8_t | last_data[WIFI_ONCHIP_SILEX_RETURN_TEXT_LENGTH] | Tailing buffer used for command parser. |
uart_instance_t * | uart_instance_objects[WIFI_ONCHIP_SILEX_CFG_MAX_NUMBER_UART_PORTS] | UART instance objects. |
SemaphoreHandle_t | uart_tei_sem[WIFI_ONCHIP_SILEX_CFG_MAX_NUMBER_UART_PORTS] | UART transmission end binary semaphore. |
ulpgn_socket_t | sockets[WIFI_ONCHIP_SILEX_CFG_NUM_CREATEABLE_SOCKETS] | Internal socket instances. |
Silex ULPGN Wifi socket status types
enum sx_ulpgn_socket_rw |
Silex socket shutdown channels
Silex WiFi module enable/disable for SNTP
Silex WiFi module enable/disable for SNTP
fsp_err_t RM_WIFI_ONCHIP_SILEX_EpochTimeGet | ( | time_t * | p_utc_time | ) |
This will retrieve time info from an NTP server at the address entered via an during configuration. If the server isn’t set or the client isn’t enabled, then it will return an error. The date/time is retrieved as the number of seconds since 00:00:00 UTC January 1, 1970
[out] | p_utc_time | Returns the epoch time in seconds. |
FSP_SUCCESS | Successfully retrieved the system time from module. |
FSP_ERR_ASSERTION | The parameter utc_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. |
Get the current system time as the number of seconds since epoch 1970-01-01 00:00:00 UTC
fsp_err_t RM_WIFI_ONCHIP_SILEX_LocalTimeGet | ( | uint8_t * | p_local_time, |
uint32_t | size_string | ||
) |
Get the current local time based on current timezone in a string . Exp: Wed Oct 15 1975 07:06:00
[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_ONCHIP_SILEX_SntpEnableSet | ( | wifi_onchip_silex_sntp_enable_t | enable | ) |
Set the SNTP Client to Enable or Disable
[in] | enable | Can be set to 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_ONCHIP_SILEX_SntpServerIpAddressSet | ( | uint8_t * | p_ip_address | ) |
Set the SNTP Client Server IP Address
[in] | p_ip_address | Pointer to IP address of SNTP server in byte array format. |
FSP_SUCCESS | Successfully set the value. |
FSP_ERR_ASSERTION | The parameter p_ip_address 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. |
Update the SNTP Server IP Address
fsp_err_t RM_WIFI_ONCHIP_SILEX_SntpTimeZoneSet | ( | int32_t | hours, |
uint32_t | minutes, | ||
wifi_onchip_silex_sntp_daylight_savings_enable_t | daylightSavingsEnable | ||
) |
Set the SNTP Client Timezone
[in] | hours | Number of hours (+/-) used for timezone offset from GMT. |
[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