|
| 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 | + |
| 8 | +Overview |
| 9 | +******** |
| 10 | + |
| 11 | +This sample demonstrates how to use the LoRa radio driver to receive packets |
| 12 | +both synchronously and asynchronously. |
| 13 | + |
| 14 | +In order to successfully receive messages, build and flash the accompanying |
| 15 | +LoRa send sample :zephyr:code-sample:`lora-send` on another board within range. |
| 16 | + |
| 17 | +As this sample receives a finite number of packets and then sleeps infinitely, |
| 18 | +the user must be ready to inspect the console output immediately after |
| 19 | +resetting the device. |
| 20 | + |
| 21 | +Building and Running |
| 22 | +******************** |
| 23 | + |
| 24 | +Build and flash the sample as follows, changing ``b_l072z_lrwan1`` for |
| 25 | +your board, where your board has a ``lora0`` alias in the devicetree. |
| 26 | + |
| 27 | +.. zephyr-app-commands:: |
| 28 | + :zephyr-app: zephyr/samples/drivers/lora/receive |
| 29 | + :host-os: unix |
| 30 | + :board: b_l072z_lrwan1 |
| 31 | + :goals: build flash |
| 32 | + :compact: |
| 33 | + |
| 34 | +Sample 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: Received data: helloworld (RSSI:-60dBm, SNR:7dBm) |
| 41 | + [00:00:02.249,000] <inf> lora_receive: Received data: helloworld (RSSI:-57dBm, SNR:9dBm) |
| 42 | + [00:00:03.541,000] <inf> lora_receive: Received data: helloworld (RSSI:-57dBm, SNR:9dBm) |
| 43 | + [00:00:04.834,000] <inf> lora_receive: Received data: helloworld (RSSI:-55dBm, SNR:9dBm) |
| 44 | + [00:00:04.834,000] <inf> lora_receive: Asynchronous reception |
| 45 | + [00:00:06.127,000] <inf> lora_receive: Received data: helloworld (RSSI:-55dBm, SNR:9dBm) |
| 46 | + [00:00:07.419,000] <inf> lora_receive: Received data: helloworld (RSSI:-55dBm, SNR:9dBm) |
| 47 | + [00:00:08.712,000] <inf> lora_receive: Received data: helloworld (RSSI:-55dBm, SNR:9dBm) |
| 48 | + [00:00:10.004,000] <inf> lora_receive: Received data: helloworld (RSSI:-55dBm, SNR:9dBm) |
| 49 | + [00:00:11.297,000] <inf> lora_receive: Received data: helloworld (RSSI:-55dBm, SNR:9dBm) |
| 50 | + [00:00:12.590,000] <inf> lora_receive: Received data: helloworld (RSSI:-55dBm, SNR:9dBm) |
| 51 | + [00:00:13.884,000] <inf> lora_receive: Received data: helloworld (RSSI:-55dBm, SNR:9dBm) |
| 52 | + [00:00:15.177,000] <inf> lora_receive: Received data: helloworld (RSSI:-55dBm, SNR:9dBm) |
| 53 | + [00:00:16.470,000] <inf> lora_receive: Received data: helloworld (RSSI:-55dBm, SNR:9dBm) |
| 54 | + [00:00:17.762,000] <inf> lora_receive: Received data: helloworld (RSSI:-55dBm, SNR:9dBm) |
| 55 | + [00:00:17.762,000] <inf> lora_receive: Stopping packet receptions |
0 commit comments