RAFW Flexible Software Package Documentation  Release v2.1.0

 
ATCMD_W Middleware (rm_atcmd_w)

Functions

fsp_err_t RM_ATCMD_W_CORE_Open (atcmd_w_ctrl_t *const p_at_ctrl, atcmd_w_cfg_t const *const p_cfg)
 
fsp_err_t RM_ATCMD_W_CORE_Read (atcmd_w_ctrl_t *const p_at_ctrl, uint8_t *const p_dest, uint32_t const bytes)
 
fsp_err_t RM_ATCMD_W_CORE_DataRead (atcmd_w_ctrl_t *const p_at_ctrl, uint8_t *const p_dest, uint32_t const bytes)
 
fsp_err_t RM_ATCMD_W_CORE_Write (atcmd_w_ctrl_t *const p_at_ctrl, uint8_t const *const p_src, uint32_t const bytes)
 
fsp_err_t RM_ATCMD_W_CORE_InfoGet (atcmd_w_ctrl_t *const p_at_ctrl, atcmd_w_info_t *const p_info)
 
fsp_err_t RM_ATCMD_W_CORE_Close (atcmd_w_ctrl_t *const p_at_ctrl)
 
fsp_err_t RM_ATCMD_W_CORE_SecureChannelKeySet (atcmd_w_ctrl_t *const p_at_ctrl, uint8_t *key)
 

Detailed Description

Middleware for the AT peripheral module on RAFW MCUs. This module implements the AT Interface.

Overview

Features

The ATCMD_W module supports the following features:

Configuration

Build Time Configurations for rm_atcmd_w

The following build time configurations are defined in fsp_cfg/rm_atcmd_w_cfg.h:

ConfigurationOptionsDefaultDescription
Parameter Checking
  • Default (BSP)
  • Enabled
  • Disabled
Default (BSP) If selected code for parameter checking is included in the build.
ATCMD Task Support
  • Enable
  • Disable
Enable Enable support for the AT interface.
UART Support
  • Enable
  • Disable
Enable Enable UART support for the AT module.
Assume MCU always ON
  • Enable
  • Disable
Disable Allow MCU to skip sending AT+PMGRMCUWUDONE when MCU wakes up
SPI Support
  • Enable
  • Disable
Disable Enable SPI support for the AT module.
SDIO Support
  • Enable
  • Disable
Disable Enable SDIO support for the AT module.
ATCMD BLEBRG Support
  • Enable
  • Disable
Disable Enable Support for atcmd blebrg.
RF Support
  • Enable
  • Disable
Enable Select RF support for the AT module.
ATCMD response max len
  • 1024
  • 4096
1024 Select ATCMD response max length.
AT+PMGRMCUWUDONE Wait Maximum Timeout (ms)Timeout must be an integer greater than 0 150 Timeout for receiving AT+PMGRMCUWUDONE in milliseconds at DPM wakeup.
AT+PMGRCONSTRAINT Wait Maximum Timeout (ms)Timeout must be an integer greater than 0 100 Timeout for receiving AT+PMGRCONSTRAINT=1,1/4 in milliseconds at DPM wakeup.

Configurations for Networking > AT Middleware (rm_atcmd_w)

This module can be added to the Stacks tab via New Stack > Networking > AT Middleware (rm_atcmd_w).

ConfigurationOptionsDefaultDescription
General
NameName must be a valid C symbolg_at0 Module name.

Clock Configuration

The AT peripheral uses the PERI_CLK for for the baud-rate clock generator

Pin Configuration

This module uses the TXD,RTS,CST,and RXD pins to communicate with external devices. When autoflow control is configured, the pins of rts and cts must be pinmux as corresponding functions. When in RS-485 mode, an additional AT_TXDOE signal is provided to indicate the TXD active intervals. This signal can be assigned to any of the unused GPIO pins through the PPA.

Usage Notes

When the auto flow control is enabled, the RTS pin will be automatically pulled up. When the receiving water level of the fifo reaches the set threshold. If need to use auto flow control, also need to configure the corresponding pinmux for RTS and CTS.

Examples

ATCMD_W Example

static void at_config_example (atcmd_w_conf_t *p_at_conf)
{
p_at_conf->conf.p_i2c_master = &g_atcmd_i2c_instance;
p_at_conf->conf.p_adc = &g_atcmd_adc_instance;
p_at_conf->conf.p_transport_instance = &g_transport_inst_app;
}
fsp_err_t atcmd_w_core_init (atcmd_w_core_instance_t *p_at_core_instance)
{
fsp_err_t err = FSP_SUCCESS;
at_config_example(&p_at_core_instance->at_conf);
memset((atcmd_w_tx_queue_t *)&p_at_core_instance->tx_queue, 0x00, sizeof(p_at_core_instance->tx_queue));
err = g_at_core.open(&p_at_core_instance->at_ctrl, &p_at_core_instance->at_conf.conf);
FSP_ASSERT(err == FSP_SUCCESS);
return err;
}
void at_basic_example ()
{
fsp_err_t err = FSP_SUCCESS;
/* Initialize g_transport_inst_app to known data */
g_transport_inst_app.p_ctrl = &g_rm_atcmd_transport_instance;
g_transport_inst_app.p_api = &g_atcmd_transport_on_uart;
g_transport_inst_app.p_cfg = &g_transport0_cfg;
/* Init ATCMD_W_CORE */
err = atcmd_w_core_init(&g_at_core_instance);
assert(FSP_SUCCESS == err);
/* Init ATCMD_TRANSPORT_UART_W */
err = g_atcmd_transport_on_uart.open(g_transport_inst_app.p_ctrl,
&g_transport0_cfg,
&g_at_core_instance.at_ctrl);
assert(FSP_SUCCESS == err);
while(EXAMPLE_RUN_FOREVER)
{
}
}

Data Structures

struct  atcmd_w_conf_t
 

Data Structure Documentation

◆ atcmd_w_conf_t

struct atcmd_w_conf_t

AT configuration struct.

Data Fields
atcmd_w_cfg_t conf Instruction configuration for the AT module.

Function Documentation

◆ RM_ATCMD_W_CORE_Open()

fsp_err_t RM_ATCMD_W_CORE_Open ( atcmd_w_ctrl_t *const  p_at_ctrl,
atcmd_w_cfg_t const *const  p_cfg 
)

This functions initializes the AT communication module. Implements atcmd_w_api_t::open.

This function performs the following tasks:

  • Performs parameter checking and processes error conditions.
  • Configures the peripheral registers according to the configuration.
  • Initialize the control structure for use in other AT Interface functions.
Return values
FSP_SUCCESSModule initialized successfully.
FSP_ERR_ALREADY_OPENInstance was already initialized.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls: transfer_api_t::open
Note
This function is reentrant.

◆ RM_ATCMD_W_CORE_Read()

fsp_err_t RM_ATCMD_W_CORE_Read ( atcmd_w_ctrl_t *const  p_at_ctrl,
uint8_t *const  p_dest,
uint32_t const  bytes 
)

This function receives data from a AT transport layer. Implements atcmd_w_api_t::read.

The function performs the following tasks:

  • Performs parameter checking and processes error conditions.
  • Sets up the instance to complete a AT read operation.
Return values
FSP_SUCCESSRead operation successfully completed.
FSP_ERR_ASSERTIONNULL pointer to control or destination parameters or transfer length is zero.
FSP_ERR_NOT_OPENThe transport has not been opened. Open transport first.
FSP_ERR_IN_USEA transfer is already in progress.
FSP_ERR_TIMEOUTTimeout reading data.

◆ RM_ATCMD_W_CORE_DataRead()

fsp_err_t RM_ATCMD_W_CORE_DataRead ( atcmd_w_ctrl_t *const  p_at_ctrl,
uint8_t *const  p_dest,
uint32_t const  bytes 
)

This function receives data from a AT input command buffer. Implements atcmd_w_api_t::dataRead.

The function performs the following tasks:

  • Performs parameter checking and processes error conditions.
  • Sets up the instance to complete a AT read operation.
Return values
FSP_SUCCESSRead operation successfully completed.
FSP_ERR_ASSERTIONNULL pointer to control or destination parameters or transfer length is zero.
FSP_ERR_NOT_OPENThe transport has not been opened. Open transport first.
FSP_ERR_IN_USEA transfer is already in progress.
FSP_ERR_TIMEOUTTimeout reading data.
FSP_ERR_BUFFER_EMPTYIncomplete or invalid command received.

◆ RM_ATCMD_W_CORE_Write()

fsp_err_t RM_ATCMD_W_CORE_Write ( atcmd_w_ctrl_t *const  p_at_ctrl,
uint8_t const *const  p_src,
uint32_t const  bytes 
)

This function transmits data to a AT transport layer. Implements atcmd_w_api_t::write.

The function performs the following tasks:

  • Performs parameter checking and processes error conditions.
  • Sets up the instance to complete a AT write operation.
Return values
FSP_SUCCESSWrite operation successfully completed.
FSP_ERR_ASSERTIONNULL pointer to control or source parameters or transfer length is zero.
FSP_ERR_NOT_OPENThe transport has not been opened. Open the transport first.
FSP_ERR_IN_USEA transfer is already in progress.

◆ RM_ATCMD_W_CORE_InfoGet()

fsp_err_t RM_ATCMD_W_CORE_InfoGet ( atcmd_w_ctrl_t *const  p_at_ctrl,
atcmd_w_info_t *const  p_info 
)

Provides the middleware information, including the maximum number of bytes that can be received or transmitted at a time. Implements atcmd_w_api_t::infoGet

Return values
FSP_SUCCESSInformation stored in provided p_info.
FSP_ERR_ASSERTIONPointer to AT control block is NULL.
FSP_ERR_NOT_OPENThe control block has not been opened

◆ RM_ATCMD_W_CORE_Close()

fsp_err_t RM_ATCMD_W_CORE_Close ( atcmd_w_ctrl_t *const  p_at_ctrl)

This function manages the closing of the module by the following task. Implements atcmd_w_api_t::close.

Disables AT operations by disabling the selected communication bus (UART,SPI or SDIO).

  • Disables the AT peripheral.
  • Disables all the associated interrupts.
  • Update control structure so it will not work with AT Interface functions.
Return values
FSP_SUCCESSModule successfully closed.
FSP_ERR_ASSERTIONA required pointer argument is NULL.
FSP_ERR_NOT_OPENThe module has not been opened. Open the module first.

◆ RM_ATCMD_W_CORE_SecureChannelKeySet()

fsp_err_t RM_ATCMD_W_CORE_SecureChannelKeySet ( atcmd_w_ctrl_t *const  p_at_ctrl,
uint8_t *  key 
)

Sets the secure channel key for AT command core.

This function copies the provided key into the internal control structure if secure channel support is enabled (ATCMD_SECURE_CHANNEL == 1).

Parameters
[in]p_at_ctrlPointer to the AT command control structure.
[in]keyPointer to the secure key to be set.
Return values
FSP_SUCCESSKey was set successfully (or no operation if secure channel is disabled).