Hardware Abstraction Layer, permitting any LoRa application to use any LoRa radio chip

Dependents:   alarm_slave alarm_master lora_p2p lorawan1v1 ... more

radio chip selection

Radio chip driver is not included, allowing choice of radio device.
If you're using SX1272 or SX1276, then import sx127x driver into your program.
if you're using SX1261 or SX1262, then import sx126x driver into your program.
if you're using SX1280, then import sx1280 driver into your program.
if you're using LR1110, then import LR1110 driver into your program.
If you're using NAmote72 or Murata discovery, then you must import only sx127x driver.
If you're using Type1SJ select target DISCO_L072CZ_LRWAN1 and import sx126x driver into your program.

Pin assigned to arduino LoRa radio shield form-factor

Files at this revision

API Documentation at this revision

Comitter:
Wayne Roberts
Date:
Fri Feb 05 16:35:05 2021 -0800
Parent:
20:75635d50262e
Commit message:
lr1110: handle tcxo when hf-xosc fails to start

Changed in this revision

radio.h Show annotated file Show diff for this revision Revisions of this file
radio_lr1110.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 75635d50262e -r 96db08266089 radio.h
--- a/radio.h	Fri Jul 10 10:52:39 2020 -0700
+++ b/radio.h	Fri Feb 05 16:35:05 2021 -0800
@@ -164,6 +164,10 @@
         static void txDoneBottom(void);
         static void timeout_callback(bool);
 #endif /* SX128x_H */
+#if defined(SX1265_H)
+        static void my_irq_handler(void);
+        static bool init_irq;
+#endif /* SX1265_H */
         static void chipModeChange(void);
         static void rfsw_callback(void);
         static void ocp(uint8_t ma);
diff -r 75635d50262e -r 96db08266089 radio_lr1110.cpp
--- a/radio_lr1110.cpp	Fri Jul 10 10:52:39 2020 -0700
+++ b/radio_lr1110.cpp	Fri Feb 05 16:35:05 2021 -0800
@@ -188,6 +188,13 @@
     }
 }
 
+bool Radio::init_irq;
+void Radio::my_irq_handler()
+{
+    /* radio irq immediately after hardware reset: hf_xosc start due to TCXO */
+    init_irq = true;
+}
+
 void Radio::dio9_top_half()
 {
     irqAt = lpt.read_us();
@@ -228,6 +235,7 @@
 
 void Radio::Init(const RadioEvents_t* e, unsigned spi_hz)
 {
+    uint64_t a, b;
     /* initialize payload length to zero in packet params */
     lora_pp_buf[3] = 0;
     gfsk_pp_buf[6] = 0;
@@ -236,14 +244,26 @@
     radio.rxDone = rx_done;
     radio.timeout = timeout_callback;
     //radio.chipModeChange = chipModeChange;
-    radio.dio9_topHalf = dio9_top_half;
 
     RadioEvents = e;
     lpt.start();
 
     spi.frequency(spi_hz);
 
+    radio.dio9_topHalf = my_irq_handler;
+    init_irq = false;
     radio.hw_reset();
+    a = Kernel::get_ms_count();
+    do {
+        b = Kernel::get_ms_count();
+        /* wait for radio interrupt at hardware reset, failure to start hf_xosc */
+        if (init_irq) {
+            radio.service();
+            break;
+        }
+    } while ((b - a) < 30);
+
+    radio.dio9_topHalf = dio9_top_half;
 
     initRfSwDIO();
 }