xiaoxiang781216 commented on code in PR #17763:
URL: https://github.com/apache/nuttx/pull/17763#discussion_r2660107019
##########
drivers/wireless/lpwan/sx126x/Kconfig:
##########
@@ -25,4 +25,4 @@ config LPWAN_SX126X_MAX_DEVICES
int "SX126X maximum devices"
default 1
-endif # DRIVERS_LPWAN
+endif # LPWAN_SX126X
Review Comment:
merge to the first patch
##########
drivers/wireless/lpwan/sx127x/sx127x.c:
##########
@@ -1276,6 +1278,50 @@ static int sx127x_poll(FAR struct file *filep, FAR
struct pollfd *fds,
#endif
}
+/****************************************************************************
+ * Name: sx127x_rx_watchdog
+ *
+ * Description:
+ * Watchdog to detect SX127x RX communication stall
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_LPWAN_SX127X_RXSUPPORT
+static void sx127x_rx_watchdog(FAR void *arg)
+{
+ FAR struct sx127x_dev_s *dev = (FAR struct sx127x_dev_s *) arg;
Review Comment:
remove space before arg
##########
drivers/wireless/lpwan/sx127x/sx127x.c:
##########
@@ -4614,6 +4675,9 @@ int sx127x_register(FAR struct spi_dev_s *spi,
dev->crcon = CONFIG_LPWAN_SX127X_CRCON;
#ifdef CONFIG_LPWAN_SX127X_FSKOOK
dev->fskook.fixlen = false;
+# ifdef CONFIG_LPWAN_SX127X_TXSUPPORT
Review Comment:
CONFIG_LPWAN_SX127X_RXSUPPORT
##########
drivers/wireless/lpwan/sx127x/sx127x.c:
##########
@@ -1276,6 +1278,50 @@ static int sx127x_poll(FAR struct file *filep, FAR
struct pollfd *fds,
#endif
}
+/****************************************************************************
+ * Name: sx127x_rx_watchdog
+ *
+ * Description:
+ * Watchdog to detect SX127x RX communication stall
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_LPWAN_SX127X_RXSUPPORT
+static void sx127x_rx_watchdog(FAR void *arg)
+{
+ FAR struct sx127x_dev_s *dev = (FAR struct sx127x_dev_s *) arg;
+ clock_t now = clock_systime_ticks();
+
+ if (dev->opmode == SX127X_OPMODE_RX &&
+ (now - dev->last_rx_tick) > MSEC2TICK(dev->rx_timeout))
+ {
+ wlerr("RX stall detected, restarting RX\n");
+
+ /* Leave RX mode to clear AFC + bit sync */
+
+ sx127x_opmode_set(dev, SX127X_OPMODE_STANDBY);
+
+ /* datasheet-safe delay */
+
+ nxsched_usleep(100);
+
+ /* Re-enter RX */
+
+ sx127x_opmode_set(dev, SX127X_OPMODE_RX);
+
+ /* Avoid using old RX tick, otherwise it always will fail */
+
+ dev->last_rx_tick = now;
+ }
+
+ /* Reschedule watchdog */
+
+ work_queue(LPWORK, &dev->rx_watchdog,
Review Comment:
but when we stop the watchdog
##########
drivers/wireless/lpwan/sx126x/Kconfig:
##########
@@ -25,4 +25,4 @@ config LPWAN_SX126X_MAX_DEVICES
int "SX126X maximum devices"
default 1
-endif # DRIVERS_LPWAN
+endif # LPWAN_SX126X
Review Comment:
merge to the first patch
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]