[riot-notifications] [RIOT-OS/RIOT] drivers/sx126x: fix netdev send and recv function (#16570)

Francisco notifications at github.com
Tue Jul 6 11:28:11 CEST 2021


@fjmolinas approved this pull request.

ACK, used the following patch to send msg between two radios:

```diff
diff --git a/tests/driver_sx126x/main.c b/tests/driver_sx126x/main.c
index 313c95b4ed..c273731f17 100644
--- a/tests/driver_sx126x/main.c
+++ b/tests/driver_sx126x/main.c
@@ -65,6 +65,7 @@ static void _event_cb(netdev_t *dev, netdev_event_t event)
         case NETDEV_EVENT_RX_COMPLETE:
         {
             size_t len = dev->driver->recv(dev, NULL, 0, 0);
+            assert(len >= 0);
             netdev_lora_rx_info_t packet_info;
             dev->driver->recv(dev, message, len, &packet_info);
             printf(
@@ -275,9 +276,14 @@ static int sx126x_tx_cmd(netdev_t *netdev, int argc, char **argv)
 
     printf("sending \"%s\" payload (%u bytes)\n",
            argv[2], (unsigned)strlen(argv[2]) + 1);
+    iolist_t iolist_copy = {
+        .iol_base = argv[2],
+        .iol_len = (strlen(argv[2]) + 1),
+    };
     iolist_t iolist = {
         .iol_base = argv[2],
-        .iol_len = (strlen(argv[2]) + 1)
+        .iol_len = (strlen(argv[2]) + 1),
+        .iol_next = &iolist_copy
     };
 
     if (netdev->driver->send(netdev, &iolist) == -ENOTSUP) {
```

```
2021-07-06 11:26:05,359 # sx126x tx hello
2021-07-06 11:26:05,362 # sending "hello" payload (6 bytes)
> 2021-07-06 11:26:05,406 # Transmission completed
```

The payload is received twice ( first radio is using llc68 hat, second is a stm32wl)
```
2021-07-06 11:26:03,375 # sx126x rx start
2021-07-06 11:26:03,377 # Listen mode started
> 2021-07-06 11:26:05,386 # Data reception started
2021-07-06 11:26:05,410 # Received: "hello" (12 bytes) - [RSSI: 204, SNR: 13, TOA: 26ms]

```



-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16570#pullrequestreview-699736161
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210706/c6f62da4/attachment.htm>


More information about the notifications mailing list