|
| 1 | +# Cellular Interface library<a name="cellular-interface"></a> |
| 2 | + |
| 3 | +## Introduction<a name="freertos-cellular-interface-introduction"></a> |
| 4 | + |
| 5 | +The FreeRTOS Cellular Interface library exposes the capabilities of a few popular cellular modems through a uniform API\. Currently, this project contains libraries for these three cellular modems\. |
| 6 | ++ [Quectel BG96](https://www.quectel.com/product/lte-bg96-cat-m1-nb1-egprs/) |
| 7 | ++ [ Sierra Wireless HL7802 ](https://www.sierrawireless.com/products-and-solutions/embedded-solutions/products/hl7802/) |
| 8 | ++ [U\-Blox Sara\-R4](https://www.u-blox.com/en/product/sara-r4-series) |
| 9 | + |
| 10 | +The current version of the Cellular Interface library encapsulates the TCP stack offered by those cellular modems\. They all implement the same uniform [ Cellular Interface library API](https://www.freertos.org/Documentation/api-ref/cellular/index.html)\. That API hides the complexity of AT commands, and exposes a socket\-like interface to C programmers\. |
| 11 | + |
| 12 | +Even though applications can choose to use the Cellular Interface API directly, it is not designed for this purpose\. In a typical FreeRTOS system, applications use higher level libraries, such as the [coreMQTT](https://www.freertos.org/mqtt/index.html) library and the [coreHTTP](https://www.freertos.org/http/index.html) library, to communicate with other end points\. These higher level libraries use an abstract interface, the [Transport Interface](https://www.freertos.org/network-interface.html), to send and receive data\. A Transport Interface can be implemented on top of the Cellular Interface library; the [FreeRTOS Cellular demo](https://www.freertos.org/cellular-demo.html) uses such an implementation\. |
| 13 | + |
| 14 | +Most cellular modems implement more or less of the AT commands defined by the [ 3GPP TS v27\.007](https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDetails.aspx?specificationId=1515) standard\. This project provides an [implementation](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/tree/main/source) of such standard AT commands in a [ reusable common component](https://freertos.org/Documentation/api-ref/cellular/cellular_porting_module_guide.html)\. The three Cellular Interface libraries in this project all take advantage of that common code\. The library for each modem only implements the vendor\-specific AT commands, then exposes the complete Cellular Interface API\. |
| 15 | + |
| 16 | +The common component that implements the 3GPP TS v27\.007 standard has been written in compliance with the following code quality criteria: |
| 17 | ++ GNU Complexity scores are not over 8 |
| 18 | ++ MISRA C:2012 coding standard\. Any deviations from the standard are documented in source code comments marked by "coverity"\. |
| 19 | + |
| 20 | +## Dependencies and requirements<a name="freertos-cellular-interface-dependencies"></a> |
| 21 | + |
| 22 | +There is no direct dependency for the Cellular Interface library\. However, Ethernet, Wi\-Fi and cellular cannot co\-exist in the FreeRTOS network stack\. Developers must choose one of the network interface to integrate with the [Secure Sockets library](https://docs.aws.amazon.com/freertos/latest/userguide/secure-sockets.html)\. |
| 23 | + |
| 24 | +## Porting<a name="freertos-cellular-interface-porting"></a> |
| 25 | + |
| 26 | +For information about porting the Cellular Interface library to your platform, see [ Porting the Cellular Interface library](https://docs.aws.amazon.com/freertos/latest/portingguide/freertos-porting-cellular.html) in the *FreeRTOS Porting Guide*\. |
| 27 | + |
| 28 | +## Memory use<a name="freertos-cellular-interface-memory-use"></a> |
| 29 | + |
| 30 | + |
| 31 | +**** |
| 32 | + |
| 33 | +| Code Size of cellular interface library \(example generated with GCC for ARM Cortex\-M\) | File | With \-O1 Optimization | With \-Os Optimization | |
| 34 | +| --- | --- | --- | --- | |
| 35 | +| cellular\_3gpp\_api\.c | 6\.3K | 5\.7K | |
| 36 | +| cellular\_3gpp\_urc\_handler\.c | 0\.9K | 0\.8K | |
| 37 | +| cellular\_at\_core\.c | 1\.4K | 1\.2K | |
| 38 | +| cellular\_common\_api\.c | 0\.5K | 0\.5K | |
| 39 | +| cellular\_common\.c | 1\.6K | 1\.4K | |
| 40 | +| cellular\_pkthandler\.c | 1\.4K | 1\.2K | |
| 41 | +| cellular\_pktio\.c | 1\.8K | 1\.6K | |
| 42 | +| Total estimates | 13\.9K | 12\.4K | |
| 43 | + |
| 44 | +## Getting started<a name="freertos-cellular-interface-getting-started"></a> |
| 45 | + |
| 46 | +### Download the source code<a name="freertos-cellular-interface-download-source"></a> |
| 47 | + |
| 48 | +The source code can be downloaded as part of the FreeRTOS libraries or by itself\. |
| 49 | + |
| 50 | +To clone the library from Github using HTTPS: |
| 51 | + |
| 52 | +``` |
| 53 | +git clone https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface.git |
| 54 | +``` |
| 55 | + |
| 56 | +Using SSH: |
| 57 | + |
| 58 | +``` |
| 59 | +git clone git@github.com:FreeRTOS/FreeRTOS-Cellular-Interface.git |
| 60 | +``` |
| 61 | + |
| 62 | +### Folder structure<a name="freertos-cellular-interface-folder-structure"></a> |
| 63 | + |
| 64 | +At the root of this repository you will see these folders: |
| 65 | ++ `source` : reusable common code that implements the standard AT commands defined by 3GPP TS v27\.007 |
| 66 | ++ `modules` : vendor\-specific code that implements non\-3GPP AT commands for each cellular modem |
| 67 | ++ `doc` : documentation |
| 68 | ++ `test` : unit test and cbmc |
| 69 | ++ `tools` : tools for Coverity static analysis and CMock |
| 70 | + |
| 71 | +### Configure and build the Library<a name="freertos-cellular-interface-configure"></a> |
| 72 | + |
| 73 | +The FreeRTOS Cellular Interface library should be built as part of an application\. In order to do this, you must provide certain configurations\. The [ Lab\-Project\-FreeRTOS\-Cellular\-Demo](https://github.com/FreeRTOS/Lab-Project-FreeRTOS-Cellular-Demo) project provides an [ example](https://github.com/FreeRTOS/Lab-Project-FreeRTOS-Cellular-Demo/blob/main/source/cellular/bg96/cellular_config.h) of how to configure the build\. More information can be found in the [Cellular API References](https://www.freertos.org/Documentation/api-ref/cellular/cellular_config.html)\. |
| 74 | + |
| 75 | +Please refer to the [README file of the Lab\-Project\-FreeRTOS\-Cellular\-Demo](https://github.com/FreeRTOS/Lab-Project-FreeRTOS-Cellular-Demo) project for more information\. |
| 76 | + |
| 77 | +## Integrate the FreeRTOS Cellular Interface library with MCU platforms<a name="freertos-cellular-interface-integrate"></a> |
| 78 | + |
| 79 | +The FreeRTOS Cellular Interface library runs on MCUs using an abstracted interface, the [ Comm Interface](https://github.com/FreeRTOS/FreeRTOS-Cellular-Interface/blob/main/source/interface/cellular_comm_interface.h), to communicate with cellular modems\. A Comm Interface must be implemented on the MCU platform as well\. The most common implementations of the Comm Interface communicate over UART hardware, but can be implemented over other physical interfaces, such as SPI, as well\. The documentation for the Comm Interface can be found in the [ Cellular API References](https://www.freertos.org/Documentation/api-ref/cellular/cellular_porting.html#cellular_porting_comm_if)\. The following example implementations of the Comm Interface are available: |
| 80 | ++ [ FreeRTOS Windows simulator comm interface](https://github.com/FreeRTOS/Lab-Project-FreeRTOS-Cellular-Demo/blob/main/source/cellular/comm_if_windows.c) |
| 81 | ++ [ FreeRTOS Common IO UART comm interface](https://github.com/aws/amazon-freertos/blob/main/libraries/abstractions/common_io/include/iot_uart.h) |
| 82 | ++ [ STM32 L475 discovery board comm interface](https://github.com/aws/amazon-freertos/blob/feature/cellular/vendors/st/boards/stm32l475_discovery/ports/comm_if/comm_if_uart.c) |
| 83 | ++ [ Sierra Sensor Hub board comm interface](https://github.com/aws/amazon-freertos/blob/feature/cellular/vendors/sierra/boards/sensorhub/ports/comm_if/comm_if_sierra.c) |
0 commit comments