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 Jan 12 08:20:43 2017 +0100
Parent:
47:3a30b960a8c2
Child:
49:d017830c0c67
Commit message:
Insert 'MAX_PACKET_LEN' checks when receiving

Changed in this revision

source/SimpleSpirit1.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/source/SimpleSpirit1.cpp	Thu Dec 22 08:25:22 2016 +0100
+++ b/source/SimpleSpirit1.cpp	Thu Jan 12 08:20:43 2017 +0100
@@ -525,10 +525,10 @@
 			spirit_rx_len = pkt_basic_get_received_pkt_length();
 
 #ifdef DEBUG_IRQ
-			debug_if(!(spirit_rx_len <= MAX_PACKET_LEN), "\n\rAssert failed in: %s (%d)\n\r", __func__, __LINE__);
+			debug_if(!(spirit_rx_len <= MAX_PACKET_LEN), "\n\r%s (%d): irq=%x\n\r", __func__, __LINE__, *tmp);
 #endif
 
-			for(; _spirit_rx_pos < spirit_rx_len;) {
+			if(spirit_rx_len <= MAX_PACKET_LEN) {
 				uint8_t to_receive = spirit_rx_len - _spirit_rx_pos;
 				if(to_receive > 0) {
 					spi_read_linear_fifo(to_receive, &spirit_rx_buf[_spirit_rx_pos]);
@@ -542,7 +542,7 @@
 			last_sqi  = qi_get_sqi();  //MGR
 
 			/* call user callback */
-			if(_current_irq_callback) {
+			if((_spirit_rx_pos == spirit_rx_len) && _current_irq_callback) {
 				_current_irq_callback(RX_DONE);
 			}
 
@@ -564,8 +564,14 @@
 #endif
 		} else {
 			uint8_t fifo_available = linear_fifo_read_num_elements_rx_fifo();
-			spi_read_linear_fifo(fifo_available, &spirit_rx_buf[_spirit_rx_pos]);
-			_spirit_rx_pos += fifo_available;
+			if((fifo_available + _spirit_rx_pos) <= MAX_PACKET_LEN) {
+				spi_read_linear_fifo(fifo_available, &spirit_rx_buf[_spirit_rx_pos]);
+				_spirit_rx_pos += fifo_available;
+			} else {
+#ifdef DEBUG_IRQ
+				debug("\n\r%s (%d): irq=%x\n\r", __func__, __LINE__, *tmp);
+#endif
+			}
 		}
 	}
 #endif // !RX_FIFO_THR_WA