{"id":29013868,"url":"https://github.com/armmbed/mbed-os-example-cellular","last_synced_at":"2025-06-25T20:12:16.666Z","repository":{"id":21687031,"uuid":"85831783","full_name":"ARMmbed/mbed-os-example-cellular","owner":"ARMmbed","description":"This is an example based on mbed-os cellular APIs that demonstrates a TCP or UDP echo transaction with a public echo server.","archived":false,"fork":false,"pushed_at":"2024-04-17T13:27:37.000Z","size":245,"stargazers_count":21,"open_issues_count":2,"forks_count":45,"subscribers_count":77,"default_branch":"master","last_synced_at":"2024-12-06T22:13:36.290Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ARMmbed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-03-22T13:36:40.000Z","updated_at":"2024-08-09T07:28:47.000Z","dependencies_parsed_at":"2024-04-17T14:52:49.141Z","dependency_job_id":null,"html_url":"https://github.com/ARMmbed/mbed-os-example-cellular","commit_stats":null,"previous_names":[],"tags_count":81,"template":false,"template_full_name":null,"purl":"pkg:github/ARMmbed/mbed-os-example-cellular","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARMmbed%2Fmbed-os-example-cellular","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARMmbed%2Fmbed-os-example-cellular/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARMmbed%2Fmbed-os-example-cellular/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARMmbed%2Fmbed-os-example-cellular/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ARMmbed","download_url":"https://codeload.github.com/ARMmbed/mbed-os-example-cellular/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARMmbed%2Fmbed-os-example-cellular/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261945404,"owners_count":23234243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-25T20:12:15.159Z","updated_at":"2025-06-25T20:12:16.635Z","avatar_url":"https://github.com/ARMmbed.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](./resources/official_armmbed_example_badge.png)\n# Cellular Example\n\nThis is an example based on `mbed-os` cellular APIs that demonstrates a TCP or UDP echo transaction with a public echo server.\n\n(Note: To see this example in a rendered form you can import into the Arm Mbed Online Compiler, please see\n[the documentation](https://os.mbed.com/docs/mbed-os/latest/apis/cellular-api.html#cellular-example-connection-establishment).)\n\n## Getting started\n\nThis particular cellular application uses a cellular network and network-socket APIs that are part of [`mbed-os`](https://github.com/ARMmbed/mbed-os).\n\nThe program uses a [cellular modem driver](https://github.com/ARMmbed/mbed-os/tree/master/connectivity/cellular/include/cellular/framework/API)\nusing an external IP stack standard 3GPP AT 27.007 AT commands to setup the cellular modem and registers to the network.\n\nAfter registration, the driver opens a point-to-point protocol (PPP) pipe with the cellular modem and connects\nto internet. This driver currently supports UART data connection type only between your cellular modem and MCU.\n\nFor more information on Arm Mbed OS cellular APIs and porting guide, please visit the\n[Mbed OS cellular API](https://os.mbed.com/docs/mbed-os/latest/apis/cellular-networking.html) and\n[Mbed OS cellular porting guide](https://os.mbed.com/docs/mbed-os/latest/porting/cellular-device-porting.html).\n\n### Board support\n\nCurrently supported boards with onboard modem chips can be found under Mbed OS\n[/targets folder](https://github.com/ARMmbed/mbed-os/tree/master/targets).\nYou can find all cellular specific onboard modems by searching an overridden function\n`CellularDevice::get_target_default_instance()`.\n\nCurrently supported modem drivers can be found under cellular\n[/drivers folder](https://github.com/ARMmbed/mbed-os/tree/master/connectivity/drivers/cellular).\n\nFor a cellular shield, you need to define which shield to use with `provide-default`, and also how the shield is connected\nto the Mbed OS board. For example, a generic AT/PPP modem would add from the `GENERIC_AT3GPP/mbed_lib.json` file to your\n`mbed_app.json`:\n\n```\n    \"target_overrides\": {\n       \"GENERIC_AT3GPP.provide-default\": true,\n       \"GENERIC_AT3GPP.tx\": \"\u003ctx-pinmap\u003e\",\n       \"GENERIC_AT3GPP.rx\": \"\u003crx-pinmap\u003e\"\n    }\n```\n\n## Building and flashing the example\n\n### To build the example\n\nClone the repository containing example:\n\n```\ngit clone https://github.com/ARMmbed/mbed-os-example-cellular.git\n```\n\n**Tip:** If you don't have git installed, you can\n[download a zip file](https://github.com/ARMmbed/mbed-os-example-cellular/archive/master.zip) of the repository.\n\nUpdate the source tree:\n\n```\ncd mbed-os-example-cellular\nmbed deploy\n```\n\nRun the build:\n\n```mbed compile -t \u003cARM | GCC_ARM\u003e -m \u003cYOUR_TARGET\u003e```\n\n### To flash the example onto your board\n\nConnect your mbed board to your computer over USB. It appears as removable storage.\n\nWhen you run the `mbed compile` command above, mbed cli creates a .bin or a .hex file (depending on your target) in\n```BUILD/\u003ctarget-name\u003e/\u003ctoolchain\u003e``` under the example's directory. Drag and drop the file to the removable storage.\n\nAlternatively you may launch compilation with `-f` flag to have mbed tools attempt to flash your board.\nThe tools will flash the binary to all targets that match the board specified by '-m' parameter.\n\n### Change the network and SIM credentials\n\nSee the file `mbed_app.json` in the root directory of your application. This file contains all the user specific\nconfigurations your application needs. Provide the pin code for your SIM card, as well as any other cellular settings,\nor `null` if not used. For example:\n\n```json\n    \"target_overrides\": {\n        \"*\": {\n            \"nsapi.default-cellular-sim-pin\": \"\\\"1234\\\"\",\n```\n\n### Selecting socket type (TCP, UDP or NONIP)\n\nYou can choose which socket type the application should use; however, please note that TCP is a more reliable\ntransmission protocol. For example:\n\n```json\n\n     \"sock-type\": \"TCP\",\n\n```\n\n### Turning modem AT echo trace on\n\nIf you like details and wish to know about all the AT interactions between the modem and your driver, turn on the modem\nAT echo trace:\n\n```json\n        \"cellular.debug-at\": true\n```\n\n### Turning on the tracing and trace level\n\nIf you like to add more traces or follow the current ones you can turn traces on by changing `mbed-trace.enable` in\nmbed_app.json:\n\n```\"target_overrides\": {\n        \"*\": {\n            \"mbed-trace.enable\": true,\n```\n\nAfter you have defined `mbed-trace.enable: true`, you can set trace levels by changing value in `trace-level`:\n\n ```\"trace-level\": {\n            \"help\": \"Options are TRACE_LEVEL_ERROR,TRACE_LEVEL_WARN,TRACE_LEVEL_INFO,TRACE_LEVEL_DEBUG\",\n            \"macro_name\": \"MBED_TRACE_MAX_LEVEL\",\n            \"value\": \"TRACE_LEVEL_INFO\"\n        }\n```\n\n## Running the example\n\nWhen example application is running information about activity is printed over the serial connection.\n\n**Note:** The default serial baudrate has been set to 9600.\n\nPlease have a client open and connected to the board. You may use:\n\n- [Tera Term](https://ttssh2.osdn.jp/index.html.en) for windows\n\n- screen or minicom for Linux (example usage: `screen /dev/serial/\u003cyour board\u003e 9600`)\n\n- mbed tools has a terminal command `mbed term -b 9600`\n\n### Expected output\n\nYou should see an output similar to this:\n\n```\nmbed-os-example-cellular\nEstablishing connection\nConnection Established.\nTCP: connected with echo.mbedcloudtesting.com server\nTCP: Sent 4 Bytes to echo.mbedcloudtesting.com\nReceived from echo server 4 Bytes\nSuccess. Exiting\n```\n\n### Troubleshooting\n\n* Make sure the fields `nsapi.default-cellular-sim-pin`, `nsapi.default-cellular-plmn`, `nsapi.default-cellular-apn`,\n  `nsapi.default-cellular-username` and `nsapi.default-cellular-password` from the `mbed_app.json` file are filled in\n  correctly. The correct values should appear in the user manual of the board if using eSIM or in the details of the\n  SIM card if using normal SIM.\n* Enable trace flag to have access to debug information `\"mbed-trace.enable\": true` and `\"cellular.debug-at\": true`.\n* Error Message: Assertion failed: iface usually means that a default modem is not defined, e.g.\n  `\"GENERIC_AT3GPP.provide-default\": true`\n* If the modem does not respond to (AT) queries, check that UART pins (tx, rx, rts, cts) are connected and defined,\n  e.g. `\"GENERIC_AT3GPP.tx\": \"\u003ctx-pinmap\u003e\"`, ...\n* It is a common case that a modem seems to connect fine with just USB power, but actually it needs to have an external\n  power supply for a data connection.\n* Try both `TCP` and `UDP` socket types.\n* Try both `\"lwip.ppp-enabled\": true` and `\"lwip.ppp-enabled\": false`.\n* The modem may support only a fixed baud-rate, such as `\"platform.default-serial-baud-rate\": 9600`.\n* The modem and network may only support IPv6 in which case `\"lwip.ipv6-enabled\": true` shall be defined.\n* The SIM and modem must have compatible cellular technology (3G, 4G, NB-IoT, ...) supported and cellular network available.\n* Enable CIoT optimization for NONIP socket `control-plane-opt: true`.\n\nIf you have problems to get started with debugging, you can review the\n[documentation](https://os.mbed.com/docs/latest/tutorials/debugging.html) for suggestions on what could be wrong and how to fix it.\n\n## License and contributions\n\nThe software is provided under Apache-2.0 license. Contributions to this project are accepted under the same license.\nPlease see [contributing.md](CONTRIBUTING.md) for more info.\n\nThis project contains code from other projects. The original license text is included in those source files.\nThey must comply with our license guide\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmmbed%2Fmbed-os-example-cellular","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farmmbed%2Fmbed-os-example-cellular","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farmmbed%2Fmbed-os-example-cellular/lists"}