README.rst
1.. zephyr:code-sample:: lorawan-class-a
2 :name: LoRaWAN class A device
3 :relevant-api: lorawan_api
4
5 Join a LoRaWAN network and send a message periodically.
6
7Overview
8********
9
10A simple application to demonstrate the :ref:`LoRaWAN subsystem <lorawan_api>` of Zephyr.
11
12Building and Running
13********************
14
15Before building the sample, make sure to select the correct region in the
16``prj.conf`` file.
17
18The following commands build and flash the sample.
19
20.. zephyr-app-commands::
21 :zephyr-app: samples/subsys/lorawan/class_a
22 :board: nucleo_wl55jc
23 :goals: build flash
24 :compact:
25
26Important Notes for Multiple Runs
27*********************************
28
29By default, this example will only succeed the first time it is run. On subsequent join attempts, the LoRaWAN network server may reject the join request due to a hardcoded ``dev_nonce`` value. According to the LoRaWAN specification, ``dev_nonce`` must increment for every new connection attempt.
30
31To run this sample multiple times, choose one of the following options:
32
331. **Manually Increment ``dev_nonce``:**
34 Modify the sample code to increment ``join_cfg.otaa.dev_nonce`` before each connection attempt and ensure it is preserved across reboots.
35
362. **Built-in Zephyr Settings Implementation:**
37 Enable :kconfig:option:`CONFIG_LORAWAN_NVM_SETTINGS` in the Kconfig. This allows proper storage and reuse of configuration settings, including the ``dev_nonce``, across multiple runs.
38