Getting Started with Embedded Systems for Edge Computing

Getting Started with Embedded Systems for Edge Computing
Introduction: The AT device package for controlling wireless modems is one of the most popular extensions for RTOS.
Getting Started with Embedded Systems for Edge ComputingThis article has 6145 words, reading time approximately: 7 minutes

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.

Getting Started with Embedded Systems for Edge Computing

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 Started with Embedded Systems for Edge Computing

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:

◈ RT_Thread 4.0.2+
◈ RT_Thread AT Component 1.3.0+
◈ RT_Thread SAL Component
◈ RT-Thread netdev Component

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:

◈ V1.2.0: For RT-Thread below V3.1.3, AT component V1.0.0
◈ V1.3.0: For RT-Thread below V3.1.3, AT component V1.1.0
◈ V1.4.0: For RT-Thread below V3.1.3 or equal to V4.0.0, AT component V1.2.0
◈ V1.5.0: For RT-Thread below V3.1.3 or equal to V4.0.0, AT component V1.2.0
◈ V1.6.0: For RT-Thread below V3.1.3 or equal to V4.0.1, AT component V1.2.0
◈ V2.0.0/V2.0.1: For RT-Thread above V3.1.3, AT component V1.3.0
◈ Latest Version: For RT-Thread above V3.1.3, AT component V1.3.0

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.

◈ Version 2.x.x supports enabling multiple AT devices simultaneously; to view the enabled device information, execute the ifconfig command in the finsh shell.
◈ Version 2.X.X requires devices to be registered before use; registration can be performed in the sample directory or customized in the application layer.
◈ Pin options, such as power pin and power status pin, are configured according to the hardware connections of the device. If the hardware’s power-on function is unavailable, they will be set to -1.
◈ An AT device should correspond to a serial name, and the AT client name of each device should be different.

Getting Started with Embedded Systems for Edge Computing

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:

◈ Maximum number of supported clients: When selecting multiple devices in the AT device package, this option needs to be configured to the corresponding number of devices;
◈ Enable BSD socket API functionality via AT commands: This option is selected by default when choosing the AT device package.
◈ Maximum length of AT commands: The maximum length of data that can be sent by AT commands

Getting Started with Embedded Systems for Edge Computing

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

Getting Started with Embedded Systems for Edge Computing
LCTT Translator: cool-summer-021
🌟🌟
Getting Started with Embedded Systems for Edge Computing
Translation: 9.0 articles

|

Contribution: 141 days
2022-09-22
2023-02-09
https://linux.cn/lctt/cool-summer-021
Welcome to reprint in accordance with the CC-BY-SA agreement,
If you need to reprint, please leave a message under the article “Reprint: Public Account Name“,
We will add you to the whitelist and authorize “you can modify when reprinting the article“.

Leave a Comment