got this sample program for 2+ sx1276 modules to communicate in a ping pong fashion. This program has been tested and verified to run with 915MHz Hope RFM95 modules running with MAX32620FTHR and MAX32630FTHR micro controllers.

Dependencies:   BMI160 BufferedSerial SX1276GenericLib USBDeviceHT max32630fthr

Fork of STM32L0_LoRa by Helmut Tschemernjak

Files at this revision

API Documentation at this revision

Comitter:
dev_alexander
Date:
Fri Jun 01 22:07:08 2018 +0000
Parent:
18:d5527ce82e6b
Commit message:
got this sample program for 2+ sx1276 modules to communicate in a ping pong fashion. This program has been tested and verified to run with 915MHz Hope RFM95 modules running with MAX32620FTHR and MAX32630FTHR micro controllers.

Changed in this revision

BMI160.lib Show annotated file Show diff for this revision Revisions of this file
PinMap.h Show annotated file Show diff for this revision Revisions of this file
SX1276GenericLib.lib Show annotated file Show diff for this revision Revisions of this file
SX1276GenericPingPong/GenericPingPong.cpp Show annotated file Show diff for this revision Revisions of this file
SX1276GenericPingPong/GenericPingPong.h Show annotated file Show diff for this revision Revisions of this file
USBDeviceHT.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
main.h Show annotated file Show diff for this revision Revisions of this file
max32630fthr.lib Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show diff for this revision Revisions of this file
utils.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BMI160.lib	Fri Jun 01 22:07:08 2018 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/MaximIntegrated/code/BMI160/#4949e9b15b6e
--- a/PinMap.h	Mon Mar 12 15:00:02 2018 +0000
+++ b/PinMap.h	Fri Jun 01 22:07:08 2018 +0000
@@ -97,6 +97,59 @@
 #define LORA_DIO5       NC      //
 
 
+#elif defined(TARGET_NUCLEO_F411RE) // using the RFM95 board
+
+#define LED             LED1    // green
+
+#define LORA_SPI_MOSI   PC_12
+#define LORA_SPI_MISO   PC_11
+#define LORA_SPI_SCLK   PC_10
+#define LORA_CS         PA_0
+#define LORA_RESET      PA_1
+#define LORA_DIO0       PD_2    // DIO0=TxDone/RXDone
+#define LORA_DIO1       PB_7    //
+#define LORA_DIO2       PC_14   // DIO2=FhssChangeChannel
+#define LORA_DIO3       PC_15   // DIO3=CADDone
+#define LORA_DIO4       PH_0    // ????
+#define LORA_DIO5       NC      // unused?
+
+
+#elif defined(TARGET_MAX32630FTHR) // using the RFM95 board
+
+// #define LED             PB_3    // green
+#define LED             LED2    // green
+
+#define LORA_SPI_MOSI   P5_1
+#define LORA_SPI_MISO   P5_2
+#define LORA_SPI_SCLK   P5_0
+#define LORA_CS         P3_0
+#define LORA_RESET      P3_1
+#define LORA_DIO0       P3_2    // DIO0=TxDone/RXDone/CADDone
+#define LORA_DIO1       NC      //
+#define LORA_DIO2       NC      // 
+#define LORA_DIO3       NC      // 
+#define LORA_DIO4       NC      // 
+#define LORA_DIO5       NC      //
+
+#elif defined(TARGET_MAX32620FTHR) // using the RFM95 board
+
+// #define LED             PB_3    // green
+#define LED             LED2    // green
+
+#define LORA_SPI_MOSI   P5_1
+#define LORA_SPI_MISO   P5_2
+#define LORA_SPI_SCLK   P5_0
+#define LORA_CS         P3_0
+#define LORA_RESET      P3_1
+#define LORA_DIO0       P3_2    // DIO0=TxDone/RXDone/CADDone
+#define LORA_DIO1       NC      //
+#define LORA_DIO2       NC      // 
+#define LORA_DIO3       NC      // 
+#define LORA_DIO4       NC      // 
+#define LORA_DIO5       NC      //
+
+
+
 #else 
 
 #error "unknown board"
--- a/SX1276GenericLib.lib	Mon Mar 12 15:00:02 2018 +0000
+++ b/SX1276GenericLib.lib	Fri Jun 01 22:07:08 2018 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/Helmut64/code/SX1276GenericLib/#528f37db941f
+https://os.mbed.com/users/dev_alexander/code/SX1276GenericLib/#ccfb6ca5f5e0
--- a/SX1276GenericPingPong/GenericPingPong.cpp	Mon Mar 12 15:00:02 2018 +0000
+++ b/SX1276GenericPingPong/GenericPingPong.cpp	Fri Jun 01 22:07:08 2018 +0000
@@ -19,7 +19,7 @@
 /* Set this flag to '1' to use the LoRa modulation or to '0' to use FSK modulation */
 #define USE_MODEM_LORA  1
 #define USE_MODEM_FSK   !USE_MODEM_LORA
-#define RF_FREQUENCY            RF_FREQUENCY_868_1  // Hz
+#define RF_FREQUENCY            RF_FREQUENCY_915_0  // Hz
 #define TX_OUTPUT_POWER         14                  // 14 dBm
 
 #if USE_MODEM_LORA == 1
@@ -97,8 +97,9 @@
 DigitalOut *led3;
 
 
-int SX1276PingPong() 
+int SX1276PingPong(void) 
 {
+	dprintf("TEST" );
 #if( defined ( TARGET_KL25Z ) || defined ( TARGET_LPC11U6X ) )
     DigitalOut *led = new DigitalOut(LED2);
 #elif defined(TARGET_NUCLEO_L073RZ) || defined(TARGET_DISCO_L072CZ_LRWAN1)
--- a/SX1276GenericPingPong/GenericPingPong.h	Mon Mar 12 15:00:02 2018 +0000
+++ b/SX1276GenericPingPong/GenericPingPong.h	Fri Jun 01 22:07:08 2018 +0000
@@ -23,11 +23,16 @@
 #ifndef __SX1276PINGPONG_H__
 #define __SX1276PINGPONG_H__
 
+/*
 #ifdef FEATURE_LORA
 int SX1276PingPong(void);
 #else
 #define  SX1276PingPong(x)   void()
 #endif
+*/
+
+int SX1276PingPong(void);
+
 /*
  * Callback functions prototypes
  */
--- a/USBDeviceHT.lib	Mon Mar 12 15:00:02 2018 +0000
+++ b/USBDeviceHT.lib	Fri Jun 01 22:07:08 2018 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/users/Helmut64/code/USBDeviceHT/#b6be2a43cb85
+https://os.mbed.com/users/dev_alexander/code/USBDeviceHT/#c1f162fd7777
--- a/main.cpp	Mon Mar 12 15:00:02 2018 +0000
+++ b/main.cpp	Fri Jun 01 22:07:08 2018 +0000
@@ -5,6 +5,10 @@
  */
  #include "main.h"
 
+ #if defined(TARGET_MAX32630FTHR) // using the RFM95 board
+   #include "max32630fthr.h"
+    MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
+ #endif
 
 DigitalOut myled(LED);
 
@@ -14,6 +18,8 @@
     DigitalOut vext(POWER_VEXT);
     vext = POWER_VEXT_ON;
 #endif    
+
+
     /*
      * inits the Serial or USBSerial when available (230400 baud).
      * If the serial uart is not is not connected it swiches to USB Serial
--- a/main.h	Mon Mar 12 15:00:02 2018 +0000
+++ b/main.h	Fri Jun 01 22:07:08 2018 +0000
@@ -4,6 +4,7 @@
   * Licensed under the Apache License, Version 2.0);
 */
 
+
 #include "mbed.h"
 #include "PinMap.h"
 #include "BufferedSerial.h"
@@ -12,6 +13,10 @@
 #endif
 #include "GenericPingPong.h"
 
+ 
+#define FEATURE_LORA
+
+ 
 
 extern BufferedSerial *ser;
 #ifdef FEATURE_USBSERIAL
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/max32630fthr.lib	Fri Jun 01 22:07:08 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/dev_alexander/code/max32630fthr/#32c43af04e8e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Fri Jun 01 22:07:08 2018 +0000
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#c26126ee5951b70703989c844c4d0bc8f498049b
--- a/mbed.bld	Mon Mar 12 15:00:02 2018 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/5571c4ff569f
\ No newline at end of file
--- a/utils.cpp	Mon Mar 12 15:00:02 2018 +0000
+++ b/utils.cpp	Fri Jun 01 22:07:08 2018 +0000
@@ -4,8 +4,12 @@
  */
  #include "main.h"
  
+#define BAUD_RATE 115200
+
+ 
 time_t cvt_date(char const *date, char const *time);
 
+
 BufferedSerial *ser;
 #ifdef FEATURE_USBSERIAL
 USBSerialBuffered *usb;
@@ -45,7 +49,7 @@
     {
 #endif
         ser = new BufferedSerial(USBTX, USBRX);
-        ser->baud(230400);
+        ser->baud(BAUD_RATE);
         ser->format(8);
     }
     time_t t = cvt_date(__DATE__, __TIME__);