Prototype RF driver for STM Sub-1 GHz RF expansion board based on the SPSGRF-868 module for STM32 Nucleo.

Prototype RF Driver for STM Sub-1 GHz RF Expansion Boards based on the SPSGRF-868 and SPSGRF-915 Modules for STM32 Nucleo

Currently supported boards:

Note, in order to use expansion board X-NUCLEO-IDS01A4 in mbed you need to perform the following HW modifications on the board:

  • Unmount resistor R4
  • Mount resistor R7

Furthermore, on some Nucleo development boards (e.g. the NUCLEO_F429ZI), in order to be able to use Ethernet together with these Sub-1 GHz RF expansion boards, you need to compile this driver with macro SPIRIT1_SPI_MOSI=PB_5 defined, while the development board typically requires some HW modification as e.g. described here!

This driver can be used together with the 6LoWPAN stack (a.k.a. Nanostack).

Files at this revision

API Documentation at this revision

Comitter:
Wolfgang Betz
Date:
Mon Oct 24 08:34:33 2016 +0200
Parent:
7:e90fa8f6bc6c
Child:
9:3db68ab23070
Commit message:
Disable CONTIKI related stuff & Add Channel Setting Function

Changed in this revision

SimpleSpirit1.cpp Show annotated file Show diff for this revision Revisions of this file
SimpleSpirit1.h Show annotated file Show diff for this revision Revisions of this file
--- a/SimpleSpirit1.cpp	Fri Oct 21 14:56:55 2016 +0200
+++ b/SimpleSpirit1.cpp	Mon Oct 24 08:34:33 2016 +0200
@@ -75,9 +75,11 @@
 
     /* init cube vars */
     spirit_on = OFF;
+#ifdef CONTIKI // betzw - TODO
     packet_is_prepared = 0;
+    just_got_an_ack = 0;
+#endif // CONTIKI
     receiving_packet = 0;
-    just_got_an_ack = 0;
     last_rssi = 0 ; //MGR
     last_lqi = 0 ;  //MGR
 }
@@ -162,6 +164,7 @@
     spirit_gpio_init(&x_gpio_init);
 }
 
+#ifdef CONTIKI // betzw - TODO
 /** Prepare the radio with a packet to be sent. **/
 int SimpleSpirit1::prepare_contiki(const void *payload, unsigned short payload_len) {
 	PRINTF("Spirit1: prep %u\n", payload_len);
@@ -265,6 +268,7 @@
 
 	return RADIO_TX_OK;
 }
+#endif // CONTIKI
 
 int SimpleSpirit1::send(const void *payload, unsigned int payload_len) {
 	/* Checks if the payload length is supported */
--- a/SimpleSpirit1.h	Fri Oct 21 14:56:55 2016 +0200
+++ b/SimpleSpirit1.h	Mon Oct 24 08:34:33 2016 +0200
@@ -74,9 +74,8 @@
     /** Status Variables from Cube Implementation **/
     volatile uint8_t receiving_packet;
     volatile unsigned int spirit_on;
-    int just_got_an_ack;
-    uint16_t last_rssi; //MGR
-    uint16_t last_lqi;  //MGR
+    uint8_t last_rssi; //MGR
+    uint8_t last_lqi;  //MGR
 
     /** Low Level Instance Variables **/
     unsigned int _nr_of_irq_disables;
@@ -209,8 +208,8 @@
     }
 
     float qi_get_rssi_dbm() {
-    	last_rssi = SpiritQiGetRssi();
-    	return (-120.0+((float)(last_rssi-20))/2);
+    	last_rssi = qi_get_rssi();
+    	return get_last_rssi_dbm();
     }
 
     uint8_t qi_get_rssi() {
@@ -306,7 +305,11 @@
     ~SimpleSpirit1(void); // should never be called!
 
 private:
+#ifdef CONTIKI // betzw - TODO
     /*** Original Contiki APIs & Variables ***/
+    /** Interrupt callback just detected an ack **/
+    int just_got_an_ack;
+
     /** Variable(s) for Original API(s) **/
     int packet_is_prepared;
 
@@ -323,6 +326,7 @@
       }
       return transmit_contiki(payload_len);
     }
+#endif // CONTIKI
 
 public:
     static SimpleSpirit1& CreateInstance(PinName mosi, PinName miso, PinName sclk,
@@ -362,6 +366,11 @@
     int on(void);
     int off(void);
 
+    /** Set Channel **/
+    void set_channel(uint8_t channel) {
+    	SpiritRadioSetChannel(channel);
+    }
+
     /** Send a Buffer **/
     int send(const void *payload, unsigned int payload_len);
 
@@ -383,12 +392,12 @@
     int get_pending_packet(void);
 
     /** Get latest value of RSSI **/
-    uint16_t get_last_rssi(void) {
-    	return last_rssi;
+    float get_last_rssi_dbm(void) {
+    	return (-120.0+((float)(last_rssi-20))/2);
     }
 
     /** Get latest value of LQI **/
-    uint16_t get_last_lqi(void) {
+    uint8_t get_last_lqi(void) {
     	return last_lqi;
     }
 };