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:
Thu Nov 24 08:47:27 2016 +0100
Parent:
38:5deec3ab2025
Child:
40:343254875d89
Commit message:
Treat RX/TX race condition in favor of TX

Changed in this revision

source/NanostackRfPhySpirit1.cpp Show annotated file Show diff for this revision Revisions of this file
source/SimpleSpirit1.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/source/NanostackRfPhySpirit1.cpp	Wed Nov 23 07:00:33 2016 +0100
+++ b/source/NanostackRfPhySpirit1.cpp	Thu Nov 24 08:47:27 2016 +0100
@@ -841,7 +841,7 @@
     /*Type of RF PHY is SubGHz*/
     device_driver.link_type = PHY_LINK_15_4_SUBGHZ_TYPE;
 
-    /*Maximum size of payload is 255*/
+    /*Maximum size of payload*/
     device_driver.phy_MTU = MAX_PACKET_LEN;
 
     /*No header in PHY*/
--- a/source/SimpleSpirit1.cpp	Wed Nov 23 07:00:33 2016 +0100
+++ b/source/SimpleSpirit1.cpp	Thu Nov 24 08:47:27 2016 +0100
@@ -563,12 +563,20 @@
 
 	/* The IRQ_VALID_SYNC is used to notify a new packet is coming */
 	if(x_irq_status.IRQ_VALID_SYNC) {
-		_is_receiving = true;
-		_spirit_rx_err = false;
-		CLEAR_RXBUF();
+		/* betzw - NOTE: there is a race condition between Spirit1 receiving packets and
+		 *               the MCU trying to send a packet, which gets resolved in favor of
+		 *               sending.
+		 */
+		if(_spirit_tx_started) {
 #ifdef DEBUG_IRQ
-		debug_if(_spirit_tx_started, "\n\rAssert failed in: %s (%d)\n\r", __func__, __LINE__);
+			uint32_t *tmp = (uint32_t*)&x_irq_status;
+			debug("\n\r%s (%d): irq=%x", __func__, __LINE__, *tmp);
 #endif
-		start_rx_timeout();
+		} else {
+			_is_receiving = true;
+			_spirit_rx_err = false;
+			CLEAR_RXBUF();
+			start_rx_timeout();
+		}
 	}
 }