Skip to content

Commit d7bb972

Browse files
committed
samples: drivers: modem: hello_hl78xx sample
Add HL78xx driver sample application Signed-off-by: Zafer SEN <[email protected]>
1 parent 89733c1 commit d7bb972

File tree

11 files changed

+620
-0
lines changed

11 files changed

+620
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
# Copyright (c) 2025 Netfeasa Ltd.
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# editors
7+
*.swp
8+
*~
9+
10+
# build
11+
/build*/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Sierra Wireless HL78XX Sample CMake file
2+
3+
# Copyright (c) 2025 Netfeasa
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
cmake_minimum_required(VERSION 3.20.0)
7+
8+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
9+
project(hello_hl78xx)
10+
11+
target_sources(app PRIVATE src/main.c)
12+
13+
include(${ZEPHYR_BASE}/samples/net/common/common.cmake)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Sierra Wireless HL78XX Sample options
2+
3+
# Copyright (c) 2025 Netfeasa
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
source "samples/net/common/Kconfig"
7+
source "Kconfig.zephyr"
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
.. zephyr:code-sample:: hello_hl78xx
2+
:name: Hello hl78xx modem driver
3+
4+
get & set basic hl78xx modem information & functionality with HL78XX modem APIs
5+
6+
Overview
7+
********
8+
9+
A simple sample that can be used with only Sierra Wireless HL78XX series modems
10+
11+
Notes
12+
*****
13+
14+
This sample uses the devicetree alias ``modem`` to identify
15+
the modem instance to use.
16+
17+
Building and Running
18+
********************
19+
20+
This application can be built and executed on QEMU as follows:
21+
22+
.. zephyr-app-commands::
23+
:zephyr-app: samples/drivers/modem/hello_hl78xx
24+
:host-os: all
25+
:goals: build flash
26+
:compact:
27+
28+
To build for another board, change "qemu_x86" above to that board's name.
29+
30+
Sample Output
31+
=============
32+
33+
.. code-block:: console
34+
35+
[00:00:12.840,000] <inf> hl78xx_socket: Apn="netfeasavodiot.mnc028.mcc901.gprs"
36+
[00:00:12.840,000] <inf> hl78xx_socket: Addr=10.149.105.74.255.255.255.252
37+
[00:00:12.840,000] <inf> hl78xx_socket: Gw=10.149.105.73
38+
[00:00:12.840,000] <inf> hl78xx_socket: DNS=141.1.1.1
39+
[00:00:12.840,000] <inf> hl78xx_socket: Extracted IP: 10.149.105.74
40+
[00:00:12.840,000] <inf> hl78xx_socket: Extracted Subnet: 255.255.255.252
41+
[00:00:12.840,000] <inf> hl78xx_dev: switch from run enable gprs script to carrier on
42+
[00:00:15.944,000] <inf> main: IP Up
43+
[00:00:15.944,000] <inf> main: Connected to network
44+
45+
**********************************************************
46+
********* Hello HL78XX Modem Sample Application **********
47+
**********************************************************
48+
[00:00:15.980,000] <inf> main: Manufacturer: Sierra Wireless
49+
[00:00:15.980,000] <inf> main: Firmware Version: HL7812.5.7.3.0
50+
[00:00:15.980,000] <inf> main: APN: netfeasavodiot
51+
[00:00:15.980,000] <inf> main: Imei: 351144441214500
52+
[00:00:15.980,000] <inf> main: RAT: NB1
53+
[00:00:15.980,000] <inf> main: Connection status: Not Registered
54+
[00:00:15.980,000] <inf> main: RSRP : -97
55+
**********************************************************
56+
57+
[00:00:15.980,000] <inf> main: Setting new APN:
58+
[00:00:15.980,000] <inf> main: IP down
59+
[00:00:15.980,000] <inf> main: Disconnected from network
60+
[00:00:16.013,000] <inf> main: New APN: ""
61+
[00:00:16.013,000] <inf> main: Test endpoint: flake.legato.io:6000
62+
[00:00:17.114,000] <inf> main: Resolved: 20.29.223.5:6000
63+
[00:00:17.114,000] <inf> main: Sample application finished.
64+
65+
After startup, code performs:
66+
67+
#. Modem readiness check and power-on
68+
#. Network interface setup via Zephyr's Connection Manager
69+
#. Modem queries (manufacturer, firmware, APN, IMEI, signal strength, etc.)
70+
#. Network registration and signal strength checks
71+
#. Setting and verifying a new APN
72+
#. Sending an AT command to validate communication
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
CONFIG_UART_ASYNC_API=y
2+
CONFIG_UART_1_ASYNC=y
3+
CONFIG_UART_1_INTERRUPT_DRIVEN=n
4+
# Enable HW RX byte counting. This especially matters at higher baud rates.
5+
CONFIG_UART_1_NRF_HW_ASYNC=y
6+
CONFIG_UART_1_NRF_HW_ASYNC_TIMER=1
7+
8+
CONFIG_ENTROPY_GENERATOR=y
9+
CONFIG_TEST_RANDOM_GENERATOR=y
10+
11+
CONFIG_MODEM_HL78XX_DEV_STARTUP_TIME=1000
12+
# Disable AT shell as SLM application has no AT mode user pipes
13+
CONFIG_MODEM_AT_SHELL=n
14+
# Increase log buffer size to accommodate large dumps
15+
CONFIG_LOG_MODE_DEFERRED=y
16+
CONFIG_LOG_BUFFER_SIZE=65535
17+
CONFIG_MODEM_MODULES_LOG_LEVEL_DBG=y
18+
CONFIG_MODEM_LOG_LEVEL_DBG=y
19+
CONFIG_MODEM_CHAT_LOG_BUFFER_SIZE=1024
20+
CONFIG_MODEM_HL78XX_LOG_CONTEXT_VERBOSE_DEBUG=y
21+
# Print logs and printk() output on uart0.
22+
CONFIG_LOG_BACKEND_UART=y
23+
CONFIG_MODEM_LOG_LEVEL_DBG=y
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/ {
2+
aliases {
3+
modem = &modem;
4+
};
5+
};
6+
7+
&uart1 {
8+
compatible = "nordic,nrf-uarte";
9+
current-speed = <115200>;
10+
hw-flow-control;
11+
status = "okay";
12+
13+
pinctrl-0 = <&uart1_default_alt>;
14+
modem: hl_modem {
15+
compatible = "swir,hl7812";
16+
status = "okay";
17+
mdm-reset-gpios = <&gpio0 20 (GPIO_ACTIVE_LOW)>;
18+
socket_offload: socket_offload {
19+
compatible = "swir,hl7812-offload";
20+
status = "okay";
21+
/* optional properties for future: */
22+
max-data-length = <512>;
23+
};
24+
gnss: hl_gnss {
25+
compatible = "swir,hl7812-gnss";
26+
pps-mode = "GNSS_PPS_MODE_DISABLED";
27+
fix-rate = <1000>;
28+
status = "okay";
29+
};
30+
};
31+
};
32+
33+
&pinctrl {
34+
uart1_default_alt: uart1_default_alt {
35+
group1 {
36+
psels = <NRF_PSEL(UART_RX, 0, 11)>;
37+
bias-pull-up;
38+
};
39+
group2 {
40+
psels = <NRF_PSEL(UART_TX, 0, 10)>,
41+
<NRF_PSEL(UART_RTS, 0, 12)>,
42+
<NRF_PSEL(UART_CTS, 0, 13)>;
43+
};
44+
};
45+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Logging
2+
CONFIG_LOG_BUFFER_SIZE=85536
3+
4+
# For extra verbosity
5+
CONFIG_MODEM_MODULES_LOG_LEVEL_DBG=y
6+
CONFIG_MODEM_LOG_LEVEL_DBG=y
7+
CONFIG_MODEM_CHAT_LOG_BUFFER_SIZE=1024
8+
CONFIG_MODEM_HL78XX_LOG_CONTEXT_VERBOSE_DEBUG=y
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Sierra Wireless HL78XX Sample configuration
2+
3+
# Copyright (c) 2025 Netfeasa Ltd.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
# The HL78xx driver gets its IP settings from the cell network
7+
8+
#system
9+
CONFIG_HEAP_MEM_POOL_SIZE=4096
10+
CONFIG_MAIN_STACK_SIZE=4096
11+
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
12+
CONFIG_POSIX_API=y
13+
14+
#PM
15+
# CONFIG_PM_DEVICE=y
16+
17+
#uart
18+
CONFIG_UART_ASYNC_API=y
19+
20+
# Generic networking options
21+
CONFIG_NETWORKING=y
22+
CONFIG_NET_UDP=y
23+
CONFIG_NET_TCP=y
24+
CONFIG_NET_IPV6=n
25+
CONFIG_NET_IPV4=y
26+
CONFIG_NET_SOCKETS=y
27+
28+
# DNS
29+
CONFIG_DNS_RESOLVER=y
30+
CONFIG_NET_SOCKETS_DNS_TIMEOUT=12000
31+
32+
# Wait for the network to be ready
33+
CONFIG_NET_SAMPLE_COMMON_WAIT_DNS_SERVER_ADDITION=y
34+
35+
# Network management
36+
CONFIG_NET_MGMT=y
37+
CONFIG_NET_MGMT_EVENT=y
38+
# NB-IoT has large latency, so increase timeouts. It is ok to use this for Cat-M1 as well.
39+
CONFIG_NET_SOCKETS_CONNECT_TIMEOUT=15000
40+
CONFIG_NET_CONNECTION_MANAGER=y
41+
42+
# Network buffers
43+
CONFIG_NET_PKT_RX_COUNT=32
44+
CONFIG_NET_PKT_TX_COUNT=16
45+
CONFIG_NET_BUF_RX_COUNT=64
46+
CONFIG_NET_BUF_TX_COUNT=32
47+
48+
# Modem driver
49+
CONFIG_MODEM=y
50+
51+
#hl78xx modem
52+
CONFIG_MODEM_HL78XX=y
53+
54+
# Statistics
55+
CONFIG_MODEM_STATS=y
56+
CONFIG_SHELL=y
57+
58+
#apn source
59+
# CONFIG_MODEM_HL78XX_APN_SOURCE_KCONFIG=y
60+
# CONFIG_MODEM_HL78XX_APN="internet"
61+
# CONFIG_MODEM_HL78XX_APN_SOURCE_ICCID=y
62+
# CONFIG_MODEM_HL78XX_APN_PROFILES="hologram=23450, wm=20601, vodafone=8988239, em=8988303"
63+
CONFIG_MODEM_HL78XX_BOOT_IN_FULLY_FUNCTIONAL_MODE=y
64+
65+
# RAT selection
66+
CONFIG_MODEM_HL78XX_AUTORAT=n
67+
# CONFIG_MODEM_HL78XX_AUTORAT_PRL_PROFILES="2,1,3"
68+
# CONFIG_MODEM_HL78XX_AUTORAT_NB_BAND_CFG="3,8,20,28"
69+
# CONFIG_MODEM_HL78XX_RAT_NB1=y
70+
71+
# Stay in boot mode until registered to a network
72+
# CONFIG_MODEM_HL78XX_STAY_IN_BOOT_MODE_FOR_ROAMING=y
73+
74+
# Monitor modem events
75+
CONFIG_HL78XX_EVT_MONITOR=y
76+
# Logging
77+
CONFIG_LOG=y
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
sample:
2+
description: Sample for HL78XX modem
3+
name: Hello HL78XX sample
4+
common:
5+
tags:
6+
- modem
7+
- hl78xx
8+
filter: dt_alias_exists("modem")
9+
tests:
10+
sample.driver.modem.hello_hl78xx:
11+
platform_allow:
12+
- nucleo_u575zi_q
13+
integration_platforms:
14+
- nucleo_u575zi_q
15+
extra_args:
16+
- SHIELD=swir_hl78xx_ev_kit

0 commit comments

Comments
 (0)