1.. zephyr:code-sample:: lora-receive
2 :name: LoRa receive
3 :relevant-api: lora_api
4
5 Receive packets in both synchronous and asynchronous mode using the LoRa
6 radio.
7
8Overview
9********
10
11This sample demonstrates how to use the LoRa radio driver to receive packets
12both synchronously and asynchronously.
13
14In order to successfully receive messages, build and flash the accompanying
15LoRa send sample :zephyr:code-sample:`lora-send` on another board within range.
16
17As this sample receives a finite number of packets and then sleeps infinitely,
18the user must be ready to inspect the console output immediately after
19resetting the device.
20
21Building and Running
22********************
23
24Build and flash the sample as follows, changing ``b_l072z_lrwan1`` for
25your board, where your board has a ``lora0`` alias in the devicetree.
26
27.. zephyr-app-commands::
28 :zephyr-app: samples/drivers/lora/receive
29 :host-os: unix
30 :board: b_l072z_lrwan1
31 :goals: build flash
32 :compact:
33
34Sample Output
35=============
36
37.. code-block:: console
38
39 [00:00:00.235,000] <inf> lora_receive: Synchronous reception
40 [00:00:00.956,000] <inf> lora_receive: LoRa RX RSSI: -60dBm, SNR: 7dB
41 [00:00:00.956,000] <inf> lora_receive: LoRa RX payload
42 68 65 6c 6c 6f 77 6f 72 6c 64 |hellowor ld
43 [00:00:02.249,000] <inf> lora_receive: LoRa RX RSSI: -57dBm, SNR: 9dB
44 [00:00:02.249,000] <inf> lora_receive: LoRa RX payload
45 68 65 6c 6c 6f 77 6f 72 6c 64 |hellowor ld
46 [00:00:03.541,000] <inf> lora_receive: LoRa RX RSSI: -57dBm, SNR: 9dB
47 [00:00:03.541,000] <inf> lora_receive: LoRa RX payload
48 68 65 6c 6c 6f 77 6f 72 6c 64 |hellowor ld
49 [00:00:04.834,000] <inf> lora_receive: LoRa RX RSSI: -55dBm, SNR: 9dB
50 [00:00:04.834,000] <inf> lora_receive: LoRa RX payload
51 68 65 6c 6c 6f 77 6f 72 6c 64 |hellowor ld
52 [00:00:04.834,000] <inf> lora_receive: Asynchronous reception
53 [00:00:06.127,000] <inf> lora_receive: LoRa RX RSSI: -55dBm, SNR: 9dB
54 [00:00:06.127,000] <inf> lora_receive: LoRa RX payload
55 68 65 6c 6c 6f 77 6f 72 6c 64 |hellowor ld
56 [00:00:07.419,000] <inf> lora_receive: LoRa RX RSSI: -55dBm, SNR: 9dB
57 [00:00:07.419,000] <inf> lora_receive: LoRa RX payload
58 68 65 6c 6c 6f 77 6f 72 6c 64 |hellowor ld
59 [00:00:08.712,000] <inf> lora_receive: LoRa RX RSSI: -55dBm, SNR: 9dB
60 [00:00:08.712,000] <inf> lora_receive: LoRa RX payload
61 68 65 6c 6c 6f 77 6f 72 6c 64 |hellowor ld
62 [00:00:10.004,000] <inf> lora_receive: LoRa RX RSSI: -55dBm, SNR: 9dB
63 [00:00:10.004,000] <inf> lora_receive: LoRa RX payload
64 68 65 6c 6c 6f 77 6f 72 6c 64 |hellowor ld
65 [00:00:11.297,000] <inf> lora_receive: LoRa RX RSSI: -55dBm, SNR: 9dB
66 [00:00:11.297,000] <inf> lora_receive: LoRa RX payload
67 68 65 6c 6c 6f 77 6f 72 6c 64 |hellowor ld
68 [00:00:12.590,000] <inf> lora_receive: LoRa RX RSSI: -55dBm, SNR: 9dB
69 [00:00:12.590,000] <inf> lora_receive: LoRa RX payload
70 68 65 6c 6c 6f 77 6f 72 6c 64 |hellowor ld
71 [00:00:13.884,000] <inf> lora_receive: LoRa RX RSSI: -55dBm, SNR: 9dB
72 [00:00:13.884,000] <inf> lora_receive: LoRa RX payload
73 68 65 6c 6c 6f 77 6f 72 6c 64 |hellowor ld
74 [00:00:15.177,000] <inf> lora_receive: LoRa RX RSSI: -55dBm, SNR: 9dB
75 [00:00:15.177,000] <inf> lora_receive: LoRa RX payload
76 68 65 6c 6c 6f 77 6f 72 6c 64 |hellowor ld
77 [00:00:16.470,000] <inf> lora_receive: LoRa RX RSSI: -55dBm, SNR: 9dB
78 [00:00:16.470,000] <inf> lora_receive: LoRa RX payload
79 68 65 6c 6c 6f 77 6f 72 6c 64 |hellowor ld
80 [00:00:17.762,000] <inf> lora_receive: LoRa RX RSSI: -55dBm, SNR: 9dB
81 [00:00:17.762,000] <inf> lora_receive: LoRa RX payload
82 68 65 6c 6c 6f 77 6f 72 6c 64 |hellowor ld
83 [00:00:17.762,000] <inf> lora_receive: Stopping packet receptions
84