RAFW Flexible Software Package Documentation  Release v2.0.1

 
ATCMD_W Middleware (rm_atcmd_w)

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.
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_err_example (atcmd_w_core_instance_t *p_at_core_instance, atcmd_w_event_t err)
{
}
static void at_config_example (atcmd_w_conf_t *p_at_conf,
void (*p_callback)(atcmd_w_callback_args_t * p_args),
void *p_cb_arg)
{
p_at_conf->conf.p_callback = p_callback;
p_at_conf->conf.p_context = p_cb_arg;
p_at_conf->conf.p_i2c_master = &g_atcmd_i2c_instance;
p_at_conf->conf.p_adc = &g_atcmd_adc_instance;
}
fsp_err_t atcmd_w_core_init (atcmd_w_core_instance_t *p_at_core_instance,
atcmd_w_rx_char_cb_t p_rx_cb,
atcmd_w_err_cb_t p_err_cb,
void *p_cb_arg)
{
fsp_err_t err = FSP_SUCCESS;
p_at_core_instance->p_rx_cb = p_rx_cb;
p_at_core_instance->p_err_cb = p_err_cb;
p_at_core_instance->p_cb_arg = p_cb_arg;
at_config_example(&p_at_core_instance->at_conf, rm_atcmd_transport_uart_w_from_atcmd_w_core_cb, p_cb_arg);
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,
(atcmd_w_rx_char_cb_t)rm_atcmd_transport_uart_w_from_atcmd_w_core_cb,
(atcmd_w_err_cb_t)at_err_example,
&g_transport_inst_app);
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)
{
}
}