samples: net: Remove deprecated gsm_modem sample
The gsm_modem driver is deprecated, and will be removed. Remove the gsm modem sample which depends on the deprecated driver. Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
This commit is contained in:
parent
f9dce2d87f
commit
c8050e2a83
8 changed files with 0 additions and 296 deletions
|
@ -1,8 +0,0 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
project(gsm_modem)
|
||||
|
||||
target_sources(app PRIVATE src/main.c)
|
|
@ -1,40 +0,0 @@
|
|||
.. zephyr:code-sample:: gsm-modem
|
||||
:name: Generic GSM modem
|
||||
|
||||
Use a GSM modem to connect to a GPRS network.
|
||||
|
||||
Overview
|
||||
********
|
||||
|
||||
The Zephyr GSM modem sample application allows user to have a connection
|
||||
to GPRS network. The connection to GSM modem is done using
|
||||
:ref:`PPP (Point-to-Point Protocol) <ppp>`.
|
||||
|
||||
The source code of this sample application can be found at:
|
||||
:zephyr_file:`samples/net/gsm_modem`.
|
||||
|
||||
Requirements
|
||||
************
|
||||
|
||||
- GSM modem card. The sample has been tested with SIMCOM SIM808 card. All
|
||||
GSM modem cards should work as long as they support **AT+CGDCONT** command.
|
||||
- Almost any Zephyr enabled board with sufficient resources can be used.
|
||||
The sample has been tested with :ref:`reel_board`.
|
||||
|
||||
Build and Running
|
||||
*****************
|
||||
|
||||
If you are using an external modem like the SIMCOM card, then connect
|
||||
the necessary pins like RX and TX from your Zephyr target board to the
|
||||
modem card. Internal modems, like what is found in :ref:`particle_boron`
|
||||
board, are not yet supported.
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/net/gsm_modem
|
||||
:board: reel_board
|
||||
:goals: build flash
|
||||
:gen-args: -DCONFIG_MODEM_GSM_APN=\"internet\"
|
||||
:compact:
|
||||
|
||||
Note that you might need to change the APN name according to your GSM network
|
||||
configuration.
|
|
@ -1,12 +0,0 @@
|
|||
CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
CONFIG_GSM_MUX=y
|
||||
CONFIG_UART_MUX=y
|
||||
CONFIG_MODEM_GSM_APN="internet"
|
||||
CONFIG_MAIN_STACK_SIZE=8192
|
||||
CONFIG_MODEM_GSM_QUECTEL=y
|
||||
CONFIG_MODEM_SHELL=n
|
||||
CONFIG_NET_MGMT_EVENT_INFO=y
|
||||
CONFIG_NET_MGMT_EVENT_MONITOR=y
|
||||
CONFIG_NET_MGMT_EVENT_MONITOR_AUTO_START=y
|
||||
CONFIG_NET_LOG=y
|
||||
CONFIG_NET_MGMT_EVENT_LOG_LEVEL_DBG=y
|
|
@ -1,37 +0,0 @@
|
|||
/ {
|
||||
aliases {
|
||||
modem-uart = &usart2;
|
||||
modem = &modem;
|
||||
};
|
||||
};
|
||||
|
||||
&gpioh {
|
||||
misc_fixed_usart2 {
|
||||
gpio-hog;
|
||||
gpios = <13 GPIO_ACTIVE_HIGH>;
|
||||
output-high;
|
||||
};
|
||||
};
|
||||
|
||||
&gpdma1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
/* BG95 */
|
||||
&usart2 {
|
||||
pinctrl-0 = <&usart2_tx_pa2 &usart2_rx_pa3 &usart2_rts_pa1 &usart2_cts_pa0>;
|
||||
pinctrl-names = "default";
|
||||
current-speed = <115200>;
|
||||
hw-flow-control;
|
||||
|
||||
dmas = <&gpdma1 0 27 STM32_DMA_PERIPH_TX
|
||||
&gpdma1 1 26 STM32_DMA_PERIPH_RX>;
|
||||
dma-names = "tx", "rx";
|
||||
|
||||
status = "okay";
|
||||
|
||||
modem: modem {
|
||||
compatible = "zephyr,gsm-ppp";
|
||||
status = "okay";
|
||||
};
|
||||
};
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
* UART 2 is configured on FRDM pins PTD0, rts; PTD1, cts; PTD2, rx; PTD3, tx
|
||||
* see https://www.nxp.com/docs/en/data-sheet/K64P144M120SF5.pdf chapter 5.1,
|
||||
* page 74
|
||||
*/
|
||||
&uart2 {
|
||||
status = "okay";
|
||||
current-speed = <115200>;
|
||||
gsm: gsm-modem {
|
||||
compatible = "zephyr,gsm-ppp";
|
||||
};
|
||||
};
|
|
@ -1,35 +0,0 @@
|
|||
# UART support
|
||||
CONFIG_SERIAL=y
|
||||
|
||||
# GSM modem support
|
||||
CONFIG_MODEM=y
|
||||
CONFIG_MODEM_GSM_PPP=y
|
||||
|
||||
# PPP networking support
|
||||
CONFIG_NET_DRIVERS=y
|
||||
CONFIG_NET_PPP=y
|
||||
CONFIG_NET_L2_PPP=y
|
||||
CONFIG_NET_NATIVE=y
|
||||
CONFIG_NETWORKING=y
|
||||
|
||||
CONFIG_NET_L2_PPP_TIMEOUT=10000
|
||||
|
||||
# IPv4 enables PPP IPCP support
|
||||
CONFIG_NET_IPV4=y
|
||||
CONFIG_NET_IPV6=n
|
||||
|
||||
# Network management events
|
||||
CONFIG_NET_CONNECTION_MANAGER=y
|
||||
|
||||
# Log buffers, modem and PPP
|
||||
CONFIG_LOG=y
|
||||
CONFIG_NET_LOG=y
|
||||
#CONFIG_LOG_BUFFER_SIZE=16384
|
||||
#CONFIG_MODEM_LOG_LEVEL_DBG=y
|
||||
#CONFIG_NET_PPP_LOG_LEVEL_DBG=y
|
||||
#CONFIG_NET_L2_PPP_LOG_LEVEL_DBG=y
|
||||
#CONFIG_NET_MGMT_EVENT_LOG_LEVEL_DBG=y
|
||||
#CONFIG_NET_CONNECTION_MANAGER_LOG_LEVEL_DBG=y
|
||||
|
||||
CONFIG_NET_SHELL=y
|
||||
CONFIG_MODEM_SHELL=y
|
|
@ -1,22 +0,0 @@
|
|||
common:
|
||||
harness: net
|
||||
depends_on: serial-net
|
||||
tags:
|
||||
- net
|
||||
- ppp
|
||||
- modem
|
||||
- gsm
|
||||
platform_allow: frdm_k64f
|
||||
extra_args: DTC_OVERLAY_FILE="boards/frdm_uart2_dts.overlay"
|
||||
sample:
|
||||
description: Sample for generic GSM modem
|
||||
name: Generic GSM modem using PPP
|
||||
tests:
|
||||
sample.net.ppp.gsm.modem:
|
||||
extra_configs:
|
||||
- CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
sample.net.ppp.gsm.modem.mux:
|
||||
extra_configs:
|
||||
- CONFIG_TEST_RANDOM_GENERATOR=y
|
||||
- CONFIG_GSM_MUX=y
|
||||
- CONFIG_UART_MUX=y
|
|
@ -1,130 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr/kernel.h>
|
||||
#include <zephyr/sys/printk.h>
|
||||
#include <zephyr/shell/shell.h>
|
||||
#include <zephyr/drivers/uart.h>
|
||||
#include <zephyr/net/net_mgmt.h>
|
||||
#include <zephyr/net/net_event.h>
|
||||
#include <zephyr/net/conn_mgr_monitor.h>
|
||||
#include <zephyr/drivers/modem/gsm_ppp.h>
|
||||
#include <zephyr/devicetree.h>
|
||||
|
||||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(sample_gsm_ppp, LOG_LEVEL_DBG);
|
||||
|
||||
#define GSM_MODEM_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(zephyr_gsm_ppp)
|
||||
#define UART_NODE DT_BUS(GSM_MODEM_NODE)
|
||||
|
||||
static const struct device *const gsm_dev = DEVICE_DT_GET(GSM_MODEM_NODE);
|
||||
static struct net_mgmt_event_callback mgmt_cb;
|
||||
static bool starting = IS_ENABLED(CONFIG_GSM_PPP_AUTOSTART);
|
||||
|
||||
static int cmd_sample_modem_suspend(const struct shell *sh,
|
||||
size_t argc, char *argv[])
|
||||
{
|
||||
ARG_UNUSED(argc);
|
||||
ARG_UNUSED(argv);
|
||||
|
||||
if (!starting) {
|
||||
shell_fprintf(sh, SHELL_NORMAL, "Modem is already stopped.\n");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
gsm_ppp_stop(gsm_dev);
|
||||
starting = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_sample_modem_resume(const struct shell *sh,
|
||||
size_t argc, char *argv[])
|
||||
{
|
||||
ARG_UNUSED(argc);
|
||||
ARG_UNUSED(argv);
|
||||
|
||||
if (starting) {
|
||||
shell_fprintf(sh, SHELL_NORMAL, "Modem is already started.\n");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
gsm_ppp_start(gsm_dev);
|
||||
starting = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
SHELL_STATIC_SUBCMD_SET_CREATE(sample_commands,
|
||||
SHELL_CMD(resume, NULL,
|
||||
"Resume the modem\n",
|
||||
cmd_sample_modem_resume),
|
||||
SHELL_CMD(suspend, NULL,
|
||||
"Suspend the modem\n",
|
||||
cmd_sample_modem_suspend),
|
||||
SHELL_SUBCMD_SET_END
|
||||
);
|
||||
|
||||
SHELL_CMD_REGISTER(sample, &sample_commands,
|
||||
"Sample application commands", NULL);
|
||||
|
||||
|
||||
static void event_handler(struct net_mgmt_event_callback *cb,
|
||||
uint32_t mgmt_event, struct net_if *iface)
|
||||
{
|
||||
ARG_UNUSED(cb);
|
||||
ARG_UNUSED(iface);
|
||||
|
||||
if ((mgmt_event & (NET_EVENT_L4_CONNECTED
|
||||
| NET_EVENT_L4_DISCONNECTED)) != mgmt_event) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mgmt_event == NET_EVENT_L4_CONNECTED) {
|
||||
LOG_INF("Network connected");
|
||||
return;
|
||||
}
|
||||
|
||||
if (mgmt_event == NET_EVENT_L4_DISCONNECTED) {
|
||||
LOG_INF("Network disconnected");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void modem_on_cb(const struct device *dev, void *user_data)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
ARG_UNUSED(user_data);
|
||||
|
||||
LOG_INF("GSM modem on callback fired");
|
||||
}
|
||||
|
||||
static void modem_off_cb(const struct device *dev, void *user_data)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
ARG_UNUSED(user_data);
|
||||
|
||||
LOG_INF("GSM modem off callback fired");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
const struct device *const uart_dev = DEVICE_DT_GET(UART_NODE);
|
||||
|
||||
/* Optional register modem power callbacks */
|
||||
gsm_ppp_register_modem_power_callback(gsm_dev, modem_on_cb, modem_off_cb, NULL);
|
||||
|
||||
LOG_INF("Board '%s' APN '%s' UART '%s' device %p (%s)",
|
||||
CONFIG_BOARD, CONFIG_MODEM_GSM_APN,
|
||||
uart_dev->name, uart_dev, gsm_dev->name);
|
||||
|
||||
net_mgmt_init_event_callback(&mgmt_cb, event_handler,
|
||||
NET_EVENT_L4_CONNECTED |
|
||||
NET_EVENT_L4_DISCONNECTED);
|
||||
net_mgmt_add_event_callback(&mgmt_cb);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue