
The AT device package for controlling wireless modems is one of the most popular extensions for RTOS.
RTOS is an open-source embedded operating system, developed by RT-Thread. It provides developers with a standardized and user-friendly infrastructure, allowing them to write code for various devices. It contains a wealth of useful libraries and toolkits, making the development process more convenient.
RTOS is modular in nature to facilitate expansion, similar to Linux. Various packages allow developers to use RTOS for any desired target device. One of the most commonly used extensions for RTOS is the AT device package, which includes porting files and sample code for various AT devices (such as modems).
Among over 62,000 downloads (as of the writing of this article), one of the most popular RTOS extensions is the AT device package, which includes porting files and sample code for different AT devices.
About AT Commands
Initially, AT commands were a protocol used to control dial-up modems. As modem technology evolved to higher bandwidths, it can still be used as a lightweight and efficient device control protocol. Major mobile phone manufacturers have collaborated to develop a series of AT commands for controlling GSM modules on mobile phones.
Today, AT commands still have universality in the field of network communication; many devices, such as WiFi, Bluetooth, and 4G, support AT commands.
If you are creating dedicated devices for edge computing input, monitoring, or the Internet of Things (IoT), you may encounter some RTOS-supported AT devices, including ESP8266, ESP32, M26, MC20, RW007, MW31, SIM800C, W60X, SIM76XX, A9/A9G, BC26, AIR720, ME3616, M6315, BC28, and EC200X.
RT-Thread includes a Socket Abstraction Layer (SAL) component, which implements the abstraction of various network protocols and interfaces, providing a series of standard BSD socket APIs for the upper layer. SAL then takes over the AT socket interface, so developers only need to consider the network interfaces provided by the application layer.
This package implements AT socket functionality on devices (including the aforementioned devices), supporting communication in the form of AT commands through standard socket interfaces. Detailed information about these functionalities can be found in the RT-Thread Programming Guide.
The at_device package is distributed under the LGPLv2.1 license and can be easily obtained using the RT-Thread Env tool. This tool includes a configurator and a package manager, which are used to configure kernel and component functionalities, allowing for component customization and online package management. With these tools, developers can build systems as if they were stacking blocks.
Getting the AT Device Package
To use the AT devices configured with RTOS, you must enable the AT component library and AT socket functionality, which requires:
The AT device package has been updated for various versions. Different versions have corresponding configuration options, so they must be adapted to the corresponding system version. The most commonly used AT device package versions are:
The process of obtaining the correct version is mainly completed automatically during the generation menu. It provides the most suitable AT device package based on the existing system environment.
As mentioned earlier, different versions require different configuration options. For example,
RT-Thread online packages --->
IoT - internet of things --->
-*- AT DEVICE: RT-Thread AT component porting or samples for different device
[ ] Enable at device init by thread
AT socket device modules (Not selected, please select) --->
Version (V1.6.0) --->
Enabling the option to initialize the AT device by thread determines whether to create a separate thread for initializing the device network.
Version 2.x supports enabling multiple AT devices simultaneously:
RT-Thread online packages --->
IoT - internet of things --->
-*- AT DEVICE: RT-Thread AT component porting or samples for different device
[*] Quectel M26/MC20 --->
[*] Enable initialize by thread
[*] Enable sample
(-1) Power pin
(-1) Power status pin
(uart3) AT client device name
(512) The maximum length of receive line buffer
[ ] Quectel EC20 --->
[ ] Espressif ESP32 --->
[*] Espressif ESP8266 --->
[*] Enable initialize by thread
[*] Enable sample
(realthread) WIFI ssid
(12345678) WIFI password
(uart2) AT client device name
(512) The maximum length of receive line buffer
[ ] Realthread RW007 --->
[ ] SIMCom SIM800C --->
[ ] SIMCom SIM76XX --->
[ ] Notion MW31 --->
[ ] WinnerMicro W60X --->
[ ] AiThink A9/A9G --->
[ ] Quectel BC26 --->
[ ] Luat air720 --->
[ ] GOSUNCN ME3616 --->
[ ] ChinaMobile M6315 --->
[ ] Quectel BC28 --->
[ ] Quectel ec200x --->
Version (latest) --->
This version includes many other options, including the option to enable sample code, which is helpful for beginners or developers using unfamiliar devices.
You can also set corresponding options to choose the pins you want to use to power your components, indicate power status, the serial device name used by the sample device, and the maximum length of data received by the sample device. On suitable devices, you can also set the SSID and password.
In short, the control options are sufficient.
-1
.AT Component Configuration Options
When the AT component package is selected and device support is enabled, the client functionality of the AT component is also selected by default. For AT components, this means more options to set:
RT-Thread Components --->
Network --->
AT commands --->
[ ] Enable debug log output
[ ] Enable AT commands server
-*- Enable AT commands client
(1) The maximum number of supported clients
-*- Enable BSD Socket API support by AT commands
[*] Enable CLI(Command-Line Interface) for AT commands
[ ] Enable print RAW format AT command communication data
(128) The maximum length of AT Commands buffer
Configuration options related to the AT device package include:
Anything Is Possible
When you start programming embedded systems, you will quickly realize that you can create anything you can imagine. RTOS is designed to help you achieve this, and its packages provide you with a good starting point. Now, the interconnection of devices is also anticipated. Edge IoT technology must be able to communicate through various protocols, and the AT protocol is key.
via: https://opensource.com/article/21/3/rtos-embedded-development
Author: Alan Smithee Topic: lkxed Translator: cool-summer-021 Proofreader: wxy
This article is originally compiled by LCTT and proudly presented by Linux China

|