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).

Revision:
30:9c6dcfc47619
Parent:
28:6a71e15d5272
Child:
31:a4d8072139f2
--- a/SimpleSpirit1.h	Thu Nov 17 08:26:41 2016 +0100
+++ b/SimpleSpirit1.h	Fri Nov 18 13:35:27 2016 +0100
@@ -74,12 +74,7 @@
 
     void rx_timeout_handler(void) {
     	set_ready_state();
-		cmd_strobe(SPIRIT1_STROBE_FRX);
 	    cmd_strobe(SPIRIT1_STROBE_RX);
-	    CLEAR_TXBUF();
-	    CLEAR_RXBUF();
-	    _spirit_rx_err = false;
-	    _spirit_tx_started = false;
 #ifndef NDEBUG
 	    debug("\n\r%s (%d)\n\r", __func__, __LINE__);
 #endif
@@ -110,7 +105,7 @@
     /** Status Variables from Cube Implementation **/
     unsigned int spirit_on;
     uint8_t last_rssi; //MGR
-    uint8_t last_lqi;  //MGR
+    uint8_t last_sqi;  //MGR
 
     /** Low Level Instance Variables **/
     unsigned int _nr_of_irq_disables;
@@ -259,8 +254,8 @@
     	return SpiritQiGetRssi();
     }
 
-    uint8_t qi_get_lqi() {
-    	return SpiritQiGetLqi();
+    uint8_t qi_get_sqi() {
+    	return SpiritQiGetSqi();
     }
 
     /** Timer Instance Methods **/
@@ -436,20 +431,29 @@
     	return _is_receiving;
     }
 
-    /** Get latest value of RSSI **/
+    /** Get latest value of RSSI (in dBm) **/
     float get_last_rssi_dbm(void) {
+    	get_last_rssi_raw();
+		return (-120.0+((float)(last_rssi-20))/2);
+    }
+
+    /** Get latest value of RSSI (as Spirit1 raw value) **/
+    uint8_t get_last_rssi_raw(void) {
     	if(last_rssi == 0) {
     		last_rssi = qi_get_rssi();
     	}
-    	return (-120.0+((float)(last_rssi-20))/2);
+    	return last_rssi;
     }
 
-    /** Get latest value of LQI **/
-    uint8_t get_last_lqi(void) {
-    	if(last_lqi == 0) {
-    		last_lqi = qi_get_lqi();
+    /** Get latest value of LQI (scaled to 8-bit) **/
+    uint8_t get_last_sqi(void) {
+    	const uint8_t max_sqi = 8 * ((SYNC_LENGTH>>1)+1);
+    	if(last_sqi == 0) {
+    		last_sqi = qi_get_sqi();
     	}
-    	return last_lqi;
+    	if(last_sqi > max_sqi) last_sqi = max_sqi;
+
+    	return (last_sqi * 255 / max_sqi);
     }
 
     /** Reset Board **/