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 15This sample can be found under 16:zephyr_file:`samples/subsys/lorawan/class_a` in the Zephyr tree. 17 18Before building the sample, make sure to select the correct region in the 19``prj.conf`` file. 20 21The following commands build and flash the sample. 22 23.. zephyr-app-commands:: 24 :zephyr-app: samples/subsys/lorawan/class_a 25 :board: nucleo_wl55jc 26 :goals: build flash 27 :compact: 28 29Important Notes for Multiple Runs 30********************************* 31 32By 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. 33 34To run this sample multiple times, choose one of the following options: 35 361. **Manually Increment ``dev_nonce``:** 37 Modify the sample code to increment ``join_cfg.otaa.dev_nonce`` before each connection attempt and ensure it is preserved across reboots. 38 392. **Built-in Zephyr Settings Implementation:** 40 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. 41