Transport layer implementation for linking DA16XXX Drivers with Communications layer.
Overview
This Transport Layer provides an abstraction interface between the DA16XXX driver and communications layers. Currently, the module supports only UART, but will support SPI in future.
Refer to WiFi Onchip DA16XXX Framework Driver (rm_wifi_da16xxx).
Features
- Configuring internal send/receive buffers.
- Providing thread-safe access to the communications interface (mutex) when sending AT commands.
- Implementing AT command send function based on user communication option (UART or SPI (future)). This function must be able to check the module response.
- Implement a receive function based on user communication option (UART or SPI (future)). Handles income data from the communications interface and stacks it on an internal buffer.
Refer to WiFi Onchip DA16XXX Framework Driver (rm_wifi_da16xxx).
Configuration
Build Time Configurations for rm_at_transport_da16xxx_uart
The following build time configurations are defined in fsp_cfg/rm_at_transport_da16xxx_uart_cfg.h:
Configuration | Options | Default | Description |
Parameter Checking |
-
Default (BSP)
-
Enabled
-
Disabled
| Default (BSP) | If selected code for parameter checking is included in the build. |
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. |
Refer to WiFi Onchip DA16XXX Framework Driver (rm_wifi_da16xxx).
Interrupt Configuration
Refer to UART (r_sci_uart).
Clock Configuration
Refer to UART (r_sci_uart).
Pin Configuration
Refer to UART (r_sci_uart).
Usage Notes
- This module is not designed to be used directly, users will access this module via the DA16XXX driver
Limitations
Refer to WiFi Onchip DA16XXX Framework Driver (rm_wifi_da16xxx).
◆ at_transport_da16xxx_extended_cfg_t
struct at_transport_da16xxx_extended_cfg_t |
User configuration structure, used in open function
Data Fields |
const uint32_t |
num_uarts |
Number of UART interfaces to use. |
const uart_instance_t * |
uart_instances[AT_TRANSPORT_DA16XXX_CFG_MAX_NUMBER_UART_PORTS] |
SCI UART instances. |
const bsp_io_port_pin_t |
reset_pin |
Reset pin used for module. |
◆ at_transport_da16xxx_instance_ctrl_t
struct at_transport_da16xxx_instance_ctrl_t |
AT_TRANSPORT_DA16XXX private control block. DO NOT MODIFY.
◆ rm_at_transport_da16xxx_uart_callback()
UART Callback routine.
- Parameters
-
[in] | p_args | Pointer to uart callback structure. |
◆ rm_at_transport_da16xxx_uartOpen()
Opens and configures the WIFI_DA16XXX Middleware module.
- Parameters
-
[in] | p_ctrl | Pointer to Transport layer instance control structure. |
[in] | p_cfg | Pointer to pin configuration structure. |
- Return values
-
FSP_SUCCESS | WIFI_DA16XXX successfully configured. |
FSP_ERR_ASSERTION | The parameter p_cfg or p_instance_ctrl is NULL. |
FSP_ERR_OUT_OF_MEMORY | There is no more heap memory available. |
FSP_ERR_WIFI_FAILED | Error occurred with command to Wifi module. |
FSP_ERR_ALREADY_OPEN | Module is already open. This module can only be opened once. |
FSP_ERR_WIFI_INIT_FAILED | WiFi module initialization failed. |
◆ rm_at_transport_da16xxx_uart_atCommandSendThreadSafe()
Send an AT command with testing for return response.
- Parameters
-
[in] | p_ctrl | Pointer to Transport layer instance control structure. |
[in] | p_at_cmd | Pointer to AT command data structure. |
- Return values
-
FSP_SUCCESS | Function completed successfully. |
FSP_ERR_WIFI_FAILED | Error occurred with command to Wifi module. |
◆ rm_at_transport_da16xxx_uart_atCommandSend()
Send and receive an AT command with testing for return. Thread-Safe
- Parameters
-
[in] | p_ctrl | Pointer to Transport layer instance control structure. |
[in] | p_at_cmd | Pointer to Transport layer instance data structure. |
- Return values
-
FSP_SUCCESS | Function completed successfully. |
FSP_ERR_WIFI_FAILED | Error occurred with command to Wifi module. |
FSP_ERR_ASSERTION | Assertion error occurred. |
◆ rm_at_transport_da16xxx_uart_giveMutex()
Give the mutex for the send basic call.
- Parameters
-
[in] | p_ctrl | Pointer to Transport layer instance control structure. |
[in] | mutex_flag | Flags for the mutex. |
- Return values
-
FSP_SUCCESS | Function completed successfully. |
FSP_ERR_WIFI_FAILED | Error occurred giving the mutex. |
◆ rm_at_transport_da16xxx_uart_takeMutex()
Take the mutex for the send basic call.
- Parameters
-
[in] | p_ctrl | Pointer to Transport layer instance control structure. |
[in] | mutex_flag | Flags for the mutex. |
- Return values
-
FSP_SUCCESS | Function completed successfully. |
FSP_ERR_WIFI_FAILED | Error occurred taking the mutex. |
◆ rm_at_transport_da16xxx_uart_bufferRecv()
size_t rm_at_transport_da16xxx_uart_bufferRecv |
( |
at_transport_da16xxx_ctrl_t *const |
p_ctrl, |
|
|
const char * |
p_data, |
|
|
uint32_t |
length, |
|
|
uint32_t |
rx_timeout |
|
) |
| |
Receive data from stream buffer.
- Parameters
-
[in] | p_ctrl | Pointer to Transport layer instance control structure. |
[in] | p_data | Pointer to data. |
[in] | length | Data length. |
[in] | rx_timeout | Timeout for receiving data on the buffer. |
- Return values
-
Number | of bytes pulled from Streambuffer |
FSP_SUCCESS | Function completed successfully. |
FSP_ERR_WIFI_FAILED | Error occurred with command to Wifi module. |
FSP_ERR_ASSERTION | Assertion error occurred. |
FSP_ERR_INVALID_DATA | Accuracy of data is not guaranteed |
◆ rm_at_transport_da16xxx_statusGet()
Gets the status of the configured DA16xxx transport.
- Return values
-
FSP_SUCCESS | Status stored in p_status. |
FSP_ERR_ASSERTION | NULL pointer. |
◆ rm_at_transport_da16xxx_uartClose()
Closes the AT Transport DA16XXX Middleware module.
- Parameters
-
[in] | p_ctrl | Pointer to Transport layer instance control structure. |
- Return values
-
FSP_SUCCESS | WIFI_DA16XXX successfully configured. |
FSP_ERR_ASSERTION | The parameter p_cfg or p_instance_ctrl is NULL. |
FSP_ERR_NOT_OPEN | The Transport layer instance is not open. |