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:
- APB data bus widths of 32 bits
- Use PERI_CLK with separate system resets for each clock domain to prevent metastability
- Programmable FIFO enable/disable
- Internal transceiver FIFO depths are 32 bytes
- DMA interface signals with high polarity
- Auto Flow Control mode support
- False start bit detection
- AT busy or idle functionality
- Full-duplex AT communication
- Invoking the user-callback function with an event code (RX/TX complete, TX data empty, RX char, error, etc)
- Baud-rate change at run-time
Configuration
Build Time Configurations for rm_atcmd_w
The following build time configurations are defined in fsp_cfg/rm_atcmd_w_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. |
| ATCMD Task Support |
| Enable | Enable support for the AT interface. |
| UART Support |
| Enable | Enable UART support for the AT module. |
| Assume MCU always ON |
| Disable | Allow MCU to skip sending AT+PMGRMCUWUDONE when MCU wakes up |
| SPI Support |
| Disable | Enable SPI support for the AT module. |
| SDIO Support |
| Disable | Enable SDIO support for the AT module. |
| ATCMD BLEBRG Support |
| Disable | Enable Support for atcmd blebrg. |
| RF Support |
| 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).
| Configuration | Options | Default | Description |
| General |
| Name | Name must be a valid C symbol | g_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)
{
}
void *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)
{
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);
return err;
}
void at_basic_example ()
{
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;
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);
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)
{
}
}