Skip to content

Commit

Permalink
samples: net: http_get: add support for hl7800 modem
Browse files Browse the repository at this point in the history
Add overlay and small adjustments for using the hl7800 modem.
Works out of the box with pinnacle_100_dvk and mg100.

Signed-off-by: Ryan Erickson <ryan.erickson@ezurio.com>
  • Loading branch information
rerickson1 authored and kartben committed Jan 20, 2025
1 parent 490e675 commit b91c741
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
12 changes: 12 additions & 0 deletions samples/net/common/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Copyright (c) 2025 Ezurio
#
# SPDX-License-Identifier: Apache-2.0
#

config NET_SAMPLE_COMMON_WAIT_DNS_SERVER_ADDITION
bool "Wait DNS server addition before considering connection to be up"
depends on MODEM_HL7800 && !DNS_SERVER_IP_ADDRESSES
help
Make sure we get DNS server addresses from the network
before considering the connection to be up.
8 changes: 8 additions & 0 deletions samples/net/common/net_sample_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ LOG_MODULE_REGISTER(net_samples_common, LOG_LEVEL_DBG);
#include <zephyr/net/conn_mgr_connectivity.h>

#if defined(CONFIG_NET_CONNECTION_MANAGER)
#if defined(CONFIG_NET_SAMPLE_COMMON_WAIT_DNS_SERVER_ADDITION)
#define L4_EVENT_MASK (NET_EVENT_DNS_SERVER_ADD | NET_EVENT_L4_DISCONNECTED)
#else
#define L4_EVENT_MASK (NET_EVENT_L4_CONNECTED | NET_EVENT_L4_DISCONNECTED)
#endif

static struct net_mgmt_event_callback l4_cb;
static K_SEM_DEFINE(network_connected, 0, 1);
Expand All @@ -19,7 +23,11 @@ static void l4_event_handler(struct net_mgmt_event_callback *cb, uint32_t event,
struct net_if *iface)
{
switch (event) {
#if defined(CONFIG_NET_SAMPLE_COMMON_WAIT_DNS_SERVER_ADDITION)
case NET_EVENT_DNS_SERVER_ADD:
#else
case NET_EVENT_L4_CONNECTED:
#endif
LOG_INF("Network connectivity established and IP address assigned");
k_sem_give(&network_connected);
break;
Expand Down
8 changes: 8 additions & 0 deletions samples/net/sockets/http_get/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# Copyright (c) 2025 Ezurio
#
# SPDX-License-Identifier: Apache-2.0
#

source "samples/net/common/Kconfig"
source "Kconfig.zephyr"
15 changes: 15 additions & 0 deletions samples/net/sockets/http_get/overlay-hl7800.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# The HL7800 driver gets its IP settings from the cell network
CONFIG_DNS_SERVER_IP_ADDRESSES=n
CONFIG_NET_CONFIG_SETTINGS=n
# Wait for the network to be ready
CONFIG_NET_CONNECTION_MANAGER=y
CONFIG_NET_SAMPLE_COMMON_WAIT_DNS_SERVER_ADDITION=y
# NB-IoT has large latency, so increase timeouts. It is ok to use this for Cat-M1 as well.
CONFIG_NET_SOCKETS_DNS_TIMEOUT=12000
CONFIG_NET_SOCKETS_CONNECT_TIMEOUT=15000

# CONFIG_MODEM_LOG_LEVEL_DBG=y
# CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=1
# CONFIG_LOG_BUFFER_SIZE=20000
# CONFIG_MODEM_HL7800_SET_APN_NAME_ON_STARTUP=y
# CONFIG_MODEM_HL7800_APN_NAME="VZWINTERNET"
4 changes: 4 additions & 0 deletions samples/net/sockets/http_get/overlay-tls.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ CONFIG_MBEDTLS_HASH_ALL_ENABLED=y
CONFIG_MBEDTLS_CMAC=y

CONFIG_NET_SOCKETS_SOCKOPT_TLS=y

# Debugging options
#CONFIG_MBEDTLS_DEBUG=y
#CONFIG_MBEDTLS_LOG_LEVEL_DBG=y

0 comments on commit b91c741

Please sign in to comment.